summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/arthur/lance/lance.pro2
-rw-r--r--tests/auto/checkxmlfiles/checkxmlfiles.pro2
-rw-r--r--tests/auto/collections/tst_collections.cpp11
-rw-r--r--tests/auto/corelib.pro1
-rw-r--r--tests/auto/declarative/examples/examples.pro2
-rw-r--r--tests/auto/declarative/moduleqt47/moduleqt47.pro2
-rw-r--r--tests/auto/declarative/parserstress/parserstress.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro2
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro2
-rw-r--r--tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro2
-rw-r--r--tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro2
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro2
-rw-r--r--tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro2
-rw-r--r--tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro2
-rw-r--r--tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro2
-rw-r--r--tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro2
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro2
-rw-r--r--tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro2
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro2
-rw-r--r--tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro2
-rw-r--r--tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro2
-rw-r--r--tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro2
-rw-r--r--tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro2
-rw-r--r--tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro2
-rw-r--r--tests/auto/declarative/qdeclarativescriptdebugging/qdeclarativescriptdebugging.pro2
-rw-r--r--tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro2
-rw-r--r--tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro2
-rw-r--r--tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro2
-rw-r--r--tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro2
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/alignments_cb.pngbin496 -> 496 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/alignments_cc.pngbin556 -> 556 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/alignments_ct.pngbin533 -> 533 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro2
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro2
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro2
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro2
-rw-r--r--tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro2
-rw-r--r--tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro2
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro2
-rw-r--r--tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro2
-rw-r--r--tests/auto/declarative/qmlvisual/qmlvisual.pro2
-rw-r--r--tests/auto/gui.pro1
-rw-r--r--tests/auto/macnativeevents/expectedeventlist.cpp29
-rw-r--r--tests/auto/macnativeevents/expectedeventlist.h2
-rw-r--r--tests/auto/macnativeevents/nativeeventlist.cpp8
-rw-r--r--tests/auto/macnativeevents/nativeeventlist.h1
-rw-r--r--tests/auto/macnativeevents/qnativeevents_mac.cpp8
-rw-r--r--tests/auto/macnativeevents/tst_macnativeevents.cpp107
-rwxr-xr-xtests/auto/mediaobject/mediaobject.pro2
-rw-r--r--tests/auto/networkselftest/networkselftest.pro4
-rw-r--r--tests/auto/networkselftest/tst_networkselftest.cpp290
-rw-r--r--tests/auto/opengl.pro1
-rw-r--r--tests/auto/patternistexamples/patternistexamples.pro12
-rw-r--r--tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro2
-rw-r--r--tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro2
-rw-r--r--tests/auto/qaccessibility/qaccessibility.pro2
-rw-r--r--tests/auto/qaccessibility/tst_qaccessibility.cpp7
-rw-r--r--tests/auto/qapplication/test/test.pro10
-rw-r--r--tests/auto/qaudioinput/qaudioinput.pro2
-rw-r--r--tests/auto/qaudiooutput/qaudiooutput.pro2
-rw-r--r--tests/auto/qbytearray/qbytearray.pro2
-rw-r--r--tests/auto/qbytearray/tst_qbytearray.cpp54
-rw-r--r--tests/auto/qchar/qchar.pro2
-rw-r--r--tests/auto/qcheckbox/tst_qcheckbox.cpp7
-rw-r--r--tests/auto/qclipboard/test/test.pro12
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp39
-rw-r--r--tests/auto/qcssparser/qcssparser.pro4
-rw-r--r--tests/auto/qdatastream/qdatastream.pro4
-rw-r--r--tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp16
-rw-r--r--tests/auto/qdesktopservices/qdesktopservices.pro12
-rw-r--r--tests/auto/qdir/qdir.pro2
-rw-r--r--tests/auto/qdir/tst_qdir.cpp46
-rw-r--r--tests/auto/qdiriterator/qdiriterator.pro2
-rw-r--r--tests/auto/qdirmodel/qdirmodel.pro6
-rw-r--r--tests/auto/qdom/qdom.pro2
-rw-r--r--tests/auto/qfile/test/test.pro4
-rw-r--r--tests/auto/qfiledialog/qfiledialog.pro4
-rw-r--r--tests/auto/qfiledialog2/qfiledialog2.pro4
-rw-r--r--tests/auto/qfiledialog2/tst_qfiledialog2.cpp4
-rw-r--r--tests/auto/qfileinfo/qfileinfo.pro4
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp170
-rw-r--r--tests/auto/qfilesystemmodel/qfilesystemmodel.pro2
-rw-r--r--tests/auto/qfontdatabase/qfontdatabase.pro2
-rw-r--r--tests/auto/qfontdatabase/tst_qfontdatabase.cpp35
-rw-r--r--tests/auto/qfontmetrics/qfontmetrics.pro2
-rw-r--r--tests/auto/qfontmetrics/testfont.qrc5
-rw-r--r--tests/auto/qfontmetrics/tst_qfontmetrics.cpp22
-rw-r--r--tests/auto/qfontmetrics/ucs4font.ttfbin0 -> 3076 bytes
-rw-r--r--tests/auto/qftp/qftp.pro4
-rw-r--r--tests/auto/qfuturewatcher/tst_qfuturewatcher.cpp35
-rw-r--r--tests/auto/qgl/tst_qgl.cpp26
-rw-r--r--tests/auto/qglfunctions/qglfunctions.pro7
-rw-r--r--tests/auto/qglfunctions/tst_qglfunctions.cpp244
-rw-r--r--tests/auto/qglthreads/tst_qglthreads.cpp299
-rw-r--r--tests/auto/qglthreads/tst_qglthreads.h4
-rw-r--r--tests/auto/qglyphs/qglyphs.pro11
-rw-r--r--tests/auto/qglyphs/test.ttfbin0 -> 3712 bytes
-rw-r--r--tests/auto/qglyphs/tst_qglyphs.cpp573
-rw-r--r--tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro2
-rw-r--r--tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro2
-rw-r--r--tests/auto/qgraphicseffect/qgraphicseffect.pro2
-rw-r--r--tests/auto/qgraphicseffectsource/qgraphicseffectsource.pro2
-rw-r--r--tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro2
-rw-r--r--tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp630
-rw-r--r--tests/auto/qgraphicsitemanimation/qgraphicsitemanimation.pro2
-rw-r--r--tests/auto/qgraphicslayout/qgraphicslayout.pro2
-rw-r--r--tests/auto/qgraphicslayoutitem/qgraphicslayoutitem.pro2
-rw-r--r--tests/auto/qgraphicslinearlayout/qgraphicslinearlayout.pro2
-rw-r--r--tests/auto/qgraphicsobject/qgraphicsobject.pro1
-rw-r--r--tests/auto/qgraphicspixmapitem/qgraphicspixmapitem.pro2
-rw-r--r--tests/auto/qgraphicspolygonitem/qgraphicspolygonitem.pro2
-rw-r--r--tests/auto/qgraphicsscene/qgraphicsscene.pro4
-rw-r--r--tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro2
-rw-r--r--tests/auto/qgraphicstransform/qgraphicstransform.pro1
-rw-r--r--tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro4
-rw-r--r--tests/auto/qhelpenginecore/qhelpenginecore.pro4
-rw-r--r--tests/auto/qhttp/qhttp.pro12
-rw-r--r--tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp48
-rw-r--r--tests/auto/qicoimageformat/qicoimageformat.pro10
-rw-r--r--tests/auto/qicon/qicon.pro12
-rw-r--r--tests/auto/qimage/qimage.pro6
-rw-r--r--tests/auto/qimage/tst_qimage.cpp112
-rw-r--r--tests/auto/qimagereader/qimagereader.pro8
-rw-r--r--tests/auto/qimagewriter/qimagewriter.pro6
-rw-r--r--tests/auto/qiodevice/qiodevice.pro4
-rw-r--r--tests/auto/qiodevice/tst_qiodevice.cpp59
-rw-r--r--tests/auto/qitemdelegate/tst_qitemdelegate.cpp26
-rw-r--r--tests/auto/qitemmodel/qitemmodel.pro4
-rw-r--r--tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp235
-rw-r--r--tests/auto/qlabel/qlabel.pro2
-rw-r--r--tests/auto/qlayout/qlayout.pro2
-rw-r--r--tests/auto/qlibrary/tst/tst.pro6
-rw-r--r--tests/auto/qlibrary/tst_qlibrary.cpp74
-rw-r--r--tests/auto/qlist/tst_qlist.cpp16
-rw-r--r--tests/auto/qlocale/test/test.pro2
-rw-r--r--tests/auto/qlocalsocket/test/test.pro6
-rw-r--r--tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp6
-rw-r--r--tests/auto/qmetaobject/tst_qmetaobject.cpp136
-rw-r--r--tests/auto/qmetatype/tst_qmetatype.cpp5
-rw-r--r--tests/auto/qmovie/qmovie.pro6
-rw-r--r--tests/auto/qnetworkreply/test/test.pro6
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp275
-rw-r--r--tests/auto/qobject/tst_qobject.cpp245
-rw-r--r--tests/auto/qobject/tst_qobject.pro4
-rw-r--r--tests/auto/qpainter/qpainter.pro2
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp115
-rw-r--r--tests/auto/qpixmap/qpixmap.pro8
-rw-r--r--tests/auto/qpixmapfilter/qpixmapfilter.pro2
-rw-r--r--tests/auto/qplugin/tst_qplugin.pro4
-rw-r--r--tests/auto/qpluginloader/elftest/.gitattributes10
-rwxr-xr-xtests/auto/qpluginloader/elftest/corrupt1.elf64.sobin0 -> 239745 bytes
-rwxr-xr-xtests/auto/qpluginloader/elftest/corrupt2.elf64.sobin0 -> 240097 bytes
-rwxr-xr-xtests/auto/qpluginloader/elftest/corrupt3.elf64.sobin0 -> 240097 bytes
-rw-r--r--tests/auto/qpluginloader/elftest/debugobj.sobin0 -> 507232 bytes
-rw-r--r--tests/auto/qpluginloader/elftest/garbage1.so4
-rw-r--r--tests/auto/qpluginloader/elftest/garbage2.so1
-rw-r--r--tests/auto/qpluginloader/elftest/garbage3.so1
-rw-r--r--tests/auto/qpluginloader/elftest/garbage4.so1
-rw-r--r--tests/auto/qpluginloader/elftest/garbage5.so2
-rw-r--r--tests/auto/qpluginloader/tst/tst.pro8
-rw-r--r--tests/auto/qpluginloader/tst_qpluginloader.cpp62
-rw-r--r--tests/auto/qprocess/test/test.pro40
-rw-r--r--tests/auto/qradiobutton/tst_qradiobutton.cpp6
-rw-r--r--tests/auto/qresourceengine/qresourceengine.pro18
-rw-r--r--tests/auto/qscriptengine/qscriptengine.pro2
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp34
-rw-r--r--tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp22
-rw-r--r--tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro2
-rw-r--r--tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro2
-rw-r--r--tests/auto/qscriptvalue/testgen/testgenerator.cpp107
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp43
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp8
-rw-r--r--tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp2
-rw-r--r--tests/auto/qsound/qsound.pro2
-rw-r--r--tests/auto/qsplitter/qsplitter.pro2
-rw-r--r--tests/auto/qsql/qsql.pro2
-rw-r--r--tests/auto/qsqldatabase/qsqldatabase.pro4
-rw-r--r--tests/auto/qsqldriver/qsqldriver.pro4
-rw-r--r--tests/auto/qsqlerror/qsqlerror.pro2
-rw-r--r--tests/auto/qsqlfield/qsqlfield.pro2
-rw-r--r--tests/auto/qsqlquery/qsqlquery.pro4
-rw-r--r--tests/auto/qsqlquerymodel/qsqlquerymodel.pro2
-rw-r--r--tests/auto/qsqlrecord/qsqlrecord.pro2
-rw-r--r--tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro4
-rw-r--r--tests/auto/qsqltablemodel/qsqltablemodel.pro4
-rw-r--r--tests/auto/qsqlthread/qsqlthread.pro4
-rw-r--r--tests/auto/qsslcertificate/qsslcertificate.pro2
-rw-r--r--tests/auto/qsslkey/qsslkey.pro4
-rw-r--r--tests/auto/qsslsocket/qsslsocket.pro4
-rw-r--r--tests/auto/qstatictext/tst_qstatictext.cpp23
-rw-r--r--tests/auto/qstring/tst_qstring.cpp140
-rw-r--r--tests/auto/qstringref/qstringref.pro4
-rw-r--r--tests/auto/qstringref/tst_qstringref.cpp881
-rw-r--r--tests/auto/qstyle/qstyle.pro2
-rw-r--r--tests/auto/qsvggenerator/qsvggenerator.pro2
-rw-r--r--tests/auto/qsvgrenderer/qsvgrenderer.pro2
-rw-r--r--tests/auto/qtabbar/tst_qtabbar.cpp41
-rw-r--r--tests/auto/qtabwidget/tst_qtabwidget.cpp72
-rw-r--r--tests/auto/qtcpserver/test/test.pro4
-rw-r--r--tests/auto/qtemporaryfile/qtemporaryfile.pro2
-rw-r--r--tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro2
-rw-r--r--tests/auto/qtextbrowser/qtextbrowser.pro4
-rw-r--r--tests/auto/qtextcodec/test/test.pro2
-rw-r--r--tests/auto/qtextedit/qtextedit.pro2
-rw-r--r--tests/auto/qtextlayout/tst_qtextlayout.cpp24
-rw-r--r--tests/auto/qtextlist/tst_qtextlist.cpp73
-rw-r--r--tests/auto/qtextstream/test/test.pro6
-rw-r--r--tests/auto/qthreadpool/tst_qthreadpool.cpp27
-rw-r--r--tests/auto/qtipc/qsharedmemory/test/test.pro6
-rw-r--r--tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp26
-rw-r--r--tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro4
-rw-r--r--tests/auto/qtranslator/qtranslator.pro2
-rw-r--r--tests/auto/qudpsocket/test/test.pro2
-rw-r--r--tests/auto/qudpsocket/tst_qudpsocket.cpp251
-rw-r--r--tests/auto/qurl/tst_qurl.cpp73
-rw-r--r--tests/auto/quuid/test/test.pro4
-rw-r--r--tests/auto/qvector/tst_qvector.cpp15
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp28
-rw-r--r--tests/auto/qxml/qxml.pro2
-rw-r--r--tests/auto/qxmlformatter/qxmlformatter.pro2
-rw-r--r--tests/auto/qxmlquery/qxmlquery.pro4
-rw-r--r--tests/auto/qxmlsimplereader/qxmlsimplereader.pro2
-rw-r--r--tests/auto/qxmlstream/qxmlstream.pro2
-rw-r--r--tests/auto/qzip/qzip.pro2
-rw-r--r--tests/auto/selftests/expected_cmptest.txt2
-rw-r--r--tests/auto/selftests/expected_crashes_3.txt2
-rw-r--r--tests/auto/selftests/expected_longstring.txt2
-rw-r--r--tests/auto/selftests/expected_maxwarnings.txt2
-rw-r--r--tests/auto/selftests/expected_skip.txt2
-rw-r--r--tests/auto/uic/baseline/icontheme.ui55
-rw-r--r--tests/auto/uic/baseline/icontheme.ui.h95
-rw-r--r--tests/auto/uiloader/uiloader/uiloader.pro4
-rw-r--r--tests/auto/utf8/tst_utf8.cpp4
-rw-r--r--tests/auto/windowsmobile/test/test.pro2
-rw-r--r--tests/auto/xmlpatterns.pri4
-rw-r--r--tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro2
-rw-r--r--tests/auto/xmlpatternsview/xmlpatternsview.pro2
-rw-r--r--tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro2
-rw-r--r--tests/benchmarks/corelib/codecs/qtextcodec/qtextcodec.pro2
-rwxr-xr-xtests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro2
-rw-r--r--tests/benchmarks/corelib/io/qfileinfo/main.cpp44
-rw-r--r--tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp52
-rw-r--r--tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp47
-rw-r--r--tests/benchmarks/corelib/thread/qmutex/qmutex.pro6
-rw-r--r--tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp131
-rw-r--r--tests/benchmarks/corelib/tools/qstring/qstring.pro2
-rw-r--r--tests/benchmarks/declarative/binding/binding.pro2
-rw-r--r--tests/benchmarks/declarative/compilation/compilation.pro2
-rw-r--r--tests/benchmarks/declarative/creation/creation.pro2
-rw-r--r--tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro2
-rw-r--r--tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro2
-rw-r--r--tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro2
-rw-r--r--tests/benchmarks/declarative/qmltime/qmltime.pro2
-rw-r--r--tests/benchmarks/declarative/script/script.pro2
-rw-r--r--tests/benchmarks/declarative/typeimports/typeimports.pro2
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro2
-rw-r--r--tests/benchmarks/gui/image/qimagereader/qimagereader.pro6
-rw-r--r--tests/benchmarks/gui/kernel/qguimetatype/qguimetatype.pro6
-rw-r--r--tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp113
-rw-r--r--tests/benchmarks/gui/kernel/qguivariant/qguivariant.pro6
-rw-r--r--tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp111
-rw-r--r--tests/benchmarks/gui/text/qtext/qtext.pro2
-rw-r--r--tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp90
-rw-r--r--tests/benchmarks/script/qscriptqobject/qscriptqobject.pro7
-rw-r--r--tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp1237
-rw-r--r--tests/manual/textrendering/glyphshaping/glyphshaping.pro2
-rw-r--r--tests/shared/filesystem.h62
285 files changed, 8146 insertions, 558 deletions
diff --git a/tests/arthur/lance/lance.pro b/tests/arthur/lance/lance.pro
index 3692f21..56b7f25 100644
--- a/tests/arthur/lance/lance.pro
+++ b/tests/arthur/lance/lance.pro
@@ -13,7 +13,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, o
contains(QT_CONFIG, qt3support):QT += qt3support
symbian*: {
- testData.sources = $$QT_BUILD_TREE/tests/arthur/data/qps
+ testData.files = $$QT_BUILD_TREE/tests/arthur/data/qps
testData.path = .
DEPLOYMENT += testData
}
diff --git a/tests/auto/checkxmlfiles/checkxmlfiles.pro b/tests/auto/checkxmlfiles/checkxmlfiles.pro
index 319ba9b..ab932f5 100644
--- a/tests/auto/checkxmlfiles/checkxmlfiles.pro
+++ b/tests/auto/checkxmlfiles/checkxmlfiles.pro
@@ -8,7 +8,7 @@ include (../xmlpatterns.pri)
wince*|symbian: {
QT += network
-addFiles.sources = \
+addFiles.files = \
$$QT_SOURCE_TREE/examples/sql/masterdetail/albumdetails.xml \
$$QT_SOURCE_TREE/examples/xmlpatterns/xquery/globalVariables/globals.gccxml \
$$QT_SOURCE_TREE/doc/src/diagrams/stylesheet/treeview.svg \
diff --git a/tests/auto/collections/tst_collections.cpp b/tests/auto/collections/tst_collections.cpp
index f81535e..0adceee 100644
--- a/tests/auto/collections/tst_collections.cpp
+++ b/tests/auto/collections/tst_collections.cpp
@@ -3448,27 +3448,16 @@ void tst_Collections::containerTypedefs()
testSetContainerTypedefs(QSet<int>());
}
-#if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET)
-class Key1
-{};
-class T1
-{};
-class T2
-{};
-#else
class Key1;
class T1;
class T2;
-#endif
void tst_Collections::forwardDeclared()
{
{ typedef QHash<Key1, T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
{ typedef QMultiHash<Key1, T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
-#if !defined(Q_CC_MSVC_NET) || _MSC_VER >= 1310
{ typedef QMap<Key1, T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
{ typedef QMultiMap<Key1, T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
-#endif
#if !defined(Q_CC_RVCT)
// RVCT can't handle forward declared template parameters if those are used to declare
// class members inside templated class.
diff --git a/tests/auto/corelib.pro b/tests/auto/corelib.pro
index 531fed2..d1d0940 100644
--- a/tests/auto/corelib.pro
+++ b/tests/auto/corelib.pro
@@ -75,6 +75,7 @@ SUBDIRS=\
qstringbuilder4 \
qstringlist \
qstringmatcher \
+ qstringref \
qtconcurrentfilter \
qtconcurrentiteratekernel \
qtconcurrentmap \
diff --git a/tests/auto/declarative/examples/examples.pro b/tests/auto/declarative/examples/examples.pro
index 2e243b4..8ed33da 100644
--- a/tests/auto/declarative/examples/examples.pro
+++ b/tests/auto/declarative/examples/examples.pro
@@ -7,7 +7,7 @@ SOURCES += tst_examples.cpp
include(../../../../tools/qml/qml.pri)
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/moduleqt47/moduleqt47.pro b/tests/auto/declarative/moduleqt47/moduleqt47.pro
index 4ee634e..808f263 100644
--- a/tests/auto/declarative/moduleqt47/moduleqt47.pro
+++ b/tests/auto/declarative/moduleqt47/moduleqt47.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_moduleqt47.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/parserstress/parserstress.pro b/tests/auto/declarative/parserstress/parserstress.pro
index bb1d69f..1e323f7 100644
--- a/tests/auto/declarative/parserstress/parserstress.pro
+++ b/tests/auto/declarative/parserstress/parserstress.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_parserstress.cpp
symbian: {
- importFiles.sources = ..\\..\\qscriptjstestsuite\\tests
+ importFiles.files = ..\\..\\qscriptjstestsuite\\tests
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro b/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro
index 9798bb6..141e25d 100644
--- a/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro
+++ b/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qdeclarativeanchors.cpp
macx:CONFIG -= app_bundle
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro b/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro
index 0a2f0f2..ad9509a 100644
--- a/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro
+++ b/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro
@@ -5,7 +5,7 @@ SOURCES += tst_qdeclarativeanimatedimage.cpp ../shared/testhttpserver.cpp
macx:CONFIG -= app_bundle
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro
index ed47dca..84cd498 100644
--- a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro
+++ b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qdeclarativeanimations.cpp
macx:CONFIG -= app_bundle
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro
index cfb59ef..e4125fd 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro
+++ b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qdeclarativebehaviors.cpp
macx:CONFIG -= app_bundle
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro
index a7ba2a8..25bdbec 100644
--- a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro
+++ b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativebinding.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro b/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro
index a21761b..05d4cac 100644
--- a/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro
+++ b/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro
@@ -6,7 +6,7 @@ HEADERS += ../shared/testhttpserver.h
SOURCES += tst_qdeclarativeborderimage.cpp ../shared/testhttpserver.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro
index d06ce4f..c614571 100644
--- a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro
+++ b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativeconnection.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro b/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro
index 415d4e2..e8f24a5 100644
--- a/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro
+++ b/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativedom.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro
index 58cad34..e7f8636 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro
+++ b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro
@@ -13,7 +13,7 @@ INCLUDEPATH += ../shared
# LIBS += -lgcov
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro b/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro
index be0ba6c..1fb99d0 100644
--- a/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro
+++ b/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativeflickable.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro b/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro
index 759e80b..eddd053 100644
--- a/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro
+++ b/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativeflipable.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro b/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro
index 24749c6..fd7f6b8 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro
+++ b/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qdeclarativefocusscope.cpp
macx:CONFIG -= app_bundle
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro b/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro
index 91bf4a7..50c7ca0 100644
--- a/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro
+++ b/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativefolderlistmodel.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro
index 01dca26..f245a0d 100644
--- a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro
+++ b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro
@@ -6,7 +6,7 @@ HEADERS += ../shared/testhttpserver.h
SOURCES += tst_qdeclarativefontloader.cpp ../shared/testhttpserver.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro b/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro
index a99a1b9..b775b3d 100644
--- a/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro
+++ b/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativegridview.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro b/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro
index 244a1e1..c87c1d9 100644
--- a/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro
+++ b/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro
@@ -6,7 +6,7 @@ HEADERS += ../shared/testhttpserver.h
SOURCES += tst_qdeclarativeimage.cpp ../shared/testhttpserver.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro
index 2c20e7e..888596f 100644
--- a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro
+++ b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativeinfo.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro b/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro
index f4901c4..0fd871e 100644
--- a/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro
+++ b/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativeitem.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro
index 43c451f..aa69337 100644
--- a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro
+++ b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro
@@ -12,7 +12,7 @@ HEADERS += ../shared/testhttpserver.h
SOURCES += ../shared/testhttpserver.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro b/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro
index 5076e51..42d9a80 100644
--- a/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro
+++ b/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativelayoutitem.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro
index e90db49..8a39555 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro
+++ b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro
@@ -6,7 +6,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativelistmodel.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro b/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro
index 2c5a859..99eba67 100644
--- a/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro
+++ b/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativelistview.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro b/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro
index b07bf9e..1e7808a 100644
--- a/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro
+++ b/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro
@@ -8,7 +8,7 @@ SOURCES += tst_qdeclarativeloader.cpp \
../shared/testhttpserver.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro
index fb3630f..ec2d25e 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro
@@ -4,7 +4,7 @@ QT += declarative
CONFIG -= app_bundle
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro b/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro
index 3d39aa8..a93f7af 100644
--- a/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro
+++ b/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro
@@ -6,7 +6,7 @@ HEADERS += ../shared/testhttpserver.h
SOURCES += tst_qdeclarativemousearea.cpp ../shared/testhttpserver.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro b/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro
index f9ca90f..8f13573 100644
--- a/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro
+++ b/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativeparticles.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro b/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro
index 04fd26b..4f70a6f 100644
--- a/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro
+++ b/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativepathview.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro
index 3130364..47b1b7b 100644
--- a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro
+++ b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro
@@ -10,7 +10,7 @@ HEADERS += ../shared/testhttpserver.h
SOURCES += ../shared/testhttpserver.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro b/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro
index 5dc7bb8..e98aa5c 100644
--- a/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro
+++ b/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qdeclarativepositioners.cpp
macx:CONFIG -= app_bundle
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro
index 4121a33..9dd727c 100644
--- a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro
+++ b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativeproperty.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro
index 6af6500..a12c439 100644
--- a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro
+++ b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qdeclarativeqt.cpp
macx:CONFIG -= app_bundle
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro b/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro
index f3ff9ed..385b8da 100644
--- a/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro
+++ b/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativerepeater.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativescriptdebugging/qdeclarativescriptdebugging.pro b/tests/auto/declarative/qdeclarativescriptdebugging/qdeclarativescriptdebugging.pro
index c2d30a0..dedb263 100644
--- a/tests/auto/declarative/qdeclarativescriptdebugging/qdeclarativescriptdebugging.pro
+++ b/tests/auto/declarative/qdeclarativescriptdebugging/qdeclarativescriptdebugging.pro
@@ -9,7 +9,7 @@ INCLUDEPATH += ../shared
# LIBS += -lgcov
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro
index 872aeb9..69f331b 100644
--- a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro
+++ b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativesmoothedanimation.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro b/tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro
index 213b262..a59522b 100644
--- a/tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro
+++ b/tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativespringanimation.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro b/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro
index 1462c9a..d938692 100644
--- a/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro
+++ b/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro
@@ -6,7 +6,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativesqldatabase.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro
index 2bae041..2f32178 100644
--- a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro
+++ b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativestates.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png b/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png
index 99de219..b5c6bba 100644
--- a/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png
+++ b/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png b/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png
index cb85251..c9ffcc1 100644
--- a/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png
+++ b/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png b/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png
index ddca549..eda0d25 100644
--- a/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png
+++ b/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro b/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro
index c1a36fd..362886e 100644
--- a/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro
+++ b/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro
@@ -10,7 +10,7 @@ HEADERS += ../shared/testhttpserver.h
SOURCES += ../shared/testhttpserver.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro b/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro
index 4b6bd49..cf706ba 100644
--- a/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro
+++ b/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro
@@ -6,7 +6,7 @@ SOURCES += tst_qdeclarativetextedit.cpp ../shared/testhttpserver.cpp
HEADERS += ../shared/testhttpserver.h
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro b/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro
index 8f42448..5c45f57 100644
--- a/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro
+++ b/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativetextinput.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro
index 90e46d3..a208254 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro
+++ b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro
@@ -8,7 +8,7 @@ SOURCES += tst_qdeclarativevaluetypes.cpp \
testtypes.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro b/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro
index 21a9195..4436d54 100644
--- a/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro
+++ b/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativeview.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro b/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro
index 6189916..5ba416e 100644
--- a/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro
+++ b/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro
@@ -7,7 +7,7 @@ include(../../../../tools/qml/qml.pri)
SOURCES += tst_qdeclarativeviewer.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro b/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro
index 92e5f60..16154f3 100644
--- a/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro
+++ b/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativevisualdatamodel.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro
index 562a9fb..cc7fa43 100644
--- a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro
+++ b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro
@@ -6,7 +6,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativewebview.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro
index 2f8f23d..eca8a68 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro
+++ b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro
@@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativeworkerscript.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro
index 619b239..fbcc597 100644
--- a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro
+++ b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro
@@ -9,7 +9,7 @@ SOURCES += tst_qdeclarativexmlhttprequest.cpp \
../shared/testhttpserver.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro
index 472cffb..23173f3 100644
--- a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro
+++ b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro
@@ -9,7 +9,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativexmllistmodel.cpp
symbian: {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path = .
DEPLOYMENT = importFiles
} else {
diff --git a/tests/auto/declarative/qmlvisual/qmlvisual.pro b/tests/auto/declarative/qmlvisual/qmlvisual.pro
index cb7e5d7..a424b8f 100644
--- a/tests/auto/declarative/qmlvisual/qmlvisual.pro
+++ b/tests/auto/declarative/qmlvisual/qmlvisual.pro
@@ -6,7 +6,7 @@ SOURCES += tst_qmlvisual.cpp
symbian: {
importFiles.path = .
- importFiles.sources = animation \
+ importFiles.files = animation \
fillmode \
focusscope \
ListView \
diff --git a/tests/auto/gui.pro b/tests/auto/gui.pro
index 2d9ea93..c94272c 100644
--- a/tests/auto/gui.pro
+++ b/tests/auto/gui.pro
@@ -57,6 +57,7 @@ SUBDIRS=\
qfontdialog \
qfontmetrics \
qformlayout \
+ qglyphs \
qgraphicsanchorlayout \
qgraphicsanchorlayout1 \
qgraphicseffect \
diff --git a/tests/auto/macnativeevents/expectedeventlist.cpp b/tests/auto/macnativeevents/expectedeventlist.cpp
index 0679dcb..82a594b 100644
--- a/tests/auto/macnativeevents/expectedeventlist.cpp
+++ b/tests/auto/macnativeevents/expectedeventlist.cpp
@@ -49,7 +49,9 @@ ExpectedEventList::ExpectedEventList(QObject *target)
: QObject(target), eventCount(0)
{
target->installEventFilter(this);
- debug = !qgetenv("NATIVEDEBUG").isEmpty();
+ debug = qgetenv("NATIVEDEBUG").toInt();
+ if (debug > 0)
+ qDebug() << "Debug level sat to:" << debug;
}
ExpectedEventList::~ExpectedEventList()
@@ -104,14 +106,17 @@ void ExpectedEventList::compareMouseEvents(QEvent *received, QEvent *expected)
&& (e1->globalPos() == e2->globalPos())
&& (e1->button() == e2->button())
&& (e1->buttons() == e2->buttons())
- && (e1->modifiers() == e2->modifiers()))
+ && (e1->modifiers() == e2->modifiers())) {
+ if (debug > 0)
+ qDebug() << " Received (OK):" << e1 << e1->globalPos();
return; // equal
+ }
// INVARIANT: The two events are not equal. So we fail. Depending
// on whether debug mode is no or not, we let QTest fail. Otherwise
// we let the test continue for debugging puposes.
int eventListNr = eventCount - eventList.size();
- if (!debug) {
+ if (debug == 0) {
qWarning() << "Expected event" << eventListNr << "differs from received event:";
QCOMPARE(e1->pos(), e2->pos());
QCOMPARE(e1->globalPos(), e2->globalPos());
@@ -135,14 +140,17 @@ void ExpectedEventList::compareKeyEvents(QEvent *received, QEvent *expected)
if (e1->key() == e2->key()
&& (e1->modifiers() == e2->modifiers())
&& (e1->count() == e2->count())
- && (e1->isAutoRepeat() == e2->isAutoRepeat()))
+ && (e1->isAutoRepeat() == e2->isAutoRepeat())) {
+ if (debug > 0)
+ qDebug() << " Received (OK):" << e1 << QKeySequence(e1->key()).toString(QKeySequence::NativeText);
return; // equal
+ }
// INVARIANT: The two events are not equal. So we fail. Depending
// on whether debug mode is no or not, we let QTest fail. Otherwise
// we let the test continue for debugging puposes.
int eventListNr = eventCount - eventList.size();
- if (!debug) {
+ if (debug == 0) {
qWarning() << "Expected event" << eventListNr << "differs from received event:";
QCOMPARE(e1->key(), e2->key());
QCOMPARE(e1->modifiers(), e2->modifiers());
@@ -150,18 +158,19 @@ void ExpectedEventList::compareKeyEvents(QEvent *received, QEvent *expected)
QCOMPARE(e1->isAutoRepeat(), e2->isAutoRepeat());
} else {
qWarning() << "*** FAIL *** : Expected event" << eventListNr << "differs from received event:";
- qWarning() << "Received:" << e1 << e1->key();
- qWarning() << "Expected:" << e2 << e2->key();
+ qWarning() << "Received:" << e1 << QKeySequence(e1->key()).toString(QKeySequence::NativeText);
+ qWarning() << "Expected:" << e2 << QKeySequence(e2->key()).toString(QKeySequence::NativeText);
}
}
bool ExpectedEventList::eventFilter(QObject *, QEvent *received)
{
- if (debug)
+ if (debug > 1)
qDebug() << received;
if (eventList.isEmpty())
return false;
+ bool eat = false;
QEvent *expected = eventList.first();
if (expected->type() == received->type()) {
eventList.removeFirst();
@@ -175,11 +184,13 @@ bool ExpectedEventList::eventFilter(QObject *, QEvent *received)
case QEvent::NonClientAreaMouseButtonDblClick:
case QEvent::NonClientAreaMouseMove: {
compareMouseEvents(received, expected);
+ eat = true;
break;
}
case QEvent::KeyPress:
case QEvent::KeyRelease: {
compareKeyEvents(received, expected);
+ eat = true;
break;
}
case QEvent::Resize: {
@@ -198,6 +209,6 @@ bool ExpectedEventList::eventFilter(QObject *, QEvent *received)
QAbstractEventDispatcher::instance()->interrupt();
}
- return false;
+ return eat;
}
diff --git a/tests/auto/macnativeevents/expectedeventlist.h b/tests/auto/macnativeevents/expectedeventlist.h
index bd9f358..21eb193 100644
--- a/tests/auto/macnativeevents/expectedeventlist.h
+++ b/tests/auto/macnativeevents/expectedeventlist.h
@@ -51,7 +51,7 @@ class ExpectedEventList : public QObject
{
QList<QEvent *> eventList;
QBasicTimer timer;
- bool debug;
+ int debug;
int eventCount;
void timerEvent(QTimerEvent *);
diff --git a/tests/auto/macnativeevents/nativeeventlist.cpp b/tests/auto/macnativeevents/nativeeventlist.cpp
index 1a90ee0..f730377 100644
--- a/tests/auto/macnativeevents/nativeeventlist.cpp
+++ b/tests/auto/macnativeevents/nativeeventlist.cpp
@@ -47,7 +47,8 @@ NativeEventList::NativeEventList(int defaultWaitMs)
, wait(false)
, defaultWaitMs(defaultWaitMs)
{
- QString multiplier = qgetenv("NATIVEDEBUG");
+ debug = qgetenv("NATIVEDEBUG").toInt();
+ QString multiplier = qgetenv("NATIVEDEBUGSPEED");
if (!multiplier.isEmpty())
setTimeMultiplier(multiplier.toFloat());
}
@@ -61,8 +62,11 @@ NativeEventList::~NativeEventList()
void NativeEventList::sendNextEvent()
{
QNativeEvent *e = eventList.at(currIndex).second;
- if (e)
+ if (e) {
+ if (debug > 0)
+ qDebug() << "Sending:" << *e;
QNativeInput::sendNativeEvent(*e);
+ }
waitNextEvent();
}
diff --git a/tests/auto/macnativeevents/nativeeventlist.h b/tests/auto/macnativeevents/nativeeventlist.h
index efcca43..9f9498d 100644
--- a/tests/auto/macnativeevents/nativeeventlist.h
+++ b/tests/auto/macnativeevents/nativeeventlist.h
@@ -76,6 +76,7 @@ private:
int currIndex;
bool wait;
int defaultWaitMs;
+ int debug;
};
#endif
diff --git a/tests/auto/macnativeevents/qnativeevents_mac.cpp b/tests/auto/macnativeevents/qnativeevents_mac.cpp
index 6c04bf3..cc12cc9 100644
--- a/tests/auto/macnativeevents/qnativeevents_mac.cpp
+++ b/tests/auto/macnativeevents/qnativeevents_mac.cpp
@@ -54,11 +54,11 @@ static Qt::KeyboardModifiers getModifiersFromQuartzEvent(CGEventRef inEvent)
if (flags & kCGEventFlagMaskShift || flags & kCGEventFlagMaskAlphaShift)
m |= Qt::ShiftModifier;
if (flags & kCGEventFlagMaskControl)
- m |= Qt::MetaModifier;
+ m |= Qt::ControlModifier;
if (flags & kCGEventFlagMaskAlternate)
m |= Qt::AltModifier;
if (flags & kCGEventFlagMaskCommand)
- m |= Qt::ControlModifier;
+ m |= Qt::MetaModifier;
return m;
}
@@ -67,11 +67,11 @@ static void setModifiersFromQNativeEvent(CGEventRef inEvent, const QNativeEvent
CGEventFlags flags = 0;
if (event.modifiers.testFlag(Qt::ShiftModifier))
flags |= kCGEventFlagMaskShift;
- if (event.modifiers.testFlag(Qt::MetaModifier))
+ if (event.modifiers.testFlag(Qt::ControlModifier))
flags |= kCGEventFlagMaskControl;
if (event.modifiers.testFlag(Qt::AltModifier))
flags |= kCGEventFlagMaskAlternate;
- if (event.modifiers.testFlag(Qt::ControlModifier))
+ if (event.modifiers.testFlag(Qt::MetaModifier))
flags |= kCGEventFlagMaskCommand;
CGEventSetFlags(inEvent, flags);
}
diff --git a/tests/auto/macnativeevents/tst_macnativeevents.cpp b/tests/auto/macnativeevents/tst_macnativeevents.cpp
index d582417..742267f 100644
--- a/tests/auto/macnativeevents/tst_macnativeevents.cpp
+++ b/tests/auto/macnativeevents/tst_macnativeevents.cpp
@@ -48,6 +48,7 @@
#include "qnativeevents.h"
#include "nativeeventlist.h"
#include "expectedeventlist.h"
+#include <Carbon/Carbon.h>
#ifdef Q_OS_MAC
@@ -73,6 +74,10 @@ private slots:
void testChildWindowInFrontOfStaysOnTopParentWindow();
#endif
void testKeyPressOnToplevel();
+ void testModifierShift();
+ void testModifierAlt();
+ void testModifierCtrl();
+ void testModifierCtrlWithDontSwapCtrlAndMeta();
};
void tst_MacNativeEvents::testMouseMoveLocation()
@@ -411,6 +416,108 @@ void tst_MacNativeEvents::testKeyPressOnToplevel()
QVERIFY2(expected.waitForAllEvents(), "the test did not receive all expected events!");
}
+void tst_MacNativeEvents::testModifierShift()
+{
+ QWidget w;
+ w.show();
+
+ NativeEventList native;
+ native.append(new QNativeModifierEvent(Qt::ShiftModifier));
+ native.append(new QNativeKeyEvent(QNativeKeyEvent::Key_A, true, Qt::ShiftModifier));
+ native.append(new QNativeKeyEvent(QNativeKeyEvent::Key_A, false, Qt::ShiftModifier));
+ native.append(new QNativeModifierEvent(Qt::NoModifier));
+
+ ExpectedEventList expected(&w);
+ expected.append(new QKeyEvent(QEvent::KeyPress, Qt::Key_Shift, Qt::NoModifier));
+ expected.append(new QKeyEvent(QEvent::KeyPress, Qt::Key_A, Qt::ShiftModifier));
+ expected.append(new QKeyEvent(QEvent::KeyRelease, Qt::Key_A, Qt::ShiftModifier));
+ expected.append(new QKeyEvent(QEvent::KeyRelease, Qt::Key_Shift, Qt::ShiftModifier));
+
+ native.play();
+ QVERIFY2(expected.waitForAllEvents(), "the test did not receive all expected events!");
+}
+
+void tst_MacNativeEvents::testModifierAlt()
+{
+ QWidget w;
+ w.show();
+
+ NativeEventList native;
+ native.append(new QNativeModifierEvent(Qt::AltModifier));
+ native.append(new QNativeKeyEvent(QNativeKeyEvent::Key_A, true, Qt::AltModifier));
+ native.append(new QNativeKeyEvent(QNativeKeyEvent::Key_A, false, Qt::AltModifier));
+ native.append(new QNativeModifierEvent(Qt::NoModifier));
+
+ ExpectedEventList expected(&w);
+ expected.append(new QKeyEvent(QEvent::KeyPress, Qt::Key_Alt, Qt::NoModifier));
+ expected.append(new QKeyEvent(QEvent::KeyPress, Qt::Key_A, Qt::AltModifier));
+ expected.append(new QKeyEvent(QEvent::KeyRelease, Qt::Key_A, Qt::AltModifier));
+ expected.append(new QKeyEvent(QEvent::KeyRelease, Qt::Key_Alt, Qt::AltModifier));
+
+ native.play();
+ QVERIFY2(expected.waitForAllEvents(), "the test did not receive all expected events!");
+}
+
+void tst_MacNativeEvents::testModifierCtrl()
+{
+ // On Mac, we switch the Command and Control modifier by default, so that Command
+ // means Meta, and Control means Command. Lets check that this works:
+ QWidget w;
+ w.show();
+
+ QVERIFY(kControlUnicode == QKeySequence(Qt::Key_Meta).toString(QKeySequence::NativeText)[0]);
+ QVERIFY(kCommandUnicode == QKeySequence(Qt::Key_Control).toString(QKeySequence::NativeText)[0]);
+
+ NativeEventList native;
+ native.append(new QNativeModifierEvent(Qt::ControlModifier));
+ native.append(new QNativeKeyEvent(QNativeKeyEvent::Key_A, true, Qt::ControlModifier));
+ native.append(new QNativeKeyEvent(QNativeKeyEvent::Key_A, false, Qt::ControlModifier));
+ native.append(new QNativeModifierEvent(Qt::NoModifier));
+
+ ExpectedEventList expected(&w);
+ expected.append(new QKeyEvent(QEvent::KeyPress, Qt::Key_Meta, Qt::NoModifier));
+ expected.append(new QKeyEvent(QEvent::KeyPress, Qt::Key_A, Qt::MetaModifier));
+ expected.append(new QKeyEvent(QEvent::KeyRelease, Qt::Key_A, Qt::MetaModifier));
+ expected.append(new QKeyEvent(QEvent::KeyRelease, Qt::Key_Meta, Qt::MetaModifier));
+
+ native.play();
+ QVERIFY2(expected.waitForAllEvents(), "the test did not receive all expected events!");
+}
+
+void tst_MacNativeEvents::testModifierCtrlWithDontSwapCtrlAndMeta()
+{
+ // On Mac, we switch the Command and Control modifier by default, so that Command
+ // means Meta, and Control means Command. Lets check that the flag to swith off
+ // this behaviour works. While working on this test I realised that we actually
+ // don't (and never have) respected this flag for raw key events. Only for
+ // menus, through QKeySequence. I don't want to change this behaviour now, at
+ // least not until someone complains. So I choose to let the test just stop
+ // any unintended regressions instead. If we decide to resepect the the flag at one
+ // point, fix the test.
+ QCoreApplication::setAttribute(Qt::AA_MacDontSwapCtrlAndMeta);
+ QWidget w;
+ w.show();
+
+ QVERIFY(kCommandUnicode == QKeySequence(Qt::Key_Meta).toString(QKeySequence::NativeText)[0]);
+ QVERIFY(kControlUnicode == QKeySequence(Qt::Key_Control).toString(QKeySequence::NativeText)[0]);
+
+ NativeEventList native;
+ native.append(new QNativeModifierEvent(Qt::ControlModifier));
+ native.append(new QNativeKeyEvent(QNativeKeyEvent::Key_A, true, Qt::ControlModifier));
+ native.append(new QNativeKeyEvent(QNativeKeyEvent::Key_A, false, Qt::ControlModifier));
+ native.append(new QNativeModifierEvent(Qt::NoModifier));
+
+ ExpectedEventList expected(&w);
+ expected.append(new QKeyEvent(QEvent::KeyPress, Qt::Key_Meta, Qt::NoModifier));
+ expected.append(new QKeyEvent(QEvent::KeyPress, Qt::Key_A, Qt::ControlModifier));
+ expected.append(new QKeyEvent(QEvent::KeyRelease, Qt::Key_A, Qt::ControlModifier));
+ expected.append(new QKeyEvent(QEvent::KeyRelease, Qt::Key_Meta, Qt::ControlModifier));
+
+ native.play();
+ QVERIFY2(expected.waitForAllEvents(), "the test did not receive all expected events!");
+ QCoreApplication::setAttribute(Qt::AA_MacDontSwapCtrlAndMeta, false);
+}
+
#include "tst_macnativeevents.moc"
QTEST_MAIN(tst_MacNativeEvents)
diff --git a/tests/auto/mediaobject/mediaobject.pro b/tests/auto/mediaobject/mediaobject.pro
index e887df4..ea78e63 100755
--- a/tests/auto/mediaobject/mediaobject.pro
+++ b/tests/auto/mediaobject/mediaobject.pro
@@ -15,7 +15,7 @@ wince*{
}
symbian:{
- addFiles.sources = media/test.sdp
+ addFiles.files = media/test.sdp
addFiles.path = media
DEPLOYMENT += addFiles
}
diff --git a/tests/auto/networkselftest/networkselftest.pro b/tests/auto/networkselftest/networkselftest.pro
index d7cb7f3..b7c70a1 100644
--- a/tests/auto/networkselftest/networkselftest.pro
+++ b/tests/auto/networkselftest/networkselftest.pro
@@ -4,12 +4,12 @@ SOURCES += tst_networkselftest.cpp
QT = core network
wince*: {
- addFiles.sources = rfc3252.txt
+ addFiles.files = rfc3252.txt
addFiles.path = .
DEPLOYMENT = addFiles
DEFINES += SRCDIR=\\\"\\\"
} else:symbian {
- addFiles.sources = rfc3252.txt
+ addFiles.files = rfc3252.txt
addFiles.path = .
DEPLOYMENT = addFiles
} else:vxworks*: {
diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp
index 752e368..ecbc08c 100644
--- a/tests/auto/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/networkselftest/tst_networkselftest.cpp
@@ -42,6 +42,8 @@
#include <QtTest/QtTest>
#include <QtNetwork/QtNetwork>
+#include <time.h>
+
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
// Current path (C:\private\<UID>) contains only ascii chars
@@ -72,14 +74,20 @@ private slots:
// specific protocol tests
void ftpServer();
+ void ftpProxyServer();
void imapServer();
void httpServer();
+ void httpServerFiles_data();
+ void httpServerFiles();
+ void httpServerCGI_data();
+ void httpServerCGI();
void httpsServer();
void httpProxy();
void httpProxyBasicAuth();
void httpProxyNtlmAuth();
void socks5Proxy();
void socks5ProxyAuth();
+ void smbServer();
// ssl supported test
void supportsSsl();
@@ -158,7 +166,7 @@ static QString prettyByteArray(const QByteArray &array)
static bool doSocketRead(QTcpSocket *socket, int minBytesAvailable, int timeout = 4000)
{
- QTime timer;
+ QElapsedTimer timer;
timer.start();
forever {
if (socket->bytesAvailable() >= minBytesAvailable)
@@ -408,6 +416,8 @@ void tst_NetworkSelfTest::remotePortsOpen_data()
QTest::newRow("http-proxy-auth-ntlm") << 3130;
QTest::newRow("socks5-proxy") << 1080;
QTest::newRow("socks5-proxy-auth") << 1081;
+ QTest::newRow("ftp-proxy") << 2121;
+ QTest::newRow("smb") << 139;
}
void tst_NetworkSelfTest::remotePortsOpen()
@@ -455,16 +465,43 @@ void tst_NetworkSelfTest::fileLineEndingTest()
QVERIFY2(!lineEndingType.compare("LF"), QString("Reference file %1 has %2 as line ending - Git checkout issue !?!").arg(referenceName, lineEndingType).toLocal8Bit());
}
-static QList<Chat> ftpChat()
+static QList<Chat> ftpChat(const QByteArray &userSuffix = QByteArray())
{
return QList<Chat>() << Chat::expect("220")
<< Chat::discardUntil("\r\n")
- << Chat::send("USER anonymous\r\n")
+ << Chat::send("USER anonymous" + userSuffix + "\r\n")
<< Chat::expect("331")
<< Chat::discardUntil("\r\n")
<< Chat::send("PASS user@hostname\r\n")
<< Chat::expect("230")
<< Chat::discardUntil("\r\n")
+
+ << Chat::send("CWD pub\r\n")
+ << Chat::expect("250")
+ << Chat::discardUntil("\r\n")
+ << Chat::send("CWD dir-not-readable\r\n")
+ << Chat::expect("550")
+ << Chat::discardUntil("\r\n")
+ << Chat::send("PWD\r\n")
+ << Chat::expect("257 \"/pub\"\r\n")
+ << Chat::send("SIZE file-not-readable.txt\r\n")
+ << Chat::expect("213 41\r\n")
+ << Chat::send("CWD qxmlquery\r\n")
+ << Chat::expect("250")
+ << Chat::discardUntil("\r\n")
+
+ << Chat::send("CWD /qtest\r\n")
+ << Chat::expect("250")
+ << Chat::discardUntil("\r\n")
+ << Chat::send("SIZE bigfile\r\n")
+ << Chat::expect("213 519240\r\n")
+ << Chat::send("SIZE rfc3252\r\n")
+ << Chat::expect("213 25962\r\n")
+ << Chat::send("SIZE rfc3252.txt\r\n")
+ << Chat::expect("213 25962\r\n")
+// << Chat::send("SIZE nonASCII/german_\344\366\374\304\326\334\337\r\n")
+// << Chat::expect("213 40\r\n")
+
<< Chat::send("QUIT\r\n")
<< Chat::expect("221")
<< Chat::discardUntil("\r\n")
@@ -476,6 +513,11 @@ void tst_NetworkSelfTest::ftpServer()
netChat(21, ftpChat());
}
+void tst_NetworkSelfTest::ftpProxyServer()
+{
+ netChat(2121, ftpChat("@" + QtNetworkSettings::serverName().toLatin1()));
+}
+
void tst_NetworkSelfTest::imapServer()
{
netChat(143, QList<Chat>()
@@ -493,6 +535,14 @@ void tst_NetworkSelfTest::imapServer()
void tst_NetworkSelfTest::httpServer()
{
+ QString uniqueExtension;
+ qsrand(time(0));
+#ifndef Q_OS_WINCE
+ uniqueExtension = QString("%1%2%3").arg((qulonglong)this).arg(qrand()).arg((qulonglong)time(0));
+#else
+ uniqueExtension = QString("%1%2").arg((qulonglong)this).arg(qrand());
+#endif
+
netChat(80, QList<Chat>()
// HTTP/0.9 chat:
<< Chat::send("GET /\r\n")
@@ -521,9 +571,185 @@ void tst_NetworkSelfTest::httpServer()
<< Chat::discardUntil(" ")
<< Chat::expect("200 ")
<< Chat::DiscardUntilDisconnect
+
+ // HTTP protected area
+ << Chat::Reconnect
+ << Chat::send("GET /qtest/protected/rfc3252.txt HTTP/1.0\r\n"
+ "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Connection: close\r\n"
+ "\r\n")
+ << Chat::expect("HTTP/1.")
+ << Chat::discardUntil(" ")
+ << Chat::expect("401 ")
+ << Chat::DiscardUntilDisconnect
+
+ << Chat::Reconnect
+ << Chat::send("HEAD /qtest/protected/rfc3252.txt HTTP/1.0\r\n"
+ "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Connection: close\r\n"
+ "Authorization: Basic cXNvY2tzdGVzdDpwYXNzd29yZA==\r\n"
+ "\r\n")
+ << Chat::expect("HTTP/1.")
+ << Chat::discardUntil(" ")
+ << Chat::expect("200 ")
+ << Chat::DiscardUntilDisconnect
+
+ // DAV area
+ << Chat::Reconnect
+ << Chat::send("HEAD /dav/ HTTP/1.0\r\n"
+ "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Connection: close\r\n"
+ "\r\n")
+ << Chat::expect("HTTP/1.")
+ << Chat::discardUntil(" ")
+ << Chat::expect("200 ")
+ << Chat::DiscardUntilDisconnect
+
+ // HTTP/1.0 PUT
+ << Chat::Reconnect
+ << Chat::send("PUT /dav/networkselftest-" + uniqueExtension.toLatin1() + ".txt HTTP/1.0\r\n"
+ "Content-Length: 5\r\n"
+ "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Connection: close\r\n"
+ "\r\n"
+ "Hello")
+ << Chat::expect("HTTP/1.")
+ << Chat::discardUntil(" ")
+ << Chat::expect("201 ")
+ << Chat::DiscardUntilDisconnect
+
+ // check that the file did get uploaded
+ << Chat::Reconnect
+ << Chat::send("HEAD /dav/networkselftest-" + uniqueExtension.toLatin1() + ".txt HTTP/1.0\r\n"
+ "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Connection: close\r\n"
+ "\r\n")
+ << Chat::expect("HTTP/1.")
+ << Chat::discardUntil(" ")
+ << Chat::expect("200 ")
+ << Chat::discardUntil("\r\nContent-Length: 5\r\n")
+ << Chat::DiscardUntilDisconnect
+
+ // HTTP/1.0 DELETE
+ << Chat::Reconnect
+ << Chat::send("DELETE /dav/networkselftest-" + uniqueExtension.toLatin1() + ".txt HTTP/1.0\r\n"
+ "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Connection: close\r\n"
+ "\r\n")
+ << Chat::expect("HTTP/1.")
+ << Chat::discardUntil(" ")
+ << Chat::expect("204 ")
+ << Chat::DiscardUntilDisconnect
);
}
+void tst_NetworkSelfTest::httpServerFiles_data()
+{
+ QTest::addColumn<QString>("uri");
+ QTest::addColumn<int>("size");
+
+ QTest::newRow("fluke.gif") << "/qtest/fluke.gif" << -1;
+ QTest::newRow("bigfile") << "/qtest/bigfile" << 519240;
+ QTest::newRow("rfc3252.txt") << "/qtest/rfc3252.txt" << 25962;
+ QTest::newRow("protected/rfc3252.txt") << "/qtest/protected/rfc3252.txt" << 25962;
+ QTest::newRow("completelyEmptyQuery.xq") << "/qtest/qxmlquery/completelyEmptyQuery.xq" << -1;
+ QTest::newRow("notWellformedViaHttps.xml") << "/qtest/qxmlquery/notWellformedViaHttps.xml" << -1;
+ QTest::newRow("notWellformed.xml") << "/qtest/qxmlquery/notWellformed.xml" << -1;
+ QTest::newRow("viaHttp.xq") << "/qtest/qxmlquery/viaHttp.xq" << -1;
+ QTest::newRow("wellFormedViaHttps.xml") << "/qtest/qxmlquery/wellFormedViaHttps.xml" << -1;
+ QTest::newRow("wellFormed.xml") << "/qtest/qxmlquery/wellFormed.xml" << -1;
+}
+
+void tst_NetworkSelfTest::httpServerFiles()
+{
+ QFETCH(QString, uri);
+ QFETCH(int, size);
+
+ QList<Chat> chat;
+ chat << Chat::send("HEAD " + QUrl::toPercentEncoding(uri, "/") + " HTTP/1.0\r\n"
+ "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Connection: close\r\n"
+ "Authorization: Basic cXNvY2tzdGVzdDpwYXNzd29yZA==\r\n"
+ "\r\n")
+ << Chat::expect("HTTP/1.")
+ << Chat::skipBytes(1) // HTTP/1.0 or 1.1 reply
+ << Chat::expect(" 200 ");
+ if (size != -1)
+ chat << Chat::discardUntil("\r\nContent-Length: " + QByteArray::number(size) + "\r\n");
+ chat << Chat::DiscardUntilDisconnect;
+ netChat(80, chat);
+}
+
+void tst_NetworkSelfTest::httpServerCGI_data()
+{
+ QTest::addColumn<QByteArray>("request");
+ QTest::addColumn<QByteArray>("result");
+ QTest::addColumn<QByteArray>("additionalHeader");
+
+ QTest::newRow("echo.cgi")
+ << QByteArray("GET /qtest/cgi-bin/echo.cgi?Hello+World HTTP/1.0\r\n"
+ "Connection: close\r\n"
+ "\r\n")
+ << QByteArray("Hello+World")
+ << QByteArray();
+
+ QTest::newRow("echo.cgi(POST)")
+ << QByteArray("POST /qtest/cgi-bin/echo.cgi?Hello+World HTTP/1.0\r\n"
+ "Connection: close\r\n"
+ "Content-Length: 15\r\n"
+ "\r\n"
+ "Hello, World!\r\n")
+ << QByteArray("Hello, World!\r\n")
+ << QByteArray();
+
+ QTest::newRow("md5sum.cgi")
+ << QByteArray("POST /qtest/cgi-bin/md5sum.cgi HTTP/1.0\r\n"
+ "Connection: close\r\n"
+ "Content-Length: 15\r\n"
+ "\r\n"
+ "Hello, World!\r\n")
+ << QByteArray("29b933a8d9a0fcef0af75f1713f4940e\n")
+ << QByteArray();
+
+ QTest::newRow("protected/md5sum.cgi")
+ << QByteArray("POST /qtest/protected/cgi-bin/md5sum.cgi HTTP/1.0\r\n"
+ "Connection: close\r\n"
+ "Authorization: Basic cXNvY2tzdGVzdDpwYXNzd29yZA==\r\n"
+ "Content-Length: 15\r\n"
+ "\r\n"
+ "Hello, World!\r\n")
+ << QByteArray("29b933a8d9a0fcef0af75f1713f4940e\n")
+ << QByteArray();
+
+ QTest::newRow("set-cookie.cgi")
+ << QByteArray("POST /qtest/cgi-bin/set-cookie.cgi HTTP/1.0\r\n"
+ "Connection: close\r\n"
+ "Content-Length: 8\r\n"
+ "\r\n"
+ "foo=bar\n")
+ << QByteArray("Success\n")
+ << QByteArray("\r\nSet-Cookie: foo=bar\r\n");
+}
+
+void tst_NetworkSelfTest::httpServerCGI()
+{
+ QFETCH(QByteArray, request);
+ QFETCH(QByteArray, result);
+ QFETCH(QByteArray, additionalHeader);
+ QList<Chat> chat;
+ chat << Chat::send(request)
+ << Chat::expect("HTTP/1.") << Chat::skipBytes(1)
+ << Chat::expect(" 200 ");
+
+ if (!additionalHeader.isEmpty())
+ chat << Chat::discardUntil(additionalHeader);
+
+ chat << Chat::discardUntil("\r\n\r\n")
+ << Chat::expect(result)
+ << Chat::RemoteDisconnect;
+ netChat(80, chat);
+}
+
void tst_NetworkSelfTest::httpsServer()
{
#ifndef QT_NO_OPENSSL
@@ -725,7 +951,63 @@ void tst_NetworkSelfTest::supportsSsl()
#ifdef QT_NO_OPENSSL
QFAIL("SSL not compiled in");
#else
- QVERIFY(QSslSocket::supportsSsl());
+ QVERIFY2(QSslSocket::supportsSsl(), "Could not load SSL libraries");
+#endif
+}
+
+void tst_NetworkSelfTest::smbServer()
+{
+ static const char contents[] = "This is 34 bytes. Do not change...";
+#ifdef Q_OS_WIN
+ // use Windows's native UNC support to try and open a file on the server
+ QString filepath = QString("\\\\%1\\testshare\\test.pri").arg(QtNetworkSettings::winServerName());
+ FILE *f = fopen(filepath.toLatin1(), "rb");
+ QVERIFY2(f, qt_error_string().toLocal8Bit());
+
+ char buf[128];
+ size_t ret = fread(buf, sizeof buf, 1, f);
+ fclose(f);
+
+ QCOMPARE(ret, strlen(contents));
+ QVERIFY(memcmp(buf, contents, strlen(contents)) == 0);
+#else
+ // try to use Samba
+ QString progname = "smbclient";
+ QProcess smbclient;
+ smbclient.start(progname, QIODevice::ReadOnly);
+ if (!smbclient.waitForStarted(2000))
+ QSKIP("Could not find smbclient (from Samba), cannot continue testing", SkipAll);
+ if (!smbclient.waitForFinished(2000) || smbclient.exitStatus() != QProcess::NormalExit)
+ QSKIP("smbclient isn't working, cannot continue testing", SkipAll);
+ smbclient.close();
+
+ // try listing the server
+ smbclient.start(progname, QStringList() << "-g" << "-N" << "-L" << QtNetworkSettings::winServerName(), QIODevice::ReadOnly);
+ QVERIFY(smbclient.waitForFinished(5000));
+ if (smbclient.exitStatus() != QProcess::NormalExit)
+ QSKIP("smbclient crashed", SkipAll);
+ QVERIFY2(smbclient.exitCode() == 0, "Test server not found");
+
+ QByteArray output = smbclient.readAll();
+ QVERIFY(output.contains("Disk|testshare|"));
+ QVERIFY(output.contains("Disk|testsharewritable|"));
+ QVERIFY(output.contains("Disk|testsharelargefile|"));
+ qDebug() << "Test server found and shares are correct";
+
+ // try getting a file
+ QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
+ env.insert("PAGER", "/bin/cat"); // just in case
+ smbclient.setProcessEnvironment(env);
+ smbclient.start(progname, QStringList() << "-N" << "-c" << "more test.pri"
+ << QString("\\\\%1\\testshare").arg(QtNetworkSettings::winServerName()), QIODevice::ReadOnly);
+ QVERIFY(smbclient.waitForFinished(5000));
+ if (smbclient.exitStatus() != QProcess::NormalExit)
+ QSKIP("smbclient crashed", SkipAll);
+ QVERIFY2(smbclient.exitCode() == 0, "File //qt-test-server/testshare/test.pri not found");
+
+ output = smbclient.readAll();
+ QCOMPARE(output.constData(), contents);
+ qDebug() << "Test file is correct";
#endif
}
diff --git a/tests/auto/opengl.pro b/tests/auto/opengl.pro
index 9b59cd1..6c8e4ca 100644
--- a/tests/auto/opengl.pro
+++ b/tests/auto/opengl.pro
@@ -3,4 +3,5 @@ SUBDIRS=\
qgl \
qglthreads \
qglbuffer \
+ qglfunctions \
diff --git a/tests/auto/patternistexamples/patternistexamples.pro b/tests/auto/patternistexamples/patternistexamples.pro
index f83e0aa..098b0fe 100644
--- a/tests/auto/patternistexamples/patternistexamples.pro
+++ b/tests/auto/patternistexamples/patternistexamples.pro
@@ -2,17 +2,17 @@ load(qttest_p4)
SOURCES += tst_patternistexamples.cpp
CONFIG += qtestlib
wince*|symbian: {
- snippets.sources = $$QT_SOURCE_TREE/doc/src/snippets/patternist/*
+ snippets.files = $$QT_SOURCE_TREE/doc/src/snippets/patternist/*
snippets.path = patternist
- widgetRen.sources = $$QT_SOURCE_TREE/examples/xmlpatterns/xquery/widgetRenderer/*
+ widgetRen.files = $$QT_SOURCE_TREE/examples/xmlpatterns/xquery/widgetRenderer/*
widgetRen.path = widgetRenderer
- globVar.sources = $$QT_SOURCE_TREE/examples/xmlpatterns/xquery/globalVariables/*
+ globVar.files = $$QT_SOURCE_TREE/examples/xmlpatterns/xquery/globalVariables/*
globVar.path = globalVariables
- filetree.sources = $$QT_SOURCE_TREE/examples/xmlpatterns/filetree/*
+ filetree.files = $$QT_SOURCE_TREE/examples/xmlpatterns/filetree/*
filetree.path = filetree
- recipes.sources = $$QT_SOURCE_TREE/examples/xmlpatterns/recipes/*
+ recipes.files = $$QT_SOURCE_TREE/examples/xmlpatterns/recipes/*
recipes.path = recipes
- files.sources = $$QT_SOURCE_TREE/examples/xmlpatterns/recipes/files/*
+ files.files = $$QT_SOURCE_TREE/examples/xmlpatterns/recipes/files/*
files.path = recipes\\files
DEPLOYMENT += snippets widgetRen globVar filetree recipes files
diff --git a/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro b/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro
index 2e2577d..6f5044f 100644
--- a/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro
+++ b/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro
@@ -4,7 +4,7 @@ QT -= gui
SOURCES += tst_qabstractnetworkcache.cpp
wince*|symbian: {
- testFiles.sources = tests
+ testFiles.files = tests
testFiles.path = .
DEPLOYMENT += testFiles
}
diff --git a/tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro b/tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro
index a18f4ca..b8f509d 100644
--- a/tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro
+++ b/tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro
@@ -7,7 +7,7 @@ HEADERS += TestNodeModel.h LoadingModel.h
include (../xmlpatterns.pri)
wince*: {
- addFiles.sources = tree.xml
+ addFiles.files = tree.xml
addFiles.path = .
DEPLOYMENT += addFiles
diff --git a/tests/auto/qaccessibility/qaccessibility.pro b/tests/auto/qaccessibility/qaccessibility.pro
index 1b30beb..a4f606c 100644
--- a/tests/auto/qaccessibility/qaccessibility.pro
+++ b/tests/auto/qaccessibility/qaccessibility.pro
@@ -5,7 +5,7 @@ unix:!mac:LIBS+=-lm
contains(QT_CONFIG, qt3support): QT += qt3support
wince*: {
- accessneeded.sources = $$QT_BUILD_TREE\\plugins\\accessible\\*.dll
+ accessneeded.files = $$QT_BUILD_TREE\\plugins\\accessible\\*.dll
accessneeded.path = accessible
DEPLOYMENT += accessneeded
} \ No newline at end of file
diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp
index cea259c..713ad08 100644
--- a/tests/auto/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp
@@ -4073,7 +4073,8 @@ void tst_QAccessibility::accelerators()
window->show();
QAccessibleInterface *accLineEdit = QAccessible::queryAccessibleInterface(le);
- QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QKeySequence(Qt::ALT).toString() + QLatin1String("L"));
+ QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + QLatin1String("L"));
+ QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + QLatin1String("L"));
label->setText(tr("Q &"));
QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString());
label->setText(tr("Q &&"));
@@ -4081,11 +4082,11 @@ void tst_QAccessibility::accelerators()
label->setText(tr("Q && A"));
QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString());
label->setText(tr("Q &&&A"));
- QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QKeySequence(Qt::ALT).toString() + QLatin1String("A"));
+ QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + QLatin1String("A"));
label->setText(tr("Q &&A"));
QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString());
label->setText(tr("Q &A&B"));
- QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QKeySequence(Qt::ALT).toString() + QLatin1String("A"));
+ QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + QLatin1String("A"));
#if defined(Q_WS_X11)
qt_x11_wait_for_window_manager(window);
diff --git a/tests/auto/qapplication/test/test.pro b/tests/auto/qapplication/test/test.pro
index 2c54c37..4c8e9b0 100644
--- a/tests/auto/qapplication/test/test.pro
+++ b/tests/auto/qapplication/test/test.pro
@@ -4,19 +4,19 @@ SOURCES += ../tst_qapplication.cpp
TARGET = ../tst_qapplication
wince* {
- additional.sources = ../desktopsettingsaware/desktopsettingsaware.exe
+ additional.files = ../desktopsettingsaware/desktopsettingsaware.exe
additional.path = desktopsettingsaware
- someTest.sources = test.pro
+ someTest.files = test.pro
someTest.path = test
DEPLOYMENT = additional deploy someTest
}
symbian: {
- additional.sources = $$OUT_PWD/../desktopsettingsaware/desktopsettingsaware.exe
+ additional.files = $$OUT_PWD/../desktopsettingsaware/desktopsettingsaware.exe
additional.path = desktopsettingsaware
- someTest.sources = test.pro
+ someTest.files = test.pro
someTest.path = test
- windowIcon.sources = ../heart.svg
+ windowIcon.files = ../heart.svg
DEPLOYMENT = additional deploy someTest windowIcon
LIBS += -lcone -lavkon
}
diff --git a/tests/auto/qaudioinput/qaudioinput.pro b/tests/auto/qaudioinput/qaudioinput.pro
index 5eb1613..922c3e4 100644
--- a/tests/auto/qaudioinput/qaudioinput.pro
+++ b/tests/auto/qaudioinput/qaudioinput.pro
@@ -5,7 +5,7 @@ SOURCES += tst_qaudioinput.cpp
QT = core multimedia
wince* {
- deploy.sources += 4.wav
+ deploy.files += 4.wav
DEPLOYMENT = deploy
DEFINES += SRCDIR=\\\"\\\"
QT += gui
diff --git a/tests/auto/qaudiooutput/qaudiooutput.pro b/tests/auto/qaudiooutput/qaudiooutput.pro
index e1734e0..0bd0151 100644
--- a/tests/auto/qaudiooutput/qaudiooutput.pro
+++ b/tests/auto/qaudiooutput/qaudiooutput.pro
@@ -5,7 +5,7 @@ SOURCES += tst_qaudiooutput.cpp
QT = core multimedia
wince*|symbian: {
- deploy.sources += 4.wav
+ deploy.files += 4.wav
DEPLOYMENT = deploy
!symbian {
DEFINES += SRCDIR=\\\"\\\"
diff --git a/tests/auto/qbytearray/qbytearray.pro b/tests/auto/qbytearray/qbytearray.pro
index a0c143e..35e48ad 100644
--- a/tests/auto/qbytearray/qbytearray.pro
+++ b/tests/auto/qbytearray/qbytearray.pro
@@ -5,7 +5,7 @@ SOURCES += tst_qbytearray.cpp
QT = core
wince*|symbian {
- addFile.sources = rfc3252.txt
+ addFile.files = rfc3252.txt
addFile.path = .
DEPLOYMENT += addFile
}
diff --git a/tests/auto/qbytearray/tst_qbytearray.cpp b/tests/auto/qbytearray/tst_qbytearray.cpp
index 07fdbc3..0dc2282 100644
--- a/tests/auto/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/qbytearray/tst_qbytearray.cpp
@@ -142,6 +142,8 @@ private slots:
void repeated_data() const;
void byteRefDetaching() const;
+
+ void reserve();
};
tst_QByteArray::tst_QByteArray()
@@ -221,18 +223,18 @@ void tst_QByteArray::qUncompress_data()
QTest::addColumn<QByteArray>("in");
QTest::addColumn<QByteArray>("out");
- QTest::newRow("0x00000000") << QByteArray("\x00\x00\x00\x00") << QByteArray();
- QTest::newRow("0x000000ff") << QByteArray("\x00\x00\x00\xff") << QByteArray();
- QTest::newRow("0x3f000000") << QByteArray("\x3f\x00\x00\x00") << QByteArray();
- QTest::newRow("0x3fffffff") << QByteArray("\x3f\xff\xff\xff") << QByteArray();
- QTest::newRow("0x7fffff00") << QByteArray("\x7f\xff\xff\x00") << QByteArray();
- QTest::newRow("0x7fffffff") << QByteArray("\x7f\xff\xff\xff") << QByteArray();
- QTest::newRow("0x80000000") << QByteArray("\x80\x00\x00\x00") << QByteArray();
- QTest::newRow("0x800000ff") << QByteArray("\x80\x00\x00\xff") << QByteArray();
- QTest::newRow("0xcf000000") << QByteArray("\xcf\x00\x00\x00") << QByteArray();
- QTest::newRow("0xcfffffff") << QByteArray("\xcf\xff\xff\xff") << QByteArray();
- QTest::newRow("0xffffff00") << QByteArray("\xff\xff\xff\x00") << QByteArray();
- QTest::newRow("0xffffffff") << QByteArray("\xff\xff\xff\xff") << QByteArray();
+ QTest::newRow("0x00000000") << QByteArray("\x00\x00\x00\x00", 4) << QByteArray();
+ QTest::newRow("0x000000ff") << QByteArray("\x00\x00\x00\xff", 4) << QByteArray();
+ QTest::newRow("0x3f000000") << QByteArray("\x3f\x00\x00\x00", 4) << QByteArray();
+ QTest::newRow("0x3fffffff") << QByteArray("\x3f\xff\xff\xff", 4) << QByteArray();
+ QTest::newRow("0x7fffff00") << QByteArray("\x7f\xff\xff\x00", 4) << QByteArray();
+ QTest::newRow("0x7fffffff") << QByteArray("\x7f\xff\xff\xff", 4) << QByteArray();
+ QTest::newRow("0x80000000") << QByteArray("\x80\x00\x00\x00", 4) << QByteArray();
+ QTest::newRow("0x800000ff") << QByteArray("\x80\x00\x00\xff", 4) << QByteArray();
+ QTest::newRow("0xcf000000") << QByteArray("\xcf\x00\x00\x00", 4) << QByteArray();
+ QTest::newRow("0xcfffffff") << QByteArray("\xcf\xff\xff\xff", 4) << QByteArray();
+ QTest::newRow("0xffffff00") << QByteArray("\xff\xff\xff\x00", 4) << QByteArray();
+ QTest::newRow("0xffffffff") << QByteArray("\xff\xff\xff\xff", 4) << QByteArray();
}
void tst_QByteArray::qUncompress()
@@ -249,18 +251,10 @@ void tst_QByteArray::qUncompress()
#endif
QByteArray res;
- QT_TRY {
- res = ::qUncompress(in);
- } QT_CATCH(const std::bad_alloc &) {
- res = QByteArray();
- }
+ res = ::qUncompress(in);
QCOMPARE(res, out);
- QT_TRY {
- res = ::qUncompress(in + "blah");
- } QT_CATCH(const std::bad_alloc &) {
- res = QByteArray();
- }
+ res = ::qUncompress(in + "blah");
QCOMPARE(res, out);
}
@@ -1516,6 +1510,22 @@ void tst_QByteArray::byteRefDetaching() const
}
}
+void tst_QByteArray::reserve()
+{
+ int capacity = 100;
+ QByteArray qba;
+ qba.reserve(capacity);
+ QVERIFY(qba.capacity() == capacity);
+ char *data = qba.data();
+
+ // FIXME count from 0 to make it fail
+ for (int i = 1; i < capacity; i++) {
+ qba.resize(i);
+ QVERIFY(capacity == qba.capacity());
+ QVERIFY(data == qba.data());
+ }
+}
+
const char globalChar = '1';
QTEST_APPLESS_MAIN(tst_QByteArray)
diff --git a/tests/auto/qchar/qchar.pro b/tests/auto/qchar/qchar.pro
index 3813e4e..9cfccc2 100644
--- a/tests/auto/qchar/qchar.pro
+++ b/tests/auto/qchar/qchar.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qchar.cpp
QT = core
wince*|symbian: {
-deploy.sources += NormalizationTest.txt
+deploy.files += NormalizationTest.txt
DEPLOYMENT = deploy
}
diff --git a/tests/auto/qcheckbox/tst_qcheckbox.cpp b/tests/auto/qcheckbox/tst_qcheckbox.cpp
index d16370c..24d78fe 100644
--- a/tests/auto/qcheckbox/tst_qcheckbox.cpp
+++ b/tests/auto/qcheckbox/tst_qcheckbox.cpp
@@ -92,6 +92,7 @@ private slots:
void setAccel();
void group();
void foregroundRole();
+ void minimumSizeHint();
protected slots:
void onClicked();
@@ -425,5 +426,11 @@ void tst_QCheckBox::foregroundRole()
QVERIFY(testWidget->foregroundRole() == QPalette::WindowText);
}
+void tst_QCheckBox::minimumSizeHint()
+{
+ QCheckBox box(tr("CheckBox's sizeHint is the same as it's minimumSizeHint"));
+ QCOMPARE(box.sizeHint(), box.minimumSizeHint());
+}
+
QTEST_MAIN(tst_QCheckBox)
#include "tst_qcheckbox.moc"
diff --git a/tests/auto/qclipboard/test/test.pro b/tests/auto/qclipboard/test/test.pro
index 0f8cad1..7d5c2f3 100644
--- a/tests/auto/qclipboard/test/test.pro
+++ b/tests/auto/qclipboard/test/test.pro
@@ -11,18 +11,18 @@ win32 {
}
wince*|symbian: {
- copier.sources = ../copier/copier.exe
+ copier.files = ../copier/copier.exe
copier.path = copier
- paster.sources = ../paster/paster.exe
+ paster.files = ../paster/paster.exe
paster.path = paster
symbian: {
load(data_caging_paths)
- rsc.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/copier.rsc
- rsc.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/paster.rsc
+ rsc.files = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/copier.rsc
+ rsc.files += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/paster.rsc
rsc.path = $$APP_RESOURCE_DIR
- reg_resource.sources = $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/copier_reg.rsc
- reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/paster_reg.rsc
+ reg_resource.files = $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/copier_reg.rsc
+ reg_resource.files += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/paster_reg.rsc
reg_resource.path = $$REG_RESOURCE_IMPORT_DIR
}
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index 1fcea9e..71dab40 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -157,6 +157,7 @@ private slots:
void keyBoardNavigationWithMouse();
void task_QTBUG_1071_changingFocusEmitsActivated();
void maxVisibleItems();
+ void task_QTBUG_10491_currentIndexAndModelColumn();
protected slots:
void onEditTextChanged( const QString &newString );
@@ -474,6 +475,18 @@ void tst_QComboBox::setPalette()
QVERIFY(((QWidget*)o)->palette() == pal);
}
}
+
+ testWidget->setEditable(true);
+ pal.setColor(QPalette::Base, Qt::red);
+ //Setting it on the lineedit should be separate form the combo
+ testWidget->lineEdit()->setPalette(pal);
+ QVERIFY(testWidget->palette() != pal);
+ QVERIFY(testWidget->lineEdit()->palette() == pal);
+ pal.setColor(QPalette::Base, Qt::green);
+ //Setting it on the combo directly should override lineedit
+ testWidget->setPalette(pal);
+ QVERIFY(testWidget->palette() == pal);
+ QVERIFY(testWidget->lineEdit()->palette() == pal);
}
void tst_QComboBox::sizeAdjustPolicy()
@@ -2553,11 +2566,33 @@ void tst_QComboBox::maxVisibleItems()
QAbstractItemView *v = comboBox.view();
int itemHeight = v->visualRect(v->model()->index(0,0)).height();
- if (v->style()->styleHint(QStyle::SH_ComboBox_Popup))
+ QListView *lv = qobject_cast<QListView*>(v);
+ if (lv)
+ itemHeight += lv->spacing();
+ QStyleOptionComboBox opt;
+ opt.initFrom(&comboBox);
+ if (!comboBox.style()->styleHint(QStyle::SH_ComboBox_Popup, &opt))
QCOMPARE(v->viewport()->height(), itemHeight * comboBox.maxVisibleItems());
- // QCombobox without a popup does not work, see QTBUG-760
}
+void tst_QComboBox::task_QTBUG_10491_currentIndexAndModelColumn()
+{
+ QComboBox comboBox;
+
+ QStandardItemModel model(4, 4, &comboBox);
+ for (int i = 0; i < 4; i++){
+ model.setItem(i, 0, new QStandardItem(QString("Employee Nr %1").arg(i)));
+ model.setItem(i, 1, new QStandardItem(QString("Street Nr %1").arg(i)));
+ model.setItem(i, 2, new QStandardItem(QString("Town Nr %1").arg(i)));
+ model.setItem(i, 3, new QStandardItem(QString("Phone Nr %1").arg(i)));
+ }
+ comboBox.setModel(&model);
+ comboBox.setModelColumn(0);
+
+ QComboBoxPrivate *d = static_cast<QComboBoxPrivate *>(QComboBoxPrivate::get(&comboBox));
+ d->setCurrentIndex(model.index(2, 2));
+ QCOMPARE(QModelIndex(d->currentIndex), model.index(2, comboBox.modelColumn()));
+}
QTEST_MAIN(tst_QComboBox)
#include "tst_qcombobox.moc"
diff --git a/tests/auto/qcssparser/qcssparser.pro b/tests/auto/qcssparser/qcssparser.pro
index 674064f..f696f19 100644
--- a/tests/auto/qcssparser/qcssparser.pro
+++ b/tests/auto/qcssparser/qcssparser.pro
@@ -8,9 +8,9 @@ requires(contains(QT_CONFIG,private_tests))
}
wince*|symbian: {
- addFiles.sources = testdata
+ addFiles.files = testdata
addFiles.path = .
- timesFont.sources = C:/Windows/Fonts/times.ttf
+ timesFont.files = C:/Windows/Fonts/times.ttf
timesFont.path = .
DEPLOYMENT += addFiles timesFont
}
diff --git a/tests/auto/qdatastream/qdatastream.pro b/tests/auto/qdatastream/qdatastream.pro
index c132073..eba7c00 100644
--- a/tests/auto/qdatastream/qdatastream.pro
+++ b/tests/auto/qdatastream/qdatastream.pro
@@ -12,13 +12,13 @@ QT += svg
wince*: {
- addFiles.sources = datastream.q42 tests2.svg
+ addFiles.files = datastream.q42 tests2.svg
addFiles.path = .
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\"\\\"
} else:symbian {
# SRCDIR and SVGFILE defined in code in symbian
- addFiles.sources = datastream.q42 tests2.svg
+ addFiles.files = datastream.q42 tests2.svg
addFiles.path = .
DEPLOYMENT += addFiles
TARGET.EPOCHEAPSIZE = 1000000 10000000
diff --git a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp
index 3125258..50b0e0a 100644
--- a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -273,6 +273,9 @@ private slots:
void task196924();
void focusNextPrevChild();
+
+ void taskQTBUG_12384_timeSpecShowTimeOnly();
+
private:
EditorDateEdit* testWidget;
QWidget *testFocusWidget;
@@ -3420,7 +3423,20 @@ void tst_QDateTimeEdit::focusNextPrevChild()
QCOMPARE(edit.currentSection(), QDateTimeEdit::MonthSection);
}
+void tst_QDateTimeEdit::taskQTBUG_12384_timeSpecShowTimeOnly()
+{
+ QDateTime time = QDateTime::fromString("20100723 04:02:40", "yyyyMMdd hh:mm:ss");
+ time.setTimeSpec(Qt::UTC);
+
+ EditorDateEdit edit;
+ edit.setDisplayFormat("hh:mm:ss");
+ edit.setTimeSpec(Qt::UTC);
+ edit.setDateTime(time);
+ QCOMPARE(edit.minimumTime(), QTime(0, 0, 0, 0));
+ QCOMPARE(edit.maximumTime(), QTime(23, 59, 59, 999));
+ QCOMPARE(edit.time(), time.time());
+}
QTEST_MAIN(tst_QDateTimeEdit)
#include "tst_qdatetimeedit.moc"
diff --git a/tests/auto/qdesktopservices/qdesktopservices.pro b/tests/auto/qdesktopservices/qdesktopservices.pro
index d32ed4c..43f6cba 100644
--- a/tests/auto/qdesktopservices/qdesktopservices.pro
+++ b/tests/auto/qdesktopservices/qdesktopservices.pro
@@ -3,22 +3,22 @@ CONFIG += qttest_p4
SOURCES += tst_qdesktopservices.cpp
TARGET = tst_qdesktopservices
symbian: {
- dummy.sources = text\\testfile.txt
+ dummy.files = text\\testfile.txt
dummy.path = .
- text.sources = text\\*
+ text.files = text\\*
text.path = \\data\\others
- image.sources = image\\*
+ image.files = image\\*
image.path = \\data\\images
- audio.sources = audio\\*
+ audio.files = audio\\*
audio.path = \\data\\sounds
- video.sources = video\\*
+ video.files = video\\*
video.path = \\data\\videos
- install.sources = install\\*
+ install.files = install\\*
install.path = \\data\\installs
DEPLOYMENT += image audio video install
diff --git a/tests/auto/qdir/qdir.pro b/tests/auto/qdir/qdir.pro
index cf612f1..818f52c 100644
--- a/tests/auto/qdir/qdir.pro
+++ b/tests/auto/qdir/qdir.pro
@@ -4,7 +4,7 @@ RESOURCES += qdir.qrc
QT = core
wince*|symbian {
- DirFiles.sources = testdir testdata searchdir resources entrylist types tst_qdir.cpp
+ DirFiles.files = testdir testdata searchdir resources entrylist types tst_qdir.cpp
DirFiles.path = .
DEPLOYMENT += DirFiles
}
diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp
index fb83a5a..9678868 100644
--- a/tests/auto/qdir/tst_qdir.cpp
+++ b/tests/auto/qdir/tst_qdir.cpp
@@ -49,6 +49,11 @@
#include <qregexp.h>
#include <qstringlist.h>
#include "../network-settings.h"
+
+#if defined(Q_OS_WIN)
+#define _WIN32_WINNT 0x500
+#endif
+
#include "../../shared/filesystem.h"
#if defined(Q_OS_SYMBIAN)
@@ -169,6 +174,11 @@ private slots:
void updateFileLists();
void detachingOperations();
+
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ void isRoot_data();
+ void isRoot();
+#endif
};
// Testing get/set functions
@@ -802,6 +812,16 @@ void tst_QDir::canonicalPath_data()
QTest::newRow("absPath") << appPath + "\\testData\\..\\testData" << appPath + "/testData";
#endif
QTest::newRow("nonexistant") << "testd" << QString();
+
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ QTest::newRow("drive:/") << QDir::rootPath() << QDir::rootPath();
+ QTest::newRow("drive:\\") << QDir::toNativeSeparators(QDir::rootPath()) << QDir::rootPath();
+ QTest::newRow("drive:/./") << QDir::rootPath().append("./") << QDir::rootPath();
+ QTest::newRow("drive:/../.. ") << QDir::rootPath().append("../..") << QDir::rootPath();
+ QTest::newRow("drive:\\.\\") << QDir::toNativeSeparators(QDir::rootPath().append("./")) << QDir::rootPath();
+ QTest::newRow("drive:\\..\\..") << QDir::toNativeSeparators(QDir::rootPath().append("../..")) << QDir::rootPath();
+ QTest::newRow("drive:") << QDir().canonicalPath().left(2) << QDir().canonicalPath();
+#endif
}
void tst_QDir::canonicalPath()
@@ -1640,6 +1660,32 @@ void tst_QDir::detachingOperations()
QCOMPARE(dir1.sorting(), sorting);
}
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+void tst_QDir::isRoot_data()
+{
+ QTest::addColumn<QString>("path");
+ QTest::addColumn<bool>("isRoot");
+
+ QString test = QDir::rootPath();
+ QTest::newRow(QString("rootPath " + test).toLatin1()) << test << true;
+ test = QDir::rootPath().append("./");
+ QTest::newRow(QString("./ appended " + test).toLatin1()) << test << false;
+ test = QDir(QDir::rootPath().append("./")).canonicalPath();
+ QTest::newRow(QString("canonicalPath " + test).toLatin1()) << test << true;
+ test = QDir::rootPath().left(2);
+ QTest::newRow(QString("drive relative " + test).toLatin1()) << test << false;
+}
+
+void tst_QDir::isRoot()
+{
+ QFETCH(QString, path);
+ QFETCH(bool, isRoot);
+
+ QDir dir(path);
+ QCOMPARE(dir.isRoot(),isRoot);
+}
+#endif
+
QTEST_MAIN(tst_QDir)
#include "tst_qdir.moc"
diff --git a/tests/auto/qdiriterator/qdiriterator.pro b/tests/auto/qdiriterator/qdiriterator.pro
index d60b52d..020b229 100644
--- a/tests/auto/qdiriterator/qdiriterator.pro
+++ b/tests/auto/qdiriterator/qdiriterator.pro
@@ -4,7 +4,7 @@ RESOURCES += qdiriterator.qrc
QT = core
wince*|symbian: {
- addFiles.sources = entrylist recursiveDirs foo
+ addFiles.files = entrylist recursiveDirs foo
addFiles.path = .
DEPLOYMENT += addFiles
wince*mips*|wincewm50smart-msvc200*: DEFINES += WINCE_BROKEN_ITERATE=1
diff --git a/tests/auto/qdirmodel/qdirmodel.pro b/tests/auto/qdirmodel/qdirmodel.pro
index 36929b9..7037a79 100644
--- a/tests/auto/qdirmodel/qdirmodel.pro
+++ b/tests/auto/qdirmodel/qdirmodel.pro
@@ -2,11 +2,11 @@ load(qttest_p4)
SOURCES += tst_qdirmodel.cpp
wince*|symbian {
- addit.sources = dirtest\\test1\\*
+ addit.files = dirtest\\test1\\*
addit.path = dirtest\\test1
- tests.sources = test\\*
+ tests.files = test\\*
tests.path = test
- sourceFile.sources = tst_qdirmodel.cpp
+ sourceFile.files = tst_qdirmodel.cpp
sourceFile.path = .
DEPLOYMENT += addit tests sourceFile
}
diff --git a/tests/auto/qdom/qdom.pro b/tests/auto/qdom/qdom.pro
index 9040b91..0a3c167 100644
--- a/tests/auto/qdom/qdom.pro
+++ b/tests/auto/qdom/qdom.pro
@@ -5,7 +5,7 @@ QT = core xml
QT -= gui
wince*|symbian: {
- addFiles.sources = testdata doubleNamespaces.xml umlaut.xml
+ addFiles.files = testdata doubleNamespaces.xml umlaut.xml
addFiles.path = .
DEPLOYMENT += addFiles
diff --git a/tests/auto/qfile/test/test.pro b/tests/auto/qfile/test/test.pro
index 70c93ce..c657e9a 100644
--- a/tests/auto/qfile/test/test.pro
+++ b/tests/auto/qfile/test/test.pro
@@ -3,11 +3,11 @@ SOURCES += ../tst_qfile.cpp
wince*|symbian {
QT = core gui
- files.sources += ..\\dosfile.txt ..\\noendofline.txt ..\\testfile.txt \
+ files.files += ..\\dosfile.txt ..\\noendofline.txt ..\\testfile.txt \
..\\testlog.txt ..\\two.dots.file ..\\tst_qfile.cpp \
..\\Makefile ..\\forCopying.txt ..\\forRenaming.txt
files.path = .
- resour.sources += ..\\resources\\file1.ext1
+ resour.files += ..\\resources\\file1.ext1
resour.path = resources
DEPLOYMENT = files resour
diff --git a/tests/auto/qfiledialog/qfiledialog.pro b/tests/auto/qfiledialog/qfiledialog.pro
index 2b87cf1..68f2e3c 100644
--- a/tests/auto/qfiledialog/qfiledialog.pro
+++ b/tests/auto/qfiledialog/qfiledialog.pro
@@ -7,9 +7,9 @@ load(qttest_p4)
SOURCES += tst_qfiledialog.cpp
wince*|symbian {
- addFiles.sources = *.cpp
+ addFiles.files = *.cpp
addFiles.path = .
- filesInDir.sources = *.pro
+ filesInDir.files = *.pro
filesInDir.path = someDir
DEPLOYMENT += addFiles filesInDir
}
diff --git a/tests/auto/qfiledialog2/qfiledialog2.pro b/tests/auto/qfiledialog2/qfiledialog2.pro
index 4ebf977..b8924c1 100644
--- a/tests/auto/qfiledialog2/qfiledialog2.pro
+++ b/tests/auto/qfiledialog2/qfiledialog2.pro
@@ -7,9 +7,9 @@ load(qttest_p4)
SOURCES += tst_qfiledialog2.cpp
wince*|symbian {
- addFiles.sources = *.cpp
+ addFiles.files = *.cpp
addFiles.path = .
- filesInDir.sources = *.pro
+ filesInDir.files = *.pro
filesInDir.path = someDir
DEPLOYMENT += addFiles filesInDir
}
diff --git a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
index 6299c24..ed4ecb4 100644
--- a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
@@ -548,7 +548,7 @@ void tst_QFileDialog2::task226366_lowerCaseHardDriveWindows()
QTest::qWait(200);
QTest::keyClick(edit->completer()->popup(), Qt::Key_Down);
QTest::qWait(200);
- QCOMPARE(edit->text(), QString("C:"));
+ QCOMPARE(edit->text(), QString("C:/"));
QTest::qWait(2000);
//i clear my previous selection in the completer
QTest::keyClick(edit->completer()->popup(), Qt::Key_Down);
@@ -556,7 +556,7 @@ void tst_QFileDialog2::task226366_lowerCaseHardDriveWindows()
QTest::keyClick(edit, (char)(Qt::Key_C | Qt::SHIFT));
QTest::qWait(200);
QTest::keyClick(edit->completer()->popup(), Qt::Key_Down);
- QCOMPARE(edit->text(), QString("C:"));
+ QCOMPARE(edit->text(), QString("C:/"));
}
#endif
diff --git a/tests/auto/qfileinfo/qfileinfo.pro b/tests/auto/qfileinfo/qfileinfo.pro
index 30656e2..3141db6 100644
--- a/tests/auto/qfileinfo/qfileinfo.pro
+++ b/tests/auto/qfileinfo/qfileinfo.pro
@@ -7,8 +7,8 @@ QT = core
RESOURCES += qfileinfo.qrc
wince*:|symbian: {
- deploy.sources += qfileinfo.qrc tst_qfileinfo.cpp
- res.sources = resources\\file1 resources\\file1.ext1 resources\\file1.ext1.ext2
+ deploy.files += qfileinfo.qrc tst_qfileinfo.cpp
+ res.files = resources\\file1 resources\\file1.ext1 resources\\file1.ext1.ext2
res.path = resources
DEPLOYMENT = deploy res
}
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index 208110a..7659a75 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -46,6 +46,7 @@
#include <qfile.h>
#include <qdir.h>
#include <qcoreapplication.h>
+#include <qlibrary.h>
#include <qtemporaryfile.h>
#include <qdir.h>
#include <qfileinfo.h>
@@ -55,7 +56,9 @@
#include <sys/stat.h>
#endif
#ifdef Q_OS_WIN
+#define _WIN32_WINNT 0x500
#include <qt_windows.h>
+#include <qlibrary.h>
#endif
#include <qplatformdefs.h>
#include <qdebug.h>
@@ -65,6 +68,7 @@
#endif
#include "../network-settings.h"
#include <private/qfileinfo_p.h>
+#include "../../shared/filesystem.h"
#if defined(Q_OS_SYMBIAN)
# define SRCDIR ""
@@ -151,6 +155,9 @@ private slots:
void isHidden_data();
void isHidden();
+#if defined(Q_OS_MAC)
+ void isHiddenFromFinder();
+#endif
void isBundle_data();
void isBundle();
@@ -161,6 +168,8 @@ private slots:
void refresh();
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+ void ntfsJunctionPointsAndSymlinks_data();
+ void ntfsJunctionPointsAndSymlinks();
void brokenShortcut();
#endif
@@ -186,6 +195,8 @@ tst_QFileInfo::~tst_QFileInfo()
QFile::remove("link.lnk");
QFile::remove("file1");
QFile::remove("dummyfile");
+ QFile::remove("simplefile.txt");
+ QFile::remove("longFileNamelongFileNamelongFileNamelongFileNamelongFileNamelongFileNamelongFileNamelongFileNamelongFileNamelongFileNamelongFileNamelongFileNamelongFileNamelongFileNamelongFileNamelongFileNamelongFileNamelongFileNamelongFileNamelongFileName.txt");
#ifdef Q_OS_SYMBIAN
QFile::remove("hidden.txt");
QFile::remove("nothidden.txt");
@@ -195,9 +206,17 @@ tst_QFileInfo::~tst_QFileInfo()
#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
QDir().rmdir("./.hidden-directory");
+ QFile::remove("link_to_tst_qfileinfo");
#endif
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
QDir().rmdir("./hidden-directory");
+ QDir().rmdir("abs_symlink");
+ QDir().rmdir("rel_symlink");
+ QDir().rmdir("junction_pwd");
+ QDir().rmdir("junction_root");
+ QDir().rmdir("mountpoint");
+ QFile::remove("abs_symlink.cpp");
+ QFile::remove("rel_symlink.cpp");
#endif
}
@@ -580,6 +599,25 @@ void tst_QFileInfo::canonicalFilePath()
}
# endif
#endif
+
+#ifdef Q_OS_WIN
+ typedef BOOL (WINAPI *PtrCreateSymbolicLink)(LPTSTR, LPTSTR, DWORD);
+ PtrCreateSymbolicLink ptrCreateSymbolicLink =
+ (PtrCreateSymbolicLink)QLibrary::resolve(QLatin1String("kernel32"), "CreateSymbolicLink");
+
+ if (!ptrCreateSymbolicLink ||
+ ptrCreateSymbolicLink((wchar_t*)QString("res").utf16(), (wchar_t*)QString("resources").utf16(), 1) == 0) {
+ QSKIP("Symbolic links aren't supported by FS", SkipAll);
+ }
+
+ QString currentPath = QDir::currentPath();
+ QCOMPARE(QDir::setCurrent("res"), true);
+
+ QCOMPARE(QFileInfo("file1").canonicalFilePath(), currentPath + "/resources/file1");
+
+ QCOMPARE(QDir::setCurrent(currentPath), true);
+ QFile::remove("res");
+#endif
}
void tst_QFileInfo::fileName_data()
@@ -1148,6 +1186,27 @@ void tst_QFileInfo::isHidden()
QCOMPARE(fi.isHidden(), isHidden);
}
+#if defined(Q_OS_MAC)
+void tst_QFileInfo::isHiddenFromFinder()
+{
+ const char *filename = "test_foobar.txt";
+
+ QFile testFile(filename);
+ testFile.open(QIODevice::WriteOnly | QIODevice::Append);
+ testFile.write(QByteArray("world"));
+ testFile.close();
+
+ struct stat buf;
+ stat(filename, &buf);
+ chflags(filename, buf.st_flags | UF_HIDDEN);
+
+ QFileInfo fi(filename);
+ QCOMPARE(fi.isHidden(), true);
+
+ testFile.remove();
+}
+#endif
+
void tst_QFileInfo::isBundle_data()
{
QTest::addColumn<QString>("path");
@@ -1239,6 +1298,115 @@ void tst_QFileInfo::refresh()
}
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data()
+{
+ QTest::addColumn<QString>("path");
+ QTest::addColumn<bool>("isSymLink");
+ QTest::addColumn<QString>("linkTarget");
+ QTest::addColumn<QString>("canonicalFilePath");
+
+ QDir pwd;
+ pwd.mkdir("target");
+
+ QLibrary kernel32("kernel32");
+ typedef BOOLEAN (WINAPI *PtrCreateSymbolicLink)(LPCWSTR, LPCWSTR, DWORD);
+ PtrCreateSymbolicLink createSymbolicLinkW = 0;
+ createSymbolicLinkW = (PtrCreateSymbolicLink) kernel32.resolve("CreateSymbolicLinkW");
+ if (!createSymbolicLinkW) {
+ //we need at least one data set for the test not to fail when skipping _data function
+ QDir target("target");
+ QTest::newRow("dummy") << target.path() << false << "" << target.canonicalPath();
+ QSKIP("symbolic links not supported by operating system",SkipSingle);
+ }
+ {
+ //Directory symlinks
+ QDir target("target");
+ QVERIFY(target.exists());
+
+ QString absTarget = QDir::toNativeSeparators(target.absolutePath());
+ QString absSymlink = QDir::toNativeSeparators(pwd.absolutePath()).append("\\abs_symlink");
+ QString relTarget = "target";
+ QString relSymlink = "rel_symlink";
+ QString fileInTarget(absTarget);
+ fileInTarget.append("\\file");
+ QString fileInSymlink(absSymlink);
+ fileInSymlink.append("\\file");
+ QFile file(fileInTarget);
+ file.open(QIODevice::ReadWrite);
+ file.close();
+
+ QVERIFY(pwd.exists("abs_symlink") || createSymbolicLinkW((wchar_t*)absSymlink.utf16(),(wchar_t*)absTarget.utf16(),0x1));
+ QVERIFY(pwd.exists(relSymlink) || createSymbolicLinkW((wchar_t*)relSymlink.utf16(),(wchar_t*)relTarget.utf16(),0x1));
+ QVERIFY(file.exists());
+
+ QTest::newRow("absolute dir symlink") << absSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalPath();
+ QTest::newRow("relative dir symlink") << relSymlink << true << QDir::fromNativeSeparators(relTarget) << target.canonicalPath();
+ QTest::newRow("file in symlink dir") << fileInSymlink << false << "" << target.canonicalPath().append("/file");
+ }
+ {
+ //File symlinks
+ QFileInfo target(SRCDIR "tst_qfileinfo.cpp");
+ QString absTarget = QDir::toNativeSeparators(target.absoluteFilePath());
+ QString absSymlink = QDir::toNativeSeparators(pwd.absolutePath()).append("\\abs_symlink.cpp");
+ QString relTarget = QDir::toNativeSeparators(pwd.relativeFilePath(target.absoluteFilePath()));
+ QString relSymlink = "rel_symlink.cpp";
+ QVERIFY(pwd.exists("abs_symlink.cpp") || createSymbolicLinkW((wchar_t*)absSymlink.utf16(),(wchar_t*)absTarget.utf16(),0x0));
+ QVERIFY(pwd.exists(relSymlink) || createSymbolicLinkW((wchar_t*)relSymlink.utf16(),(wchar_t*)relTarget.utf16(),0x0));
+
+ QTest::newRow("absolute file symlink") << absSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalFilePath();
+ QTest::newRow("relative file symlink") << relSymlink << true << QDir::fromNativeSeparators(relTarget) << target.canonicalFilePath();
+ }
+
+ //Junctions
+ QString target = "target";
+ QString junction = "junction_pwd";
+ FileSystem::createNtfsJunction(target, junction);
+ QFileInfo targetInfo(target);
+ QTest::newRow("junction_pwd") << junction << true << targetInfo.absoluteFilePath() << targetInfo.canonicalFilePath();
+
+ QFileInfo fileInJunction(targetInfo.absoluteFilePath().append("/file"));
+ QFile file(fileInJunction.absoluteFilePath());
+ file.open(QIODevice::ReadWrite);
+ file.close();
+ QVERIFY(file.exists());
+ QTest::newRow("file in junction") << fileInJunction.absoluteFilePath() << false << "" << fileInJunction.canonicalFilePath();
+
+ target = QDir::rootPath();
+ junction = "junction_root";
+ FileSystem::createNtfsJunction(target, junction);
+ targetInfo.setFile(target);
+ QTest::newRow("junction_root") << junction << true << targetInfo.absoluteFilePath() << targetInfo.canonicalFilePath();
+
+ //Mountpoint
+ typedef BOOLEAN (WINAPI *PtrGetVolumeNameForVolumeMountPointW)(LPCWSTR, LPWSTR, DWORD);
+ PtrGetVolumeNameForVolumeMountPointW getVolumeNameForVolumeMountPointW = 0;
+ getVolumeNameForVolumeMountPointW = (PtrGetVolumeNameForVolumeMountPointW) kernel32.resolve("GetVolumeNameForVolumeMountPointW");
+ if(getVolumeNameForVolumeMountPointW)
+ {
+ wchar_t buffer[MAX_PATH];
+ QString rootPath = QDir::toNativeSeparators(QDir::rootPath());
+ QVERIFY(getVolumeNameForVolumeMountPointW((wchar_t*)rootPath.utf16(), buffer, MAX_PATH));
+ QString rootVolume = QString::fromWCharArray(buffer);
+ junction = "mountpoint";
+ rootVolume.replace("\\\\?\\","\\??\\");
+ FileSystem::createNtfsJunction(rootVolume, junction);
+ QTest::newRow("mountpoint") << junction << true << QDir::fromNativeSeparators(rootPath) << QDir::rootPath();
+ }
+}
+
+void tst_QFileInfo::ntfsJunctionPointsAndSymlinks()
+{
+ QFETCH(QString, path);
+ QFETCH(bool, isSymLink);
+ QFETCH(QString, linkTarget);
+ QFETCH(QString, canonicalFilePath);
+
+ QFileInfo fi(path);
+ QCOMPARE(fi.isSymLink(), isSymLink);
+ QCOMPARE(fi.symLinkTarget(), linkTarget);
+ QCOMPARE(fi.canonicalFilePath(), canonicalFilePath);
+}
+
void tst_QFileInfo::brokenShortcut()
{
QString linkName("borkenlink.lnk");
diff --git a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro
index 070eb6a..04cea48 100644
--- a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro
+++ b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro
@@ -9,7 +9,7 @@ symbian: {
HEADERS += ../../../include/qtgui/private/qfileinfogatherer_p.h
# need to deploy something to create the private directory
- dummyDeploy.sources = tst_qfilesystemmodel.cpp
+ dummyDeploy.files = tst_qfilesystemmodel.cpp
dummyDeploy.path = .
DEPLOYMENT += dummyDeploy
LIBS += -lefsrv
diff --git a/tests/auto/qfontdatabase/qfontdatabase.pro b/tests/auto/qfontdatabase/qfontdatabase.pro
index 35811f1..e7dfc3c 100644
--- a/tests/auto/qfontdatabase/qfontdatabase.pro
+++ b/tests/auto/qfontdatabase/qfontdatabase.pro
@@ -3,7 +3,7 @@ SOURCES += tst_qfontdatabase.cpp
!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\"
wince*|symbian {
- additionalFiles.sources = FreeMono.ttf
+ additionalFiles.files = FreeMono.ttf
additionalFiles.path = .
DEPLOYMENT += additionalFiles
}
diff --git a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp
index 357b82e..bddd92a 100644
--- a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp
+++ b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp
@@ -70,6 +70,11 @@ private slots:
void fixedPitch_data();
void fixedPitch();
+#ifdef Q_WS_MAC
+ void trickyFonts_data();
+ void trickyFonts();
+#endif
+
void widthTwoTimes_data();
void widthTwoTimes();
@@ -131,10 +136,16 @@ void tst_QFontDatabase::fixedPitch_data()
QTest::newRow( "Times New Roman" ) << QString( "Times New Roman" ) << false;
QTest::newRow( "Arial" ) << QString( "Arial" ) << false;
- QTest::newRow( "Script" ) << QString( "Script" ) << false;
+ QTest::newRow( "Andale Mono" ) << QString( "Andale Mono" ) << true;
QTest::newRow( "Courier" ) << QString( "Courier" ) << true;
QTest::newRow( "Courier New" ) << QString( "Courier New" ) << true;
+#ifndef Q_WS_MAC
+ QTest::newRow( "Script" ) << QString( "Script" ) << false;
QTest::newRow( "Lucida Console" ) << QString( "Lucida Console" ) << true;
+#else
+ QTest::newRow( "Menlo" ) << QString( "Menlo" ) << true;
+ QTest::newRow( "Monaco" ) << QString( "Monaco" ) << true;
+#endif
}
void tst_QFontDatabase::fixedPitch()
@@ -156,6 +167,28 @@ void tst_QFontDatabase::fixedPitch()
QCOMPARE(fi.fixedPitch(), fixedPitch);
}
+#ifdef Q_WS_MAC
+void tst_QFontDatabase::trickyFonts_data()
+{
+ QTest::addColumn<QString>("font");
+
+ QTest::newRow( "Geeza Pro" ) << QString( "Geeza Pro" );
+}
+
+void tst_QFontDatabase::trickyFonts()
+{
+ QFETCH(QString, font);
+
+ QFontDatabase fdb;
+ if (!fdb.families().contains(font))
+ QSKIP( "Font not installed", SkipSingle);
+
+ QFont qfont(font);
+ QFontInfo fi(qfont);
+ QCOMPARE(fi.family(), font);
+}
+#endif
+
void tst_QFontDatabase::widthTwoTimes_data()
{
QTest::addColumn<QString>("font");
diff --git a/tests/auto/qfontmetrics/qfontmetrics.pro b/tests/auto/qfontmetrics/qfontmetrics.pro
index 51a7057..c0dc1ab 100644
--- a/tests/auto/qfontmetrics/qfontmetrics.pro
+++ b/tests/auto/qfontmetrics/qfontmetrics.pro
@@ -1,4 +1,4 @@
load(qttest_p4)
SOURCES += tst_qfontmetrics.cpp
-
+RESOURCES += testfont.qrc
diff --git a/tests/auto/qfontmetrics/testfont.qrc b/tests/auto/qfontmetrics/testfont.qrc
new file mode 100644
index 0000000..bc0c0b0
--- /dev/null
+++ b/tests/auto/qfontmetrics/testfont.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/fonts">
+ <file>ucs4font.ttf</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
index 41121a5..eda421b 100644
--- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
+++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
@@ -74,6 +74,7 @@ private slots:
void bypassShaping();
void elidedMultiLength();
void elidedMultiLengthF();
+ void inFontUcs4();
void lineWidth();
};
@@ -267,6 +268,27 @@ void tst_QFontMetrics::elidedMultiLengthF()
elidedMultiLength_helper<QFontMetricsF>();
}
+void tst_QFontMetrics::inFontUcs4()
+{
+ int id = QFontDatabase::addApplicationFont(":/fonts/ucs4font.ttf");
+ QVERIFY(id >= 0);
+
+ QFont font("QtTestUcs4");
+ {
+ QFontMetrics fm(font);
+
+ QVERIFY(fm.inFontUcs4(0x1D7FF));
+ }
+
+ {
+ QFontMetricsF fm(font);
+
+ QVERIFY(fm.inFontUcs4(0x1D7FF));
+ }
+
+ QFontDatabase::removeApplicationFont(id);
+}
+
void tst_QFontMetrics::lineWidth()
{
// QTBUG-13009, QTBUG-13011
diff --git a/tests/auto/qfontmetrics/ucs4font.ttf b/tests/auto/qfontmetrics/ucs4font.ttf
new file mode 100644
index 0000000..31b6997
--- /dev/null
+++ b/tests/auto/qfontmetrics/ucs4font.ttf
Binary files differ
diff --git a/tests/auto/qftp/qftp.pro b/tests/auto/qftp/qftp.pro
index 9618962..ac1702e 100644
--- a/tests/auto/qftp/qftp.pro
+++ b/tests/auto/qftp/qftp.pro
@@ -5,12 +5,12 @@ SOURCES += tst_qftp.cpp
QT = core network
wince*: {
- addFiles.sources = rfc3252.txt
+ addFiles.files = rfc3252.txt
addFiles.path = .
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\"\\\"
} else:symbian {
- addFiles.sources = rfc3252.txt
+ addFiles.files = rfc3252.txt
addFiles.path = .
DEPLOYMENT += addFiles
TARGET.EPOCHEAPSIZE="0x100 0x1000000"
diff --git a/tests/auto/qfuturewatcher/tst_qfuturewatcher.cpp b/tests/auto/qfuturewatcher/tst_qfuturewatcher.cpp
index c53c67a..54463c9 100644
--- a/tests/auto/qfuturewatcher/tst_qfuturewatcher.cpp
+++ b/tests/auto/qfuturewatcher/tst_qfuturewatcher.cpp
@@ -47,6 +47,7 @@
#include <qfuturewatcher.h>
#include <qtconcurrentrun.h>
#include <qtconcurrentmap.h>
+#include "../../shared/util.h"
#ifndef QT_NO_CONCURRENT_TEST
#include <private/qfutureinterface_p.h>
@@ -81,6 +82,7 @@ private slots:
void incrementalMapResults();
void incrementalFilterResults();
void qfutureSynchornizer();
+ void warnRace();
};
QTEST_MAIN(tst_QFutureWatcher)
@@ -466,12 +468,12 @@ void tst_QFutureWatcher::toMuchProgress()
ProgressObject o;
QFutureWatcher<void> f;
- f.setFuture((new ProgressEmitterTask())->start());
QObject::connect(&f, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
#ifdef PRINT
QObject::connect(&f, SIGNAL(progressValueChanged(int)), &o, SLOT(printProgress(int)));
#endif
QObject::connect(&f, SIGNAL(progressValueChanged(int)), &o, SLOT(registerProgress(int)));
+ f.setFuture((new ProgressEmitterTask())->start());
QTestEventLoop::instance().enterLoop(5);
QVERIFY(!QTestEventLoop::instance().timeout());
@@ -886,6 +888,37 @@ void tst_QFutureWatcher::qfutureSynchornizer()
QVERIFY(t.elapsed() < taskCount * 10);
}
+class DummyObject : public QObject {
+ Q_OBJECT
+public slots:
+ void dummySlot() {}
+public:
+ static void function(QMutex *m)
+ {
+ QMutexLocker lock(m);
+ }
+};
+
+void tst_QFutureWatcher::warnRace()
+{
+#ifndef Q_OS_MAC //I don't know why it is not working on mac
+#ifndef QT_NO_DEBUG
+ QTest::ignoreMessage(QtWarningMsg, "QFutureWatcher::connect: connecting after calling setFuture() is likely to produce race");
+#endif
+#endif
+ QFutureWatcher<void> watcher;
+ DummyObject object;
+ QMutex mutex;
+ mutex.lock();
+
+ QFuture<void> future = QtConcurrent::run(DummyObject::function, &mutex);
+ watcher.setFuture(future);
+ QTRY_VERIFY(future.isStarted());
+ connect(&watcher, SIGNAL(finished()), &object, SLOT(dummySlot()));
+ mutex.unlock();
+ future.waitForFinished();
+}
+
#include "tst_qfuturewatcher.moc"
#else
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index e411508..dfcfb47 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -1872,11 +1872,10 @@ void tst_QGL::destroyFBOAfterContext()
#ifdef QT_BUILD_INTERNAL
-class tst_QGLResource : public QObject
+class tst_QGLResource
{
- Q_OBJECT
public:
- tst_QGLResource(QObject *parent = 0) : QObject(parent) {}
+ tst_QGLResource(const QGLContext * = 0) {}
~tst_QGLResource() { ++deletions; }
static int deletions;
@@ -1884,12 +1883,7 @@ public:
int tst_QGLResource::deletions = 0;
-static void qt_shared_test_free(void *data)
-{
- delete reinterpret_cast<tst_QGLResource *>(data);
-}
-
-Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_shared_test, (qt_shared_test_free))
+Q_GLOBAL_STATIC(QGLContextGroupResource<tst_QGLResource>, qt_shared_test)
#endif
@@ -1909,10 +1903,9 @@ void tst_QGL::shareRegister()
guard.setId(3);
QVERIFY(guard.id() == 3);
- // Add a resource to the first context.
- tst_QGLResource *res1 = new tst_QGLResource();
- QVERIFY(!qt_shared_test()->value(glw1->context()));
- qt_shared_test()->insert(glw1->context(), res1);
+ // Request a tst_QGLResource object for the first context.
+ tst_QGLResource *res1 = qt_shared_test()->value(glw1->context());
+ QVERIFY(res1);
QVERIFY(qt_shared_test()->value(glw1->context()) == res1);
// Create another context that shares with the first.
@@ -1951,10 +1944,9 @@ void tst_QGL::shareRegister()
QGLSharedResourceGuard guard3(glw3->context());
guard3.setId(5);
- // Add a resource to the third context.
- tst_QGLResource *res3 = new tst_QGLResource();
- QVERIFY(!qt_shared_test()->value(glw3->context()));
- qt_shared_test()->insert(glw3->context(), res3);
+ // Request a resource to the third context.
+ tst_QGLResource *res3 = qt_shared_test()->value(glw3->context());
+ QVERIFY(res3);
QVERIFY(qt_shared_test()->value(glw1->context()) == res1);
QVERIFY(qt_shared_test()->value(glw2->context()) == res1);
QVERIFY(qt_shared_test()->value(glw3->context()) == res3);
diff --git a/tests/auto/qglfunctions/qglfunctions.pro b/tests/auto/qglfunctions/qglfunctions.pro
new file mode 100644
index 0000000..aa81547
--- /dev/null
+++ b/tests/auto/qglfunctions/qglfunctions.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+requires(contains(QT_CONFIG,opengl))
+QT += opengl
+
+win32:!wince*: DEFINES += QT_NO_EGL
+
+SOURCES += tst_qglfunctions.cpp
diff --git a/tests/auto/qglfunctions/tst_qglfunctions.cpp b/tests/auto/qglfunctions/tst_qglfunctions.cpp
new file mode 100644
index 0000000..73e63b5
--- /dev/null
+++ b/tests/auto/qglfunctions/tst_qglfunctions.cpp
@@ -0,0 +1,244 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenGL module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtOpenGL/qglfunctions.h>
+
+class tst_QGLFunctions : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QGLFunctions() {}
+ ~tst_QGLFunctions() {}
+
+private slots:
+ void features();
+ void multitexture();
+ void blendColor();
+
+private:
+ static bool hasExtension(const char *name);
+};
+
+bool tst_QGLFunctions::hasExtension(const char *name)
+{
+ QString extensions =
+ QString::fromLatin1
+ (reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)));
+ return extensions.split(QLatin1Char(' ')).contains
+ (QString::fromLatin1(name));
+}
+
+// Check that the reported features are consistent with the platform.
+void tst_QGLFunctions::features()
+{
+ // Before being associated with a context, there should be
+ // no features enabled.
+ QGLFunctions funcs;
+ QVERIFY(!funcs.openGLFeatures());
+ QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::Multitexture));
+ QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::Shaders));
+ QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::Buffers));
+ QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::Framebuffers));
+ QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::BlendColor));
+ QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::BlendEquation));
+ QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::BlendEquationSeparate));
+ QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::BlendFuncSeparate));
+ QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::BlendSubtract));
+ QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::CompressedTextures));
+ QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::Multisample));
+ QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::StencilSeparate));
+ QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures));
+
+ // Make a context current.
+ QGLWidget glw;
+ if (!glw.isValid())
+ QSKIP("Could not create a GL context", SkipAll);
+ glw.makeCurrent();
+ funcs.initializeGLFunctions();
+
+ // Validate the features against what we expect for this platform.
+#if defined(QT_OPENGL_ES_2)
+ QGLFunctions::OpenGLFeatures allFeatures =
+ (QGLFunctions::Multitexture |
+ QGLFunctions::Shaders |
+ QGLFunctions::Buffers |
+ QGLFunctions::Framebuffers |
+ QGLFunctions::BlendColor |
+ QGLFunctions::BlendEquation |
+ QGLFunctions::BlendEquationSeparate |
+ QGLFunctions::BlendFuncSeparate |
+ QGLFunctions::BlendSubtract |
+ QGLFunctions::CompressedTextures |
+ QGLFunctions::Multisample |
+ QGLFunctions::StencilSeparate |
+ QGLFunctions::NPOTTextures);
+ QVERIFY((funcs.openGLFeatures() & allFeatures) == allFeatures);
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Multitexture));
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Shaders));
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Buffers));
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Framebuffers));
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendColor));
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendEquation));
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendEquationSeparate));
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendFuncSeparate));
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendSubtract));
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::CompressedTextures));
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Multisample));
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::StencilSeparate));
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures));
+#elif defined(QT_OPENGL_ES)
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Multitexture));
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Buffers));
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::CompressedTextures));
+ QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Multisample));
+
+ QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::Shaders));
+ QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::BlendColor));
+ QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::StencilSeparate));
+
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Framebuffers),
+ hasExtension("GL_OES_framebuffer_object"));
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendEquationSeparate),
+ hasExtension("GL_OES_blend_equation_separate"));
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendFuncSeparate),
+ hasExtension("GL_OES_blend_func_separate"));
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendSubtract),
+ hasExtension("GL_OES_blend_subtract"));
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures),
+ hasExtension("GL_OES_texture_npot"));
+#else
+ // We check for both the extension name and the minimum OpenGL version
+ // for the feature. This will help us catch situations where a platform
+ // doesn't list an extension by name but does have the feature by virtue
+ // of its version number.
+ QGLFormat::OpenGLVersionFlags versions = QGLFormat::openGLVersionFlags();
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Multitexture),
+ hasExtension("GL_ARB_multitexture") ||
+ (versions & QGLFormat::OpenGL_Version_1_3) != 0);
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Shaders),
+ hasExtension("GL_ARB_shader_objects") ||
+ (versions & QGLFormat::OpenGL_Version_2_0) != 0);
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Buffers),
+ (versions & QGLFormat::OpenGL_Version_1_5) != 0);
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Framebuffers),
+ hasExtension("GL_EXT_framebuffer_object") ||
+ hasExtension("GL_ARB_framebuffer_object"));
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendColor),
+ hasExtension("GL_EXT_blend_color") ||
+ (versions & QGLFormat::OpenGL_Version_1_2) != 0);
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendEquation),
+ (versions & QGLFormat::OpenGL_Version_1_2) != 0);
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendEquationSeparate),
+ hasExtension("GL_EXT_blend_equation_separate") ||
+ (versions & QGLFormat::OpenGL_Version_2_0) != 0);
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendFuncSeparate),
+ hasExtension("GL_EXT_blend_func_separate") ||
+ (versions & QGLFormat::OpenGL_Version_1_4) != 0);
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendSubtract),
+ hasExtension("GL_EXT_blend_subtract"));
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::CompressedTextures),
+ hasExtension("GL_ARB_texture_compression") ||
+ (versions & QGLFormat::OpenGL_Version_1_3) != 0);
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Multisample),
+ hasExtension("GL_ARB_multisample") ||
+ (versions & QGLFormat::OpenGL_Version_1_3) != 0);
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::StencilSeparate),
+ (versions & QGLFormat::OpenGL_Version_2_0) != 0);
+ QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures),
+ hasExtension("GL_ARB_texture_non_power_of_two") ||
+ (versions & QGLFormat::OpenGL_Version_2_0) != 0);
+#endif
+}
+
+// Verify that the multitexture functions appear to resolve and work.
+void tst_QGLFunctions::multitexture()
+{
+ QGLFunctions funcs;
+ QGLWidget glw;
+ if (!glw.isValid())
+ QSKIP("Could not create a GL context", SkipAll);
+ glw.makeCurrent();
+ funcs.initializeGLFunctions();
+
+ if (!funcs.hasOpenGLFeature(QGLFunctions::Multitexture))
+ QSKIP("Multitexture functions are not supported", SkipSingle);
+
+ funcs.glActiveTexture(GL_TEXTURE1);
+
+ GLint active = 0;
+ glGetIntegerv(GL_ACTIVE_TEXTURE, &active);
+ QVERIFY(active == GL_TEXTURE1);
+
+ funcs.glActiveTexture(GL_TEXTURE0);
+
+ active = 0;
+ glGetIntegerv(GL_ACTIVE_TEXTURE, &active);
+ QVERIFY(active == GL_TEXTURE0);
+}
+
+// Verify that the glBlendColor() function appears to resolve and work.
+void tst_QGLFunctions::blendColor()
+{
+ QGLFunctions funcs;
+ QGLWidget glw;
+ if (!glw.isValid())
+ QSKIP("Could not create a GL context", SkipAll);
+ glw.makeCurrent();
+ funcs.initializeGLFunctions();
+
+ if (!funcs.hasOpenGLFeature(QGLFunctions::BlendColor))
+ QSKIP("glBlendColor() is not supported", SkipSingle);
+
+ funcs.glBlendColor(0.0f, 1.0f, 0.0f, 1.0f);
+
+ GLfloat colors[4] = {0.5f, 0.5f, 0.5f, 0.5f};
+ glGetFloatv(GL_BLEND_COLOR, colors);
+
+ QCOMPARE(colors[0], 0.0f);
+ QCOMPARE(colors[1], 1.0f);
+ QCOMPARE(colors[2], 0.0f);
+ QCOMPARE(colors[3], 1.0f);
+}
+
+QTEST_MAIN(tst_QGLFunctions)
+
+#include "tst_qglfunctions.moc"
diff --git a/tests/auto/qglthreads/tst_qglthreads.cpp b/tests/auto/qglthreads/tst_qglthreads.cpp
index 06131bd..9441406 100644
--- a/tests/auto/qglthreads/tst_qglthreads.cpp
+++ b/tests/auto/qglthreads/tst_qglthreads.cpp
@@ -45,10 +45,6 @@
#include <QtOpenGL/QtOpenGL>
#include "tst_qglthreads.h"
-#ifdef Q_WS_X11
-#include <private/qt_x11_p.h>
-#endif
-
#ifdef Q_OS_SYMBIAN
#include <unistd.h> // for usleep
#endif
@@ -60,8 +56,6 @@ tst_QGLThreads::tst_QGLThreads(QObject *parent)
{
}
-
-
/*
swapInThread
@@ -344,6 +338,7 @@ void renderAScene(int w, int h)
class ThreadSafeGLWidget : public QGLWidget
{
public:
+ ThreadSafeGLWidget(QWidget *parent = 0) : QGLWidget(parent) {}
void paintEvent(QPaintEvent *)
{
// ignored as we're anyway swapping as fast as we can
@@ -431,7 +426,7 @@ void tst_QGLThreads::renderInThread_data()
void tst_QGLThreads::renderInThread()
{
#ifdef Q_OS_MAC
- QSKIP("OpenGL threading tests are currently disabled on mac as they were causing reboots", SkipAll);
+ QSKIP("OpenGL threading tests are currently disabled on Mac as they were causing reboots", SkipAll);
#endif
QFETCH(bool, resize);
@@ -466,15 +461,301 @@ void tst_QGLThreads::renderInThread()
QVERIFY(!thread.failure);
}
+class Device
+{
+public:
+ virtual ~Device() {}
+ virtual QPaintDevice *realPaintDevice() = 0;
+ virtual void prepareDevice() {}
+};
+
+class GLWidgetWrapper : public Device
+{
+public:
+ GLWidgetWrapper() {
+ widget.resize(150, 150);
+ widget.show();
+ QTest::qWaitForWindowShown(&widget);
+ widget.doneCurrent();
+ }
+ QPaintDevice *realPaintDevice() { return &widget; }
+ ThreadSafeGLWidget widget;
+};
+class PixmapWrapper : public Device
+{
+public:
+ PixmapWrapper() { pixmap = new QPixmap(512, 512); }
+ ~PixmapWrapper() { delete pixmap; }
+ QPaintDevice *realPaintDevice() { return pixmap; }
-int main(int argc, char **argv)
+ QPixmap *pixmap;
+};
+
+class PixelBufferWrapper : public Device
+{
+public:
+ PixelBufferWrapper() { pbuffer = new QGLPixelBuffer(512, 512); }
+ ~PixelBufferWrapper() { delete pbuffer; }
+ QPaintDevice *realPaintDevice() { return pbuffer; }
+
+ QGLPixelBuffer *pbuffer;
+};
+
+
+class FrameBufferObjectWrapper : public Device
+{
+public:
+ FrameBufferObjectWrapper() {
+ widget.makeCurrent();
+ fbo = new QGLFramebufferObject(512, 512);
+ widget.doneCurrent();
+ }
+ ~FrameBufferObjectWrapper() { delete fbo; }
+ QPaintDevice *realPaintDevice() { return fbo; }
+ void prepareDevice() { widget.makeCurrent(); }
+
+ ThreadSafeGLWidget widget;
+ QGLFramebufferObject *fbo;
+};
+
+
+class ThreadPainter : public QObject
+{
+ Q_OBJECT
+public:
+ ThreadPainter(Device *pd) : device(pd), fail(true) {
+ pixmap = QPixmap(40, 40);
+ pixmap.fill(Qt::green);
+ QPainter p(&pixmap);
+ p.drawLine(0, 0, 40, 40);
+ p.drawLine(0, 40, 40, 0);
+ }
+
+public slots:
+ void draw() {
+ bool beginFailed = false;
+ QTime time;
+ time.start();
+ int rotAngle = 10;
+ device->prepareDevice();
+ QPaintDevice *paintDevice = device->realPaintDevice();
+ QSize s(paintDevice->width(), paintDevice->height());
+ while (time.elapsed() < RUNNING_TIME) {
+ QPainter p;
+ if (!p.begin(paintDevice)) {
+ beginFailed = true;
+ break;
+ }
+ p.translate(s.width()/2, s.height()/2);
+ p.rotate(rotAngle);
+ p.translate(-s.width()/2, -s.height()/2);
+ p.fillRect(0, 0, s.width(), s.height(), Qt::red);
+ QRect rect(QPoint(0, 0), s);
+ p.drawPixmap(10, 10, pixmap);
+ p.drawTiledPixmap(50, 50, 100, 100, pixmap);
+ p.drawText(rect.center(), "This is a piece of text");
+ p.end();
+ rotAngle += 2;
+#ifdef Q_WS_WIN
+ Sleep(20);
+#else
+ usleep(20 * 1000);
+#endif
+ }
+
+ fail = beginFailed;
+ QThread::currentThread()->quit();
+ }
+
+ bool failed() { return fail; }
+
+private:
+ QPixmap pixmap;
+ Device *device;
+ bool fail;
+};
+
+template <class T>
+class PaintThreadManager
+{
+public:
+ PaintThreadManager(int count) : numThreads(count)
+ {
+ for (int i=0; i<numThreads; ++i) {
+ devices.append(new T);
+ threads.append(new QThread);
+ painters.append(new ThreadPainter(devices.at(i)));
+ painters.at(i)->moveToThread(threads.at(i));
+ painters.at(i)->connect(threads.at(i), SIGNAL(started()), painters.at(i), SLOT(draw()));
+ }
+ }
+
+ ~PaintThreadManager() {
+ qDeleteAll(threads);
+ qDeleteAll(painters);
+ qDeleteAll(devices);
+ }
+
+
+ void start() {
+ for (int i=0; i<numThreads; ++i)
+ threads.at(i)->start();
+ }
+
+ bool areRunning() {
+ bool running = false;
+ for (int i=0; i<numThreads; ++i){
+ if (threads.at(i)->isRunning())
+ running = true;
+ }
+
+ return running;
+ }
+
+ bool failed() {
+ for (int i=0; i<numThreads; ++i) {
+ if (painters.at(i)->failed())
+ return true;
+ }
+
+ return false;
+ }
+
+private:
+ QList<QThread *> threads;
+ QList<Device *> devices;
+ QList<ThreadPainter *> painters;
+ int numThreads;
+};
+
+/*
+ This test uses QPainter to draw onto different QGLWidgets in
+ different threads at the same time. The ThreadSafeGLWidget is
+ necessary to handle paint and resize events that might come from
+ the main thread at any time while the test is running. The resize
+ and paint events would cause makeCurrent() calls to be issued from
+ within the QGLWidget while the widget's context was current in
+ another thread, which would cause errors.
+*/
+void tst_QGLThreads::painterOnGLWidgetInThread()
+{
+#ifdef Q_OS_MAC
+ QSKIP("OpenGL threading tests are currently disabled on Mac as they were causing reboots", SkipAll);
+#endif
+ if (!((QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0) ||
+ (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0))) {
+ QSKIP("The OpenGL based threaded QPainter tests requires OpenGL/ES 2.0.", SkipAll);
+ }
+
+ PaintThreadManager<GLWidgetWrapper> painterThreads(5);
+ painterThreads.start();
+
+ while (painterThreads.areRunning()) {
+ qApp->processEvents();
+#ifdef Q_WS_WIN
+ Sleep(100);
+#else
+ usleep(100 * 1000);
+#endif
+ }
+ QVERIFY(!painterThreads.failed());
+}
+
+/*
+ This test uses QPainter to draw onto different QPixmaps in
+ different threads at the same time.
+*/
+void tst_QGLThreads::painterOnPixmapInThread()
{
#ifdef Q_WS_X11
- XInitThreads();
+ QSKIP("Drawing text in threads onto X11 drawables currently crashes on some X11 servers.", SkipAll);
+#endif
+ PaintThreadManager<PixmapWrapper> painterThreads(5);
+ painterThreads.start();
+
+ while (painterThreads.areRunning()) {
+ qApp->processEvents();
+#ifdef Q_WS_WIN
+ Sleep(100);
+#else
+ usleep(100 * 1000);
+#endif
+ }
+ QVERIFY(!painterThreads.failed());
+}
+
+/* This test uses QPainter to draw onto different QGLPixelBuffer
+ objects in different threads at the same time.
+*/
+void tst_QGLThreads::painterOnPboInThread()
+{
+#ifdef Q_OS_MAC
+ QSKIP("OpenGL threading tests are currently disabled on Mac as they were causing reboots", SkipAll);
+#endif
+ if (!((QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0) ||
+ (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0))) {
+ QSKIP("The OpenGL based threaded QPainter tests requires OpenGL/ES 2.0.", SkipAll);
+ return;
+ }
+
+ if (!QGLPixelBuffer::hasOpenGLPbuffers()) {
+ QSKIP("This system doesn't support pbuffers.", SkipAll);
+ return;
+ }
+
+ PaintThreadManager<PixelBufferWrapper> painterThreads(5);
+ painterThreads.start();
+
+ while (painterThreads.areRunning()) {
+ qApp->processEvents();
+#ifdef Q_WS_WIN
+ Sleep(100);
+#else
+ usleep(100 * 1000);
#endif
+ }
+ QVERIFY(!painterThreads.failed());
+}
+/* This test uses QPainter to draw onto different
+ QGLFramebufferObjects (bound in a QGLWidget's context) in different
+ threads at the same time.
+*/
+void tst_QGLThreads::painterOnFboInThread()
+{
+#ifdef Q_OS_MAC
+ QSKIP("OpenGL threading tests are currently disabled on Mac as they were causing reboots", SkipAll);
+#endif
+ if (!((QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0) ||
+ (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0))) {
+ QSKIP("The OpenGL based threaded QPainter tests requires OpenGL/ES 2.0.", SkipAll);
+ return;
+ }
+
+ if (!QGLFramebufferObject::hasOpenGLFramebufferObjects()) {
+ QSKIP("This system doesn't support framebuffer objects.", SkipAll);
+ return;
+ }
+
+ PaintThreadManager<FrameBufferObjectWrapper> painterThreads(5);
+ painterThreads.start();
+
+ while (painterThreads.areRunning()) {
+ qApp->processEvents();
+#ifdef Q_WS_WIN
+ Sleep(100);
+#else
+ usleep(100 * 1000);
+#endif
+ }
+ QVERIFY(!painterThreads.failed());
+}
+
+int main(int argc, char **argv)
+{
+ QApplication::setAttribute(Qt::AA_X11InitThreads);
QApplication app(argc, argv);
QTEST_DISABLE_KEYPAD_NAVIGATION \
diff --git a/tests/auto/qglthreads/tst_qglthreads.h b/tests/auto/qglthreads/tst_qglthreads.h
index 9e97909..a8c2963 100644
--- a/tests/auto/qglthreads/tst_qglthreads.h
+++ b/tests/auto/qglthreads/tst_qglthreads.h
@@ -56,6 +56,10 @@ private slots:
void renderInThread_data();
void renderInThread();
+ void painterOnGLWidgetInThread();
+ void painterOnPixmapInThread();
+ void painterOnPboInThread();
+ void painterOnFboInThread();
};
#endif // TST_QGLTHREADS_H
diff --git a/tests/auto/qglyphs/qglyphs.pro b/tests/auto/qglyphs/qglyphs.pro
new file mode 100644
index 0000000..5084cf9
--- /dev/null
+++ b/tests/auto/qglyphs/qglyphs.pro
@@ -0,0 +1,11 @@
+load(qttest_p4)
+QT = core gui
+
+SOURCES += \
+ tst_qglyphs.cpp
+
+wince*|symbian*: {
+ DEFINES += SRCDIR=\\\"\\\"
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
+} \ No newline at end of file
diff --git a/tests/auto/qglyphs/test.ttf b/tests/auto/qglyphs/test.ttf
new file mode 100644
index 0000000..9043a57
--- /dev/null
+++ b/tests/auto/qglyphs/test.ttf
Binary files differ
diff --git a/tests/auto/qglyphs/tst_qglyphs.cpp b/tests/auto/qglyphs/tst_qglyphs.cpp
new file mode 100644
index 0000000..da91063
--- /dev/null
+++ b/tests/auto/qglyphs/tst_qglyphs.cpp
@@ -0,0 +1,573 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <qglyphs.h>
+#include <qpainter.h>
+#include <qtextlayout.h>
+#include <qfontdatabase.h>
+
+// #define DEBUG_SAVE_IMAGE
+
+class tst_QGlyphs: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+
+ void constructionAndDestruction();
+ void copyConstructor();
+ void assignment();
+ void equalsOperator_data();
+ void equalsOperator();
+ void textLayoutGlyphIndexes();
+ void drawExistingGlyphs();
+ void drawNonExistentGlyphs();
+ void drawMultiScriptText1();
+ void drawMultiScriptText2();
+ void drawStruckOutText();
+ void drawOverlinedText();
+ void drawUnderlinedText();
+ void drawRightToLeft();
+ void detach();
+
+private:
+ int m_testFontId;
+ QFont m_testFont;
+};
+
+Q_DECLARE_METATYPE(QGlyphs);
+
+void tst_QGlyphs::initTestCase()
+{
+ m_testFontId = QFontDatabase::addApplicationFont(SRCDIR "test.ttf");
+ QVERIFY(m_testFontId >= 0);
+
+ m_testFont = QFont("QtsSpecialTestFont");
+
+ QCOMPARE(QFontInfo(m_testFont).family(), QString::fromLatin1("QtsSpecialTestFont"));
+}
+
+void tst_QGlyphs::cleanupTestCase()
+{
+ QFontDatabase::removeApplicationFont(m_testFontId);
+}
+
+void tst_QGlyphs::constructionAndDestruction()
+{
+ QGlyphs glyphIndexes;
+}
+
+static QGlyphs make_dummy_indexes()
+{
+ QGlyphs glyphs;
+
+ QVector<quint32> glyphIndexes;
+ QVector<QPointF> positions;
+ QFont font;
+ font.setPointSize(18);
+
+ glyphIndexes.append(1);
+ glyphIndexes.append(2);
+ glyphIndexes.append(3);
+
+ positions.append(QPointF(1, 2));
+ positions.append(QPointF(3, 4));
+ positions.append(QPointF(5, 6));
+
+ glyphs.setFont(font);
+ glyphs.setGlyphIndexes(glyphIndexes);
+ glyphs.setPositions(positions);
+
+ return glyphs;
+}
+
+void tst_QGlyphs::copyConstructor()
+{
+ QGlyphs glyphs;
+
+ {
+ QVector<quint32> glyphIndexes;
+ QVector<QPointF> positions;
+ QFont font;
+ font.setPointSize(18);
+
+ glyphIndexes.append(1);
+ glyphIndexes.append(2);
+ glyphIndexes.append(3);
+
+ positions.append(QPointF(1, 2));
+ positions.append(QPointF(3, 4));
+ positions.append(QPointF(5, 6));
+
+ glyphs.setFont(font);
+ glyphs.setGlyphIndexes(glyphIndexes);
+ glyphs.setPositions(positions);
+ }
+
+ QGlyphs otherGlyphs(glyphs);
+ QCOMPARE(otherGlyphs.font(), glyphs.font());
+ QCOMPARE(glyphs.glyphIndexes(), otherGlyphs.glyphIndexes());
+ QCOMPARE(glyphs.positions(), otherGlyphs.positions());
+}
+
+void tst_QGlyphs::assignment()
+{
+ QGlyphs glyphs(make_dummy_indexes());
+
+ QGlyphs otherGlyphs = glyphs;
+ QCOMPARE(otherGlyphs.font(), glyphs.font());
+ QCOMPARE(glyphs.glyphIndexes(), otherGlyphs.glyphIndexes());
+ QCOMPARE(glyphs.positions(), otherGlyphs.positions());
+}
+
+void tst_QGlyphs::equalsOperator_data()
+{
+ QTest::addColumn<QGlyphs>("one");
+ QTest::addColumn<QGlyphs>("two");
+ QTest::addColumn<bool>("equals");
+
+ QGlyphs one(make_dummy_indexes());
+ QGlyphs two(make_dummy_indexes());
+
+ QTest::newRow("Identical") << one << two << true;
+
+ {
+ QGlyphs busted(two);
+
+ QVector<QPointF> positions = busted.positions();
+ positions[2] += QPointF(1, 1);
+ busted.setPositions(positions);
+
+ QTest::newRow("Different positions") << one << busted << false;
+ }
+
+ {
+ QGlyphs busted(two);
+ QFont font = busted.font();
+ font.setPointSize(font.pointSize() * 2);
+ busted.setFont(font);
+
+ QTest::newRow("Different fonts") << one << busted << false;
+ }
+
+ {
+ QGlyphs busted(two);
+
+ QVector<quint32> glyphIndexes = busted.glyphIndexes();
+ glyphIndexes[2] += 1;
+ busted.setGlyphIndexes(glyphIndexes);
+
+ QTest::newRow("Different glyph indexes") << one << busted << false;
+ }
+
+}
+
+void tst_QGlyphs::equalsOperator()
+{
+ QFETCH(QGlyphs, one);
+ QFETCH(QGlyphs, two);
+ QFETCH(bool, equals);
+
+ QCOMPARE(one == two, equals);
+ QCOMPARE(one != two, !equals);
+}
+
+
+void tst_QGlyphs::textLayoutGlyphIndexes()
+{
+ QString s;
+ s.append(QLatin1Char('A'));
+ s.append(QChar(0xe000));
+
+ QTextLayout layout(s);
+ layout.setFont(m_testFont);
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ QList<QGlyphs> listOfGlyphs = layout.glyphs();
+ QCOMPARE(listOfGlyphs.size(), 1);
+
+ QGlyphs glyphs = listOfGlyphs.at(0);
+
+ QCOMPARE(glyphs.glyphIndexes().size(), 2);
+ QCOMPARE(glyphs.glyphIndexes().at(0), quint32(2));
+ QCOMPARE(glyphs.glyphIndexes().at(1), quint32(1));
+}
+
+void tst_QGlyphs::drawExistingGlyphs()
+{
+ QPixmap textLayoutDraw(1000, 1000);
+ QPixmap drawGlyphs(1000, 1000);
+
+ textLayoutDraw.fill(Qt::white);
+ drawGlyphs.fill(Qt::white);
+
+ QString s;
+ s.append(QLatin1Char('A'));
+ s.append(QChar(0xe000));
+
+ QTextLayout layout(s);
+ layout.setFont(m_testFont);
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ {
+ QPainter p(&textLayoutDraw);
+ layout.draw(&p, QPointF(50, 50));
+ }
+
+ QGlyphs glyphs = layout.glyphs().size() > 0
+ ? layout.glyphs().at(0)
+ : QGlyphs();
+
+ {
+ QPainter p(&drawGlyphs);
+ p.drawGlyphs(QPointF(50, 50), glyphs);
+ }
+
+#if defined(DEBUG_SAVE_IMAGE)
+ textLayoutDraw.save("drawExistingGlyphs_textLayoutDraw.png");
+ drawGlyphs.save("drawExistingGlyphs_drawGlyphIndexes.png");
+#endif
+
+ QCOMPARE(textLayoutDraw, drawGlyphs);
+}
+
+void tst_QGlyphs::drawNonExistentGlyphs()
+{
+ QVector<quint32> glyphIndexes;
+ glyphIndexes.append(3);
+
+ QVector<QPointF> glyphPositions;
+ glyphPositions.append(QPointF(0, 0));
+
+ QGlyphs glyphs;
+ glyphs.setGlyphIndexes(glyphIndexes);
+ glyphs.setPositions(glyphPositions);
+ glyphs.setFont(m_testFont);
+
+ QPixmap image(1000, 1000);
+ image.fill(Qt::white);
+
+ QPixmap imageBefore = image;
+ {
+ QPainter p(&image);
+ p.drawGlyphs(QPointF(50, 50), glyphs);
+ }
+
+#if defined(DEBUG_SAVE_IMAGE)
+ image.save("drawNonExistentGlyphs.png");
+#endif
+
+ QCOMPARE(image, imageBefore); // Should be unchanged
+}
+
+void tst_QGlyphs::drawMultiScriptText1()
+{
+ QString text;
+ text += QChar(0x03D0); // Greek, beta
+
+ QTextLayout textLayout(text);
+ textLayout.beginLayout();
+ textLayout.createLine();
+ textLayout.endLayout();
+
+ QPixmap textLayoutDraw(1000, 1000);
+ textLayoutDraw.fill(Qt::white);
+
+ QPixmap drawGlyphs(1000, 1000);
+ drawGlyphs.fill(Qt::white);
+
+ QList<QGlyphs> glyphsList = textLayout.glyphs();
+ QCOMPARE(glyphsList.size(), 1);
+
+ {
+ QPainter p(&textLayoutDraw);
+ textLayout.draw(&p, QPointF(50, 50));
+ }
+
+ {
+ QPainter p(&drawGlyphs);
+ foreach (QGlyphs glyphs, glyphsList)
+ p.drawGlyphs(QPointF(50, 50), glyphs);
+ }
+
+#if defined(DEBUG_SAVE_IMAGE)
+ textLayoutDraw.save("drawMultiScriptText1_textLayoutDraw.png");
+ drawGlyphs.save("drawMultiScriptText1_drawGlyphIndexes.png");
+#endif
+
+ QCOMPARE(drawGlyphs, textLayoutDraw);
+}
+
+
+void tst_QGlyphs::drawMultiScriptText2()
+{
+ QString text;
+ text += QChar(0x0621); // Arabic, Hamza
+ text += QChar(0x03D0); // Greek, beta
+
+ QTextLayout textLayout(text);
+ textLayout.beginLayout();
+ textLayout.createLine();
+ textLayout.endLayout();
+
+ QPixmap textLayoutDraw(1000, 1000);
+ textLayoutDraw.fill(Qt::white);
+
+ QPixmap drawGlyphs(1000, 1000);
+ drawGlyphs.fill(Qt::white);
+
+ QList<QGlyphs> glyphsList = textLayout.glyphs();
+ QCOMPARE(glyphsList.size(), 2);
+
+ {
+ QPainter p(&textLayoutDraw);
+ textLayout.draw(&p, QPointF(50, 50));
+ }
+
+ {
+ QPainter p(&drawGlyphs);
+ foreach (QGlyphs glyphs, glyphsList)
+ p.drawGlyphs(QPointF(50, 50), glyphs);
+ }
+
+#if defined(DEBUG_SAVE_IMAGE)
+ textLayoutDraw.save("drawMultiScriptText2_textLayoutDraw.png");
+ drawGlyphs.save("drawMultiScriptText2_drawGlyphIndexes.png");
+#endif
+
+ QCOMPARE(drawGlyphs, textLayoutDraw);
+}
+
+void tst_QGlyphs::detach()
+{
+ QGlyphs glyphs;
+
+ glyphs.setGlyphIndexes(QVector<quint32>() << 1 << 2 << 3);
+
+ QGlyphs otherGlyphs;
+ otherGlyphs = glyphs;
+
+ QCOMPARE(otherGlyphs.glyphIndexes(), glyphs.glyphIndexes());
+
+ otherGlyphs.setGlyphIndexes(QVector<quint32>() << 4 << 5 << 6);
+
+ QCOMPARE(otherGlyphs.glyphIndexes(), QVector<quint32>() << 4 << 5 << 6);
+ QCOMPARE(glyphs.glyphIndexes(), QVector<quint32>() << 1 << 2 << 3);
+}
+
+void tst_QGlyphs::drawStruckOutText()
+{
+ QPixmap textLayoutDraw(1000, 1000);
+ QPixmap drawGlyphs(1000, 1000);
+
+ textLayoutDraw.fill(Qt::white);
+ drawGlyphs.fill(Qt::white);
+
+ QString s = QString::fromLatin1("Foobar");
+
+ QFont font;
+ font.setStrikeOut(true);
+
+ QTextLayout layout(s);
+ layout.setFont(font);
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ {
+ QPainter p(&textLayoutDraw);
+ layout.draw(&p, QPointF(50, 50));
+ }
+
+ QGlyphs glyphs = layout.glyphs().size() > 0
+ ? layout.glyphs().at(0)
+ : QGlyphs();
+
+ {
+ QPainter p(&drawGlyphs);
+ p.drawGlyphs(QPointF(50, 50), glyphs);
+ }
+
+#if defined(DEBUG_SAVE_IMAGE)
+ textLayoutDraw.save("drawStruckOutText_textLayoutDraw.png");
+ drawGlyphs.save("drawStruckOutText_drawGlyphIndexes.png");
+#endif
+
+ QCOMPARE(textLayoutDraw, drawGlyphs);
+}
+
+void tst_QGlyphs::drawOverlinedText()
+{
+ QPixmap textLayoutDraw(1000, 1000);
+ QPixmap drawGlyphs(1000, 1000);
+
+ textLayoutDraw.fill(Qt::white);
+ drawGlyphs.fill(Qt::white);
+
+ QString s = QString::fromLatin1("Foobar");
+
+ QFont font;
+ font.setOverline(true);
+
+ QTextLayout layout(s);
+ layout.setFont(font);
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ {
+ QPainter p(&textLayoutDraw);
+ layout.draw(&p, QPointF(50, 50));
+ }
+
+ QGlyphs glyphs = layout.glyphs().size() > 0
+ ? layout.glyphs().at(0)
+ : QGlyphs();
+
+ {
+ QPainter p(&drawGlyphs);
+ p.drawGlyphs(QPointF(50, 50), glyphs);
+ }
+
+#if defined(DEBUG_SAVE_IMAGE)
+ textLayoutDraw.save("drawOverlineText_textLayoutDraw.png");
+ drawGlyphs.save("drawOverlineText_drawGlyphIndexes.png");
+#endif
+
+ QCOMPARE(textLayoutDraw, drawGlyphs);
+}
+
+void tst_QGlyphs::drawUnderlinedText()
+{
+ QPixmap textLayoutDraw(1000, 1000);
+ QPixmap drawGlyphs(1000, 1000);
+
+ textLayoutDraw.fill(Qt::white);
+ drawGlyphs.fill(Qt::white);
+
+ QString s = QString::fromLatin1("Foobar");
+
+ QFont font;
+ font.setUnderline(true);
+
+ QTextLayout layout(s);
+ layout.setFont(font);
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ {
+ QPainter p(&textLayoutDraw);
+ layout.draw(&p, QPointF(50, 50));
+ }
+
+ QGlyphs glyphs = layout.glyphs().size() > 0
+ ? layout.glyphs().at(0)
+ : QGlyphs();
+
+ {
+ QPainter p(&drawGlyphs);
+ p.drawGlyphs(QPointF(50, 50), glyphs);
+ }
+
+#if defined(DEBUG_SAVE_IMAGE)
+ textLayoutDraw.save("drawUnderlineText_textLayoutDraw.png");
+ drawGlyphs.save("drawUnderlineText_drawGlyphIndexes.png");
+#endif
+
+ QCOMPARE(textLayoutDraw, drawGlyphs);
+}
+
+void tst_QGlyphs::drawRightToLeft()
+{
+ QString s;
+ s.append(QChar(1575));
+ s.append(QChar(1578));
+
+ QPixmap textLayoutDraw(1000, 1000);
+ QPixmap drawGlyphs(1000, 1000);
+
+ textLayoutDraw.fill(Qt::white);
+ drawGlyphs.fill(Qt::white);
+
+ QFont font;
+ font.setUnderline(true);
+
+ QTextLayout layout(s);
+ layout.setFont(font);
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ {
+ QPainter p(&textLayoutDraw);
+ layout.draw(&p, QPointF(50, 50));
+ }
+
+ QGlyphs glyphs = layout.glyphs().size() > 0
+ ? layout.glyphs().at(0)
+ : QGlyphs();
+
+ {
+ QPainter p(&drawGlyphs);
+ p.drawGlyphs(QPointF(50, 50), glyphs);
+ }
+
+#if defined(DEBUG_SAVE_IMAGE)
+ textLayoutDraw.save("drawRightToLeft_textLayoutDraw.png");
+ drawGlyphs.save("drawRightToLeft_drawGlyphIndexes.png");
+#endif
+
+ QCOMPARE(textLayoutDraw, drawGlyphs);
+
+}
+
+QTEST_MAIN(tst_QGlyphs)
+#include "tst_qglyphs.moc"
+
diff --git a/tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro b/tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro
index 4c065f4..8768425 100644
--- a/tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro
+++ b/tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro
@@ -1,3 +1,3 @@
load(qttest_p4)
SOURCES += tst_qgraphicsanchorlayout.cpp
-
+CONFIG += parallel_test
diff --git a/tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro b/tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro
index 27f48e0..90b7878 100644
--- a/tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro
+++ b/tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro
@@ -1,3 +1,3 @@
load(qttest_p4)
SOURCES += tst_qgraphicsanchorlayout1.cpp
-
+CONFIG += parallel_test
diff --git a/tests/auto/qgraphicseffect/qgraphicseffect.pro b/tests/auto/qgraphicseffect/qgraphicseffect.pro
index 7effaca..94b3ce6 100644
--- a/tests/auto/qgraphicseffect/qgraphicseffect.pro
+++ b/tests/auto/qgraphicseffect/qgraphicseffect.pro
@@ -1,3 +1,3 @@
load(qttest_p4)
SOURCES += tst_qgraphicseffect.cpp
-
+CONFIG += parallel_test
diff --git a/tests/auto/qgraphicseffectsource/qgraphicseffectsource.pro b/tests/auto/qgraphicseffectsource/qgraphicseffectsource.pro
index d506c6d..5658ad7 100644
--- a/tests/auto/qgraphicseffectsource/qgraphicseffectsource.pro
+++ b/tests/auto/qgraphicseffectsource/qgraphicseffectsource.pro
@@ -1,3 +1,3 @@
load(qttest_p4)
SOURCES += tst_qgraphicseffectsource.cpp
-
+CONFIG += parallel_test
diff --git a/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro b/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro
index 97e68bc..d66d639 100644
--- a/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro
+++ b/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro
@@ -1,4 +1,4 @@
load(qttest_p4)
SOURCES += tst_qgraphicsgridlayout.cpp
-
+CONFIG += parallel_test
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 5b03767..82af71f 100644
--- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -78,6 +78,7 @@ private slots:
void horizontalSpacing();
void itemAt();
void removeAt();
+ void removeItem();
void rowAlignment();
void rowCount();
void rowMaximumHeight();
@@ -107,12 +108,14 @@ private slots:
void avoidRecursionInInsertItem();
void styleInfoLeak();
void task236367_maxSizeHint();
+ void heightForWidth();
+ void widthForHeight();
};
class RectWidget : public QGraphicsWidget
{
public:
- RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){}
+ RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent), m_fnConstraint(0) {}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
@@ -125,9 +128,12 @@ public:
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const
{
- if (m_sizeHints[which].isValid()) {
+ if (constraint.width() < 0 && constraint.height() < 0 && m_sizeHints[which].isValid()) {
return m_sizeHints[which];
}
+ if (m_fnConstraint) {
+ return m_fnConstraint(which, constraint);
+ }
return QGraphicsWidget::sizeHint(which, constraint);
}
@@ -136,7 +142,13 @@ public:
updateGeometry();
}
+ void setConstraintFunction(QSizeF (*fnConstraint)(Qt::SizeHint, const QSizeF &)) {
+ m_fnConstraint = fnConstraint;
+ }
+
QSizeF m_sizeHints[Qt::NSizeHints];
+ QSizeF (*m_fnConstraint)(Qt::SizeHint, const QSizeF &);
+
};
struct ItemDesc
@@ -146,7 +158,8 @@ struct ItemDesc
m_rowSpan(1),
m_colSpan(1),
m_sizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)),
- m_align(0)
+ m_align(0),
+ m_fnConstraint(0)
{
}
@@ -213,8 +226,21 @@ struct ItemDesc
return (*this);
}
+ ItemDesc &dynamicConstraint(QSizeF (*fnConstraint)(Qt::SizeHint, const QSizeF &),
+ Qt::Orientation orientation) {
+ m_fnConstraint = fnConstraint;
+ m_constraintOrientation = orientation;
+ return (*this);
+ }
+
void apply(QGraphicsGridLayout *layout, QGraphicsWidget *item) {
- item->setSizePolicy(m_sizePolicy);
+ QSizePolicy sp = m_sizePolicy;
+ if (m_fnConstraint) {
+ sp.setHeightForWidth(m_constraintOrientation == Qt::Vertical);
+ sp.setWidthForHeight(m_constraintOrientation == Qt::Horizontal);
+ }
+
+ item->setSizePolicy(sp);
for (int i = 0; i < Qt::NSizeHints; ++i) {
if (!m_sizes[i].isValid())
continue;
@@ -233,6 +259,7 @@ struct ItemDesc
break;
}
}
+
layout->addItem(item, m_pos.first, m_pos.second, m_rowSpan, m_colSpan);
layout->setAlignment(item, m_align);
}
@@ -240,6 +267,7 @@ struct ItemDesc
void apply(QGraphicsGridLayout *layout, RectWidget *item) {
for (int i = 0; i < Qt::NSizeHints; ++i)
item->setSizeHint((Qt::SizeHint)i, m_sizeHints[i]);
+ item->setConstraintFunction(m_fnConstraint);
apply(layout, static_cast<QGraphicsWidget*>(item));
}
@@ -251,6 +279,9 @@ struct ItemDesc
QSizeF m_sizeHints[Qt::NSizeHints];
QSizeF m_sizes[Qt::NSizeHints];
Qt::Alignment m_align;
+
+ Qt::Orientation m_constraintOrientation;
+ QSizeF (*m_fnConstraint)(Qt::SizeHint, const QSizeF &);
};
typedef QList<ItemDesc> ItemList;
@@ -992,6 +1023,32 @@ void tst_QGraphicsGridLayout::removeAt()
delete widget;
}
+void tst_QGraphicsGridLayout::removeItem()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+
+ QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
+ scene.addItem(widget);
+ QGraphicsGridLayout *l = new QGraphicsGridLayout();
+ widget->setLayout(l);
+
+ populateLayout(l, 3, 2);
+ QCOMPARE(l->count(), 6);
+ l->removeItem(l->itemAt(5));
+ l->removeItem(l->itemAt(4));
+ QCOMPARE(l->count(), 4);
+
+ // Avoid crashing. Note that the warning message might change in the future.
+ QTest::ignoreMessage(QtWarningMsg, QString::fromAscii("QGraphicsGridLayout::removeAt: invalid index -1").toLatin1().constData());
+ l->removeItem(0);
+ QCOMPARE(l->count(), 4);
+
+ QTest::ignoreMessage(QtWarningMsg, QString::fromAscii("QGraphicsGridLayout::removeAt: invalid index -1").toLatin1().constData());
+ l->removeItem(new QGraphicsWidget);
+ QCOMPARE(l->count(), 4);
+}
+
// public Qt::Alignment rowAlignment(int row) const
void tst_QGraphicsGridLayout::rowAlignment()
{
@@ -2116,6 +2173,57 @@ void tst_QGraphicsGridLayout::alignment2()
delete widget;
}
+static QSizeF hfw1(Qt::SizeHint, const QSizeF &constraint)
+{
+ QSizeF result(constraint);
+ const qreal ch = constraint.height();
+ const qreal cw = constraint.width();
+ if (cw < 0 && ch < 0) {
+ return QSizeF(50, 400);
+ } else if (cw > 0) {
+ result.setHeight(20000./cw);
+ }
+ return result;
+}
+
+static QSizeF wfh1(Qt::SizeHint, const QSizeF &constraint)
+{
+ QSizeF result(constraint);
+ const qreal ch = constraint.height();
+ const qreal cw = constraint.width();
+ if (cw < 0 && ch < 0) {
+ return QSizeF(400, 50);
+ } else if (ch > 0) {
+ result.setWidth(20000./ch);
+ }
+ return result;
+}
+
+static QSizeF wfh2(Qt::SizeHint, const QSizeF &constraint)
+{
+ QSizeF result(constraint);
+ const qreal ch = constraint.height();
+ const qreal cw = constraint.width();
+ if (ch < 0 && cw < 0)
+ return QSizeF(50, 50);
+ if (ch >= 0)
+ result.setWidth(ch);
+ return result;
+}
+
+static QSizeF hfw3(Qt::SizeHint, const QSizeF &constraint)
+{
+ QSizeF result(constraint);
+ const qreal ch = constraint.height();
+ const qreal cw = constraint.width();
+ if (cw < 0 && ch < 0) {
+ return QSizeF(10, 10);
+ } else if (cw > 0) {
+ result.setHeight(100./cw);
+ }
+ return result;
+}
+
void tst_QGraphicsGridLayout::geometries_data()
{
@@ -2145,6 +2253,319 @@ void tst_QGraphicsGridLayout::geometries_data()
<< QRectF(0, 0, 60,10) << QRectF(0, 10, 60,10)
);
+ // change layout height and verify
+ QTest::newRow("hfw-100x401") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(40,40))
+ .preferredSize(QSizeF(50,400))
+ .maxSize(QSizeF(500, 500))
+ .dynamicConstraint(hfw1, Qt::Vertical)
+ )
+ << QSizeF(100, 401)
+ << (RectList()
+ << QRectF(0, 0, 50, 1) << QRectF(50, 0, 50, 1)
+ << QRectF(0, 1, 50,100) << QRectF(50, 1, 50,400)
+ );
+
+
+ QTest::newRow("hfw-100x408") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(40,40))
+ .preferredSize(QSizeF(50,400))
+ .maxSize(QSizeF(500, 500))
+ .dynamicConstraint(hfw1, Qt::Vertical)
+ )
+ << QSizeF(100, 408)
+ << (RectList()
+ << QRectF(0, 0, 50, 8) << QRectF(50, 0, 50, 8)
+ << QRectF(0, 8, 50,100) << QRectF(50, 8, 50,400)
+ );
+
+ QTest::newRow("hfw-h410") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(40,40))
+ .preferredSize(QSizeF(50,400))
+ .maxSize(QSizeF(500, 500))
+ .dynamicConstraint(hfw1, Qt::Vertical)
+ )
+ << QSizeF(100, 410)
+ << (RectList()
+ << QRectF(0, 0, 50,10) << QRectF(50, 0, 50,10)
+ << QRectF(0, 10, 50,100) << QRectF(50, 10, 50,400)
+ );
+
+ QTest::newRow("hfw-100x470") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(40,40))
+ .preferredSize(QSizeF(50,400))
+ .maxSize(QSizeF(500, 500))
+ .dynamicConstraint(hfw1, Qt::Vertical)
+ )
+ << QSizeF(100, 470)
+ << (RectList()
+ << QRectF(0, 0, 50,70) << QRectF(50, 0, 50,70)
+ << QRectF(0, 70, 50,100) << QRectF(50, 70, 50,400)
+ );
+
+
+ // change layout width and verify
+ QTest::newRow("hfw-100x401") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(40,40))
+ .preferredSize(QSizeF(50,400))
+ .maxSize(QSizeF(5000, 5000))
+ .dynamicConstraint(hfw1, Qt::Vertical)
+ )
+ << QSizeF(100, 401)
+ << (RectList()
+ << QRectF( 0, 0, 50, 1) << QRectF( 50, 0, 50, 1)
+ << QRectF( 0, 1, 50, 100) << QRectF( 50, 1, 50, 400)
+ );
+
+ QTest::newRow("hfw-160x400") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(40,40))
+ .preferredSize(QSizeF(50,400))
+ .maxSize(QSizeF(5000, 5000))
+ .dynamicConstraint(hfw1, Qt::Vertical)
+ )
+ << QSizeF(160, 400)
+ << (RectList()
+ << QRectF( 0, 0, 80, 100) << QRectF( 80, 0, 80, 100)
+ << QRectF( 0, 100, 80, 100) << QRectF( 80, 100, 80, 250)
+ );
+
+
+ QTest::newRow("hfw-160x300") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(40,40))
+ .preferredSize(QSizeF(50,400))
+ .maxSize(QSizeF(5000, 5000))
+ .dynamicConstraint(hfw1, Qt::Vertical)
+ )
+ << QSizeF(160, 300)
+ << (RectList()
+ << QRectF( 0, 0, 80, 50) << QRectF( 80, 0, 80, 50)
+ << QRectF( 0, 50, 80, 100) << QRectF( 80, 50, 80, 250)
+ );
+
+ QTest::newRow("hfw-20x40") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,10))
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSizeF(100, 100))
+ .dynamicConstraint(hfw3, Qt::Vertical)
+ )
+ << QSizeF(20, 40)
+ << (RectList()
+ << QRectF(0, 0, 10, 20) << QRectF(10, 0, 10, 20)
+ << QRectF(0, 20, 10, 20) << QRectF(10, 20, 10, 10)
+ );
+
+ QTest::newRow("wfh-300x160") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(10,50))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(10,50))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(10,50))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(10,10))
+ .preferredSize(QSizeF(400,50))
+ .maxSize(QSizeF(5000, 5000))
+ .dynamicConstraint(wfh1, Qt::Horizontal)
+ )
+ << QSizeF(300, 160)
+ << (RectList()
+ << QRectF( 0, 0, 50, 80) << QRectF( 50, 0, 100, 80)
+ << QRectF( 0, 80, 50, 80) << QRectF( 50, 80, 250, 80)
+ );
+
+ QTest::newRow("wfh-40x20") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ // Note, must be 10 in order to match stretching of wfh item
+ // below (the same stretch makes it easier to test)
+ .minSize(QSizeF(10,1))
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSizeF(100, 100))
+ .dynamicConstraint(wfh2, Qt::Horizontal)
+ )
+ << QSizeF(40, 20)
+ << (RectList()
+ << QRectF(0, 0, 20, 10) << QRectF(20, 0, 20, 10)
+ << QRectF(0, 10, 20, 10) << QRectF(20, 10, 10, 10)
+ );
+
+ QTest::newRow("wfh-400x160") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSizeF(100, 100))
+ .dynamicConstraint(wfh2, Qt::Horizontal)
+ )
+
+ << QSizeF(400, 160)
+ << (RectList()
+ << QRectF(0, 0, 100, 80) << QRectF(100, 0, 100, 80)
+ << QRectF(0, 80, 100, 80) << QRectF(100, 80, 80, 80)
+ );
+
+ QTest::newRow("wfh-160x100") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ // Note, preferred width must be 50 in order to match
+ // preferred width of wfh item below.
+ // (The same preferred size makes the stretch the same, and
+ // makes it easier to test) (The stretch algorithm is a
+ // blackbox)
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(10,50))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(10,50))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(10,50))
+ .maxSize(QSizeF(500, 500))
+ .dynamicConstraint(wfh2, Qt::Horizontal)
+ )
+ << QSizeF(160, 100)
+ << (RectList()
+ << QRectF(0, 0, 80, 50) << QRectF( 80, 0, 80, 50)
+ << QRectF(0, 50, 80, 50) << QRectF( 80, 50, 50, 50)
+ );
+
}
void tst_QGraphicsGridLayout::geometries()
@@ -2215,6 +2636,207 @@ void tst_QGraphicsGridLayout::task236367_maxSizeHint()
QCOMPARE(widget->size(), QSizeF(w, h));
}
+static QSizeF hfw(Qt::SizeHint /*which*/, const QSizeF &constraint)
+{
+ QSizeF result(constraint);
+ const qreal cw = constraint.width();
+ const qreal ch = constraint.height();
+ if (cw < 0 && ch < 0) {
+ return QSizeF(200, 100);
+ } else if (cw >= 0) {
+ result.setHeight(20000./cw);
+ } else if (cw == 0) {
+ result.setHeight(20000);
+ } else if (ch >= 0) {
+ result.setWidth(20000./ch);
+ } else if (ch == 0) {
+ result.setWidth(20000);
+ }
+ return result;
+}
+
+static QSizeF wfh(Qt::SizeHint /*which*/, const QSizeF &constraint)
+{
+ QSizeF result(constraint);
+ const qreal ch = constraint.height();
+ if (ch >= 0) {
+ result.setWidth(ch);
+ }
+ return result;
+}
+
+static qreal growthFactorBelowPreferredSize(qreal desired, qreal sumAvailable, qreal sumDesired)
+{
+ Q_ASSERT(sumDesired != 0.0);
+ return desired * qPow(sumAvailable / sumDesired, desired / sumDesired);
+}
+
+static void expectedWidth(qreal minSize1, qreal prefSize1,
+ qreal minSize2, qreal prefSize2,
+ qreal targetSize, qreal *width1, qreal *width2)
+{
+ qreal sumAvail,factor1,factor2;
+ // stretch behaviour is different below and above preferred size...
+ if (targetSize < prefSize1 + prefSize2) {
+ sumAvail = targetSize - minSize1 - minSize2;
+ const qreal desired1 = prefSize1 - minSize1;
+ const qreal desired2 = prefSize2 - minSize2;
+ const qreal sumDesired = desired1 + desired2;
+ factor1 = growthFactorBelowPreferredSize(desired1, sumAvail, sumDesired);
+ factor2 = growthFactorBelowPreferredSize(desired2, sumAvail, sumDesired);
+ const qreal sumFactors = factor1 + factor2;
+ *width1 = sumAvail*factor1/sumFactors + minSize1;
+ *width2 = sumAvail*factor2/sumFactors + minSize2;
+ } else {
+ sumAvail = targetSize - prefSize1 - prefSize2;
+ factor1 = prefSize1;
+ factor2 = prefSize2;
+ const qreal sumFactors = factor1 + factor2;
+ *width1 = sumAvail*factor1/sumFactors + prefSize1;
+ *width2 = sumAvail*factor2/sumFactors + prefSize2;
+ }
+}
+
+
+bool qFuzzyCompare(const QSizeF &a, const QSizeF &b)
+{
+ return qFuzzyCompare(a.width(), b.width()) && qFuzzyCompare(a.height(), b.height());
+}
+
+void tst_QGraphicsGridLayout::heightForWidth()
+{
+ QGraphicsWidget *widget = new QGraphicsWidget;
+ QGraphicsGridLayout *layout = new QGraphicsGridLayout;
+ widget->setLayout(layout);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->setSpacing(0);
+ RectWidget *w00 = new RectWidget;
+ w00->setSizeHint(Qt::MinimumSize, QSizeF(1,1));
+ w00->setSizeHint(Qt::PreferredSize, QSizeF(50,50));
+ w00->setSizeHint(Qt::MaximumSize, QSizeF(100,100));
+ layout->addItem(w00, 0, 0);
+
+ RectWidget *w01 = new RectWidget;
+ w01->setSizeHint(Qt::MinimumSize, QSizeF(1,1));
+ w01->setSizeHint(Qt::PreferredSize, QSizeF(50,50));
+ w01->setSizeHint(Qt::MaximumSize, QSizeF(100,100));
+ layout->addItem(w01, 0, 1);
+
+ RectWidget *w10 = new RectWidget;
+ w10->setSizeHint(Qt::MinimumSize, QSizeF(1,1));
+ w10->setSizeHint(Qt::PreferredSize, QSizeF(50,50));
+ w10->setSizeHint(Qt::MaximumSize, QSizeF(100,100));
+ layout->addItem(w10, 1, 0);
+
+ RectWidget *w11 = new RectWidget;
+ w11->setSizeHint(Qt::MinimumSize, QSizeF(1,1));
+ w11->setSizeHint(Qt::PreferredSize, QSizeF(50,400));
+ w11->setSizeHint(Qt::MaximumSize, QSizeF(30000,30000));
+ w11->setConstraintFunction(hfw);
+ QSizePolicy sp(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ sp.setHeightForWidth(true);
+ w11->setSizePolicy(sp);
+ layout->addItem(w11, 1, 1);
+
+ QSizeF prefSize = layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, -1));
+ QCOMPARE(prefSize, QSizeF(50+50, 50+400));
+
+ QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(2, -1)), QSizeF(2, 20001));
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(2, -1)), QSizeF(2, 20050));
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(2, -1)), QSizeF(2, 20100));
+
+ QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(20, -1)), QSizeF(20, 1 + 2000));
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(20, -1)), QSizeF(20, 50 + 2000));
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(20, -1)), QSizeF(20, 100 + 2000));
+
+ QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(300, -1)), QSizeF(300, 1 + 100));
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(300, -1)), QSizeF(300, 50 + 100));
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(300, -1)), QSizeF(300, 100 + 100));
+
+ // the height of the hfw widget is shorter than the one to the left, which is 100, so
+ // the total height of the last row is 100 (which leaves the layout height to be 200)
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(500, -1)), QSizeF(500, 100 + 100));
+
+ // hfw item size: (500, 40) -> preferred size is maxed up to preferred size of item w10 (50)
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(600, -1)), QSizeF(600, 50 + 50));
+
+}
+
+void tst_QGraphicsGridLayout::widthForHeight()
+{
+ QGraphicsWidget *widget = new QGraphicsWidget;
+ QGraphicsGridLayout *layout = new QGraphicsGridLayout;
+ widget->setLayout(layout);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->setSpacing(0);
+ RectWidget *w00 = new RectWidget;
+ w00->setMinimumSize(1, 1);
+ w00->setPreferredSize(50, 50);
+ w00->setMaximumSize(100, 100);
+
+ layout->addItem(w00, 0, 0);
+
+ RectWidget *w01 = new RectWidget;
+ w01->setMinimumSize(1,1);
+ w01->setPreferredSize(50,50);
+ w01->setMaximumSize(100,100);
+ layout->addItem(w01, 0, 1);
+
+ RectWidget *w10 = new RectWidget;
+ w10->setMinimumSize(1,1);
+ w10->setPreferredSize(50,50);
+ w10->setMaximumSize(100,100);
+ layout->addItem(w10, 1, 0);
+
+ RectWidget *w11 = new RectWidget;
+ w11->setMinimumSize(1,1);
+ w11->setPreferredSize(50, 50);
+ w11->setMaximumSize(30000,30000);
+ // This will make sure its always square.
+ w11->setConstraintFunction(wfh);
+ QSizePolicy sp(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ sp.setWidthForHeight(true);
+ w11->setSizePolicy(sp);
+ layout->addItem(w11, 1, 1);
+
+ /*
+ | 1, 50, 100 | 1, 50, 100 |
+ -----+--------------+--------------+
+ 1| | |
+ 50| | |
+ 100| | |
+ -----|--------------+--------------+
+ 1| | |
+ 50| | WFH |
+ 100| | |
+ -----------------------------------+
+ */
+
+
+ QSizeF prefSize = layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, -1));
+ QCOMPARE(prefSize, QSizeF(50+50, 50+50));
+
+ // wfh(1): = 1
+ QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, 2)), QSizeF(1 + 1, 2));
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, 2)), QSizeF(50 + 50, 2));
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(-1, 2)), QSizeF(100 + 100, 2));
+
+ // wfh(40) = 40
+ QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, 80)), QSizeF(1 + 40, 80));
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, 80)), QSizeF(50 + 50, 80));
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(-1, 80)), QSizeF(100 + 100, 80));
+
+ // wfh(80) = 80
+ QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, 160)), QSizeF(1 + 80, 160));
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, 160)), QSizeF(50 + 80, 160));
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(-1, 160)), QSizeF(100 + 100, 160));
+
+ // wfh(200) = 200
+ QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, 300)), QSizeF(1 + 200, 300));
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, 300)), QSizeF(50 + 200, 300));
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(-1, 300)), QSizeF(100 + 200, 300));
+
+}
QTEST_MAIN(tst_QGraphicsGridLayout)
#include "tst_qgraphicsgridlayout.moc"
diff --git a/tests/auto/qgraphicsitemanimation/qgraphicsitemanimation.pro b/tests/auto/qgraphicsitemanimation/qgraphicsitemanimation.pro
index 6be3bfe..01875c7 100644
--- a/tests/auto/qgraphicsitemanimation/qgraphicsitemanimation.pro
+++ b/tests/auto/qgraphicsitemanimation/qgraphicsitemanimation.pro
@@ -1,5 +1,5 @@
load(qttest_p4)
SOURCES += tst_qgraphicsitemanimation.cpp
DEFINES += QT_NO_CAST_TO_ASCII
-
+CONFIG += parallel_test
diff --git a/tests/auto/qgraphicslayout/qgraphicslayout.pro b/tests/auto/qgraphicslayout/qgraphicslayout.pro
index 1dc916a..eafd213 100644
--- a/tests/auto/qgraphicslayout/qgraphicslayout.pro
+++ b/tests/auto/qgraphicslayout/qgraphicslayout.pro
@@ -5,4 +5,4 @@
load(qttest_p4)
SOURCES += tst_qgraphicslayout.cpp
DEFINES += QT_USE_USING_NAMESPACE
-
+CONFIG += parallel_test
diff --git a/tests/auto/qgraphicslayoutitem/qgraphicslayoutitem.pro b/tests/auto/qgraphicslayoutitem/qgraphicslayoutitem.pro
index 6c8bf0c..816224b 100644
--- a/tests/auto/qgraphicslayoutitem/qgraphicslayoutitem.pro
+++ b/tests/auto/qgraphicslayoutitem/qgraphicslayoutitem.pro
@@ -1,4 +1,4 @@
load(qttest_p4)
SOURCES += tst_qgraphicslayoutitem.cpp
-
+CONFIG += parallel_test
diff --git a/tests/auto/qgraphicslinearlayout/qgraphicslinearlayout.pro b/tests/auto/qgraphicslinearlayout/qgraphicslinearlayout.pro
index 114e5e9..df5a827 100644
--- a/tests/auto/qgraphicslinearlayout/qgraphicslinearlayout.pro
+++ b/tests/auto/qgraphicslinearlayout/qgraphicslinearlayout.pro
@@ -1,4 +1,4 @@
load(qttest_p4)
SOURCES += tst_qgraphicslinearlayout.cpp
-
+CONFIG += parallel_test
diff --git a/tests/auto/qgraphicsobject/qgraphicsobject.pro b/tests/auto/qgraphicsobject/qgraphicsobject.pro
index 965b319..2418845 100644
--- a/tests/auto/qgraphicsobject/qgraphicsobject.pro
+++ b/tests/auto/qgraphicsobject/qgraphicsobject.pro
@@ -1,2 +1,3 @@
load(qttest_p4)
SOURCES += tst_qgraphicsobject.cpp
+CONFIG += parallel_test \ No newline at end of file
diff --git a/tests/auto/qgraphicspixmapitem/qgraphicspixmapitem.pro b/tests/auto/qgraphicspixmapitem/qgraphicspixmapitem.pro
index f6d6c8f..6b4db95 100644
--- a/tests/auto/qgraphicspixmapitem/qgraphicspixmapitem.pro
+++ b/tests/auto/qgraphicspixmapitem/qgraphicspixmapitem.pro
@@ -1,4 +1,4 @@
load(qttest_p4)
SOURCES += tst_qgraphicspixmapitem.cpp
-
+CONFIG += parallel_test
diff --git a/tests/auto/qgraphicspolygonitem/qgraphicspolygonitem.pro b/tests/auto/qgraphicspolygonitem/qgraphicspolygonitem.pro
index d54b78b..4da949b 100644
--- a/tests/auto/qgraphicspolygonitem/qgraphicspolygonitem.pro
+++ b/tests/auto/qgraphicspolygonitem/qgraphicspolygonitem.pro
@@ -1,4 +1,4 @@
load(qttest_p4)
SOURCES += tst_qgraphicspolygonitem.cpp
-
+CONFIG += parallel_test
diff --git a/tests/auto/qgraphicsscene/qgraphicsscene.pro b/tests/auto/qgraphicsscene/qgraphicsscene.pro
index cc6f585..82fa423 100644
--- a/tests/auto/qgraphicsscene/qgraphicsscene.pro
+++ b/tests/auto/qgraphicsscene/qgraphicsscene.pro
@@ -7,9 +7,9 @@ win32:!wince*: LIBS += -lUser32
DEFINES += QT_NO_CAST_TO_ASCII
wince*|symbian: {
- rootFiles.sources = Ash_European.jpg graphicsScene_selection.data
+ rootFiles.files = Ash_European.jpg graphicsScene_selection.data
rootFiles.path = .
- renderFiles.sources = testData\\render\\*
+ renderFiles.files = testData\\render\\*
renderFiles.path = testData\\render
DEPLOYMENT += rootFiles renderFiles
}
diff --git a/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro b/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro
index d1bf3cc..1fdd176 100644
--- a/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro
+++ b/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro
@@ -1,4 +1,4 @@
load(qttest_p4)
requires(contains(QT_CONFIG,private_tests))
SOURCES += tst_qgraphicssceneindex.cpp
-
+CONFIG += parallel_test
diff --git a/tests/auto/qgraphicstransform/qgraphicstransform.pro b/tests/auto/qgraphicstransform/qgraphicstransform.pro
index 709cff6..67c939e 100644
--- a/tests/auto/qgraphicstransform/qgraphicstransform.pro
+++ b/tests/auto/qgraphicstransform/qgraphicstransform.pro
@@ -1,2 +1,3 @@
load(qttest_p4)
SOURCES += tst_qgraphicstransform.cpp
+CONFIG += parallel_test
diff --git a/tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro b/tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro
index 889aac9..a9a8ed9 100644
--- a/tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro
+++ b/tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro
@@ -9,9 +9,9 @@ DEFINES += QT_USE_USING_NAMESPACE
wince*: {
DEFINES += SRCDIR=\\\"./\\\"
QT += network
- addFiles.sources = $$PWD/data/*.*
+ addFiles.files = $$PWD/data/*.*
addFiles.path = data
- clucene.sources = $$QT_BUILD_TREE/lib/QtCLucene*.dll
+ clucene.files = $$QT_BUILD_TREE/lib/QtCLucene*.dll
DEPLOYMENT += addFiles
DEPLOYMENT += clucene
diff --git a/tests/auto/qhelpenginecore/qhelpenginecore.pro b/tests/auto/qhelpenginecore/qhelpenginecore.pro
index 27ebd0f..4166fe2 100644
--- a/tests/auto/qhelpenginecore/qhelpenginecore.pro
+++ b/tests/auto/qhelpenginecore/qhelpenginecore.pro
@@ -10,9 +10,9 @@ DEFINES += QT_USE_USING_NAMESPACE
wince*: {
DEFINES += SRCDIR=\\\"./\\\"
QT += network
- addFiles.sources = $$PWD/data/*.*
+ addFiles.files = $$PWD/data/*.*
addFiles.path = data
- clucene.sources = $$QT_BUILD_TREE/lib/QtCLucene*.dll
+ clucene.files = $$QT_BUILD_TREE/lib/QtCLucene*.dll
DEPLOYMENT += addFiles
DEPLOYMENT += clucene
diff --git a/tests/auto/qhttp/qhttp.pro b/tests/auto/qhttp/qhttp.pro
index c0be518..5b102ce 100644
--- a/tests/auto/qhttp/qhttp.pro
+++ b/tests/auto/qhttp/qhttp.pro
@@ -5,20 +5,20 @@ SOURCES += tst_qhttp.cpp
QT = core network
wince*: {
- webFiles.sources = webserver/*
+ webFiles.files = webserver/*
webFiles.path = webserver
- cgi.sources = webserver/cgi-bin/*
+ cgi.files = webserver/cgi-bin/*
cgi.path = webserver/cgi-bin
- addFiles.sources = rfc3252.txt trolltech
+ addFiles.files = rfc3252.txt trolltech
addFiles.path = .
DEPLOYMENT = addFiles webFiles cgi
DEFINES += SRCDIR=\\\"\\\"
} else:symbian {
- webFiles.sources = webserver/*
+ webFiles.files = webserver/*
webFiles.path = webserver
- cgi.sources = webserver/cgi-bin/*
+ cgi.files = webserver/cgi-bin/*
cgi.path = webserver/cgi-bin
- addFiles.sources = rfc3252.txt trolltech
+ addFiles.files = rfc3252.txt trolltech
addFiles.path = .
DEPLOYMENT = addFiles webFiles cgi
TARGET.CAPABILITY = NetworkServices
diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
index 89f608e..188ed29 100644
--- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
+++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
@@ -110,6 +110,8 @@ private Q_SLOTS:
void getEmptyWithPipelining();
+ void getAndEverythingShouldBePipelined();
+
void getAndThenDeleteObject();
void getAndThenDeleteObject_data();
};
@@ -1036,6 +1038,52 @@ void tst_QHttpNetworkConnection::getEmptyWithPipelining()
qDeleteAll(replies);
}
+class GetAndEverythingShouldBePipelinedReceiver : public QObject
+{
+ Q_OBJECT
+public:
+ int receivedCount;
+ int requestCount;
+ GetAndEverythingShouldBePipelinedReceiver(int rq) : receivedCount(0),requestCount(rq) { }
+public Q_SLOTS:
+ void finishedSlot() {
+ QHttpNetworkReply *reply = (QHttpNetworkReply*) sender();
+ receivedCount++;
+
+ if (receivedCount == requestCount)
+ QTestEventLoop::instance().exitLoop();
+ }
+};
+
+void tst_QHttpNetworkConnection::getAndEverythingShouldBePipelined()
+{
+ quint16 requestCount = 100;
+ // use 1 connection.
+ QHttpNetworkConnection connection(1, QtNetworkSettings::serverName());
+ QUrl url("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt");
+ QList<QHttpNetworkRequest*> requests;
+ QList<QHttpNetworkReply*> replies;
+
+ GetAndEverythingShouldBePipelinedReceiver receiver(requestCount);
+
+ for (int i = 0; i < requestCount; i++) {
+ QHttpNetworkRequest *request = 0;
+ request = new QHttpNetworkRequest(url, QHttpNetworkRequest::Get);
+ request->setPipeliningAllowed(true);
+ requests.append(request);
+ QHttpNetworkReply *reply = connection.sendRequest(*request);
+ connect(reply, SIGNAL(finished()), &receiver, SLOT(finishedSlot()));
+ replies.append(reply);
+ }
+ QTestEventLoop::instance().enterLoop(40);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ qDeleteAll(requests);
+ qDeleteAll(replies);
+
+}
+
+
void tst_QHttpNetworkConnection::getAndThenDeleteObject_data()
{
QTest::addColumn<bool>("replyFirst");
diff --git a/tests/auto/qicoimageformat/qicoimageformat.pro b/tests/auto/qicoimageformat/qicoimageformat.pro
index cabab3f..c150c9a 100644
--- a/tests/auto/qicoimageformat/qicoimageformat.pro
+++ b/tests/auto/qicoimageformat/qicoimageformat.pro
@@ -3,21 +3,21 @@ SOURCES+= tst_qicoimageformat.cpp
wince*: {
DEFINES += SRCDIR=\\\".\\\"
- addFiles.sources = icons
+ addFiles.files = icons
addFiles.path = .
CONFIG(debug, debug|release):{
- addPlugins.sources = $$QT_BUILD_TREE/plugins/imageformats/qico4d.dll
+ addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qico4d.dll
} else {
- addPlugins.sources = $$QT_BUILD_TREE/plugins/imageformats/qico4.dll
+ addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qico4.dll
}
addPlugins.path = imageformats
DEPLOYMENT += addFiles addPlugins
} else:symbian {
- addFiles.sources = icons
+ addFiles.files = icons
addFiles.path = .
DEPLOYMENT += addFiles
qt_not_deployed {
- addPlugins.sources = qico.dll
+ addPlugins.files = qico.dll
addPlugins.path = imageformats
DEPLOYMENT += addPlugins
}
diff --git a/tests/auto/qicon/qicon.pro b/tests/auto/qicon/qicon.pro
index 68b888d..975aaf2 100644
--- a/tests/auto/qicon/qicon.pro
+++ b/tests/auto/qicon/qicon.pro
@@ -5,10 +5,10 @@ RESOURCES = tst_qicon.qrc
wince* {
QT += xml svg
- addFiles.sources += $$_PRO_FILE_PWD_/*.png
- addFiles.sources += $$_PRO_FILE_PWD_/*.svg
- addFiles.sources += $$_PRO_FILE_PWD_/*.svgz
- addFiles.sources += $$_PRO_FILE_PWD_/tst_qicon.cpp
+ addFiles.files += $$_PRO_FILE_PWD_/*.png
+ addFiles.files += $$_PRO_FILE_PWD_/*.svg
+ addFiles.files += $$_PRO_FILE_PWD_/*.svgz
+ addFiles.files += $$_PRO_FILE_PWD_/tst_qicon.cpp
addFiles.path = .
DEPLOYMENT += addFiles
@@ -16,11 +16,11 @@ wince* {
DEFINES += SRCDIR=\\\".\\\"
} else:symbian {
QT += xml svg
- addFiles.sources = *.png tst_qicon.cpp *.svg *.svgz
+ addFiles.files = *.png tst_qicon.cpp *.svg *.svgz
addFiles.path = .
DEPLOYMENT += addFiles
qt_not_deployed {
- plugins.sources = qsvgicon.dll
+ plugins.files = qsvgicon.dll
plugins.path = iconengines
DEPLOYMENT += plugins
}
diff --git a/tests/auto/qimage/qimage.pro b/tests/auto/qimage/qimage.pro
index 6469211..798c82e 100644
--- a/tests/auto/qimage/qimage.pro
+++ b/tests/auto/qimage/qimage.pro
@@ -2,17 +2,17 @@ load(qttest_p4)
SOURCES += tst_qimage.cpp
wince*: {
- addImages.sources = images/*
+ addImages.files = images/*
addImages.path = images
DEPLOYMENT += addImages
DEFINES += SRCDIR=\\\".\\\"
} else:symbian {
TARGET.EPOCHEAPSIZE = 0x200000 0x800000
- addImages.sources = images/*
+ addImages.files = images/*
addImages.path = images
DEPLOYMENT += addImages
qt_not_deployed {
- imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll qtiff.dll qico.dll
+ imagePlugins.files = qjpeg.dll qgif.dll qmng.dll qtiff.dll qico.dll
imagePlugins.path = imageformats
DEPLOYMENT += imagePlugins
}
diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp
index b446941..6b8028c 100644
--- a/tests/auto/qimage/tst_qimage.cpp
+++ b/tests/auto/qimage/tst_qimage.cpp
@@ -59,6 +59,7 @@
#endif
Q_DECLARE_METATYPE(QImage::Format)
+Q_DECLARE_METATYPE(Qt::GlobalColor)
class tst_QImage : public QObject
{
@@ -140,6 +141,11 @@ private slots:
void compareIndexed();
+ void fillColor_data();
+ void fillColor();
+
+ void fillColorWithAlpha();
+
void rgbSwapped_data();
void rgbSwapped();
};
@@ -1823,6 +1829,112 @@ void tst_QImage::compareIndexed()
QCOMPARE(img, imgInverted);
}
+void tst_QImage::fillColor_data()
+{
+ QTest::addColumn<QImage::Format>("format");
+ QTest::addColumn<Qt::GlobalColor>("color");
+ QTest::addColumn<uint>("pixelValue");
+
+ QTest::newRow("Mono, color0") << QImage::Format_Mono << Qt::color0 << 0u;
+ QTest::newRow("Mono, color1") << QImage::Format_Mono << Qt::color1 << 1u;
+
+ QTest::newRow("MonoLSB, color0") << QImage::Format_MonoLSB << Qt::color0 << 0u;
+ QTest::newRow("MonoLSB, color1") << QImage::Format_MonoLSB << Qt::color1 << 1u;
+
+ const char *names[] = {
+ "Indexed8",
+ "RGB32",
+ "ARGB32",
+ "ARGB32pm",
+ "RGB16",
+ "ARGB8565pm",
+ "RGB666",
+ "ARGB6666pm",
+ "RGB555",
+ "ARGB8555pm",
+ "RGB888",
+ "RGB444",
+ "ARGB4444pm",
+ 0
+ };
+
+ QImage::Format formats[] = {
+ QImage::Format_Indexed8,
+ QImage::Format_RGB32,
+ QImage::Format_ARGB32,
+ QImage::Format_ARGB32_Premultiplied,
+ QImage::Format_RGB16,
+ QImage::Format_ARGB8565_Premultiplied,
+ QImage::Format_RGB666,
+ QImage::Format_ARGB6666_Premultiplied,
+ QImage::Format_RGB555,
+ QImage::Format_ARGB8555_Premultiplied,
+ QImage::Format_RGB888,
+ QImage::Format_RGB444,
+ QImage::Format_ARGB4444_Premultiplied
+ };
+
+ for (int i=0; names[i] != 0; ++i) {
+ QByteArray name;
+ name.append(names[i]).append(", ");
+
+ QTest::newRow(QByteArray(name).append("black").constData()) << formats[i] << Qt::black << 0xff000000;
+ QTest::newRow(QByteArray(name).append("white").constData()) << formats[i] << Qt::white << 0xffffffff;
+ QTest::newRow(QByteArray(name).append("red").constData()) << formats[i] << Qt::red << 0xffff0000;
+ QTest::newRow(QByteArray(name).append("green").constData()) << formats[i] << Qt::green << 0xff00ff00;
+ QTest::newRow(QByteArray(name).append("blue").constData()) << formats[i] << Qt::blue << 0xff0000ff;
+ }
+
+ QTest::newRow("RGB16, transparent") << QImage::Format_RGB16 << Qt::transparent << 0xff000000;
+ QTest::newRow("RGB32, transparent") << QImage::Format_RGB32 << Qt::transparent << 0xff000000;
+ QTest::newRow("ARGB32, transparent") << QImage::Format_ARGB32 << Qt::transparent << 0x00000000u;
+ QTest::newRow("ARGB32pm, transparent") << QImage::Format_ARGB32_Premultiplied << Qt::transparent << 0x00000000u;
+}
+
+void tst_QImage::fillColor()
+{
+ QFETCH(QImage::Format, format);
+ QFETCH(Qt::GlobalColor, color);
+ QFETCH(uint, pixelValue);
+
+ QImage image(1, 1, format);
+
+ if (image.depth() == 8) {
+ QVector<QRgb> table;
+ table << 0xff000000;
+ table << 0xffffffff;
+ table << 0xffff0000;
+ table << 0xff00ff00;
+ table << 0xff0000ff;
+ image.setColorTable(table);
+ }
+
+ image.fill(color);
+ if (image.depth() == 1) {
+ QCOMPARE(image.pixelIndex(0, 0), (int) pixelValue);
+ } else {
+ QCOMPARE(image.pixel(0, 0), pixelValue);
+ }
+
+ image.fill(QColor(color));
+ if (image.depth() == 1) {
+ QCOMPARE(image.pixelIndex(0, 0), (int) pixelValue);
+ } else {
+ QCOMPARE(image.pixel(0, 0), pixelValue);
+ }
+}
+
+void tst_QImage::fillColorWithAlpha()
+{
+ QImage argb32(1, 1, QImage::Format_ARGB32);
+ argb32.fill(QColor(255, 0, 0, 127));
+ QCOMPARE(argb32.pixel(0, 0), qRgba(255, 0, 0, 127));
+
+ QImage argb32pm(1, 1, QImage::Format_ARGB32_Premultiplied);
+ argb32pm.fill(QColor(255, 0, 0, 127));
+ QCOMPARE(argb32pm.pixel(0, 0), 0x7f7f0000u);
+}
+
void tst_QImage::rgbSwapped_data()
{
QTest::addColumn<QImage::Format>("format");
diff --git a/tests/auto/qimagereader/qimagereader.pro b/tests/auto/qimagereader/qimagereader.pro
index f8fc7fa..827819d 100644
--- a/tests/auto/qimagereader/qimagereader.pro
+++ b/tests/auto/qimagereader/qimagereader.pro
@@ -17,10 +17,10 @@ win32-msvc.net:QMAKE_CXXFLAGS -= -Zm300
win32-msvc.net:QMAKE_CXXFLAGS += -Zm1100
wince*: {
- images.sources = images
+ images.files = images
images.path = .
- imagePlugins.sources = $$QT_BUILD_TREE/plugins/imageformats/*.dll
+ imagePlugins.files = $$QT_BUILD_TREE/plugins/imageformats/*.dll
imagePlugins.path = imageformats
DEPLOYMENT += images imagePlugins
@@ -28,13 +28,13 @@ wince*: {
}
symbian: {
- images.sources = images
+ images.files = images
images.path = .
DEPLOYMENT += images
qt_not_deployed {
- imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll
+ imagePlugins.files = qjpeg.dll qgif.dll qmng.dll
imagePlugins.path = imageformats
DEPLOYMENT += imagePlugins
diff --git a/tests/auto/qimagewriter/qimagewriter.pro b/tests/auto/qimagewriter/qimagewriter.pro
index f25472f..bab2419 100644
--- a/tests/auto/qimagewriter/qimagewriter.pro
+++ b/tests/auto/qimagewriter/qimagewriter.pro
@@ -6,16 +6,16 @@ win32-msvc:QMAKE_CXXFLAGS -= -Zm200
win32-msvc:QMAKE_CXXFLAGS += -Zm800
wince*: {
- addFiles.sources = images\\*.*
+ addFiles.files = images\\*.*
addFiles.path = images
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\".\\\"
} else:symbian {
- addFiles.sources = images\\*.*
+ addFiles.files = images\\*.*
addFiles.path = images
DEPLOYMENT += addFiles
qt_not_deployed {
- imagePlugins.sources = qjpeg.dll qtiff.dll
+ imagePlugins.files = qjpeg.dll qtiff.dll
imagePlugins.path = imageformats
DEPLOYMENT += imagePlugins
}
diff --git a/tests/auto/qiodevice/qiodevice.pro b/tests/auto/qiodevice/qiodevice.pro
index 716cdce..29b0a05 100644
--- a/tests/auto/qiodevice/qiodevice.pro
+++ b/tests/auto/qiodevice/qiodevice.pro
@@ -4,14 +4,14 @@ SOURCES += tst_qiodevice.cpp
QT = core network
wince*: {
- addFiles.sources = tst_qiodevice.cpp
+ addFiles.files = tst_qiodevice.cpp
addFiles.path = .
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\"\\\"
!wince50standard-x86-msvc2005: DEFINES += WINCE_EMULATOR_TEST=1
} else:symbian {
# SRCDIR defined in code in symbian
- addFiles.sources = tst_qiodevice.cpp
+ addFiles.files = tst_qiodevice.cpp
addFiles.path = .
DEPLOYMENT += addFiles
TARGET.CAPABILITY = NetworkServices
diff --git a/tests/auto/qiodevice/tst_qiodevice.cpp b/tests/auto/qiodevice/tst_qiodevice.cpp
index 7048754..0226402 100644
--- a/tests/auto/qiodevice/tst_qiodevice.cpp
+++ b/tests/auto/qiodevice/tst_qiodevice.cpp
@@ -81,6 +81,8 @@ private slots:
void readLine2_data();
void readLine2();
+
+ void peekBug();
};
// Testing get/set functions
@@ -591,5 +593,62 @@ void tst_QIODevice::readLine2()
}
}
+
+class PeekBug : public QIODevice {
+ Q_OBJECT
+public:
+ char alphabet[27];
+ qint64 counter;
+ PeekBug() : QIODevice(), counter(0) {
+ memcpy(alphabet,"abcdefghijklmnopqrstuvqxyz",27);
+ };
+ qint64 readData(char *data, qint64 maxlen) {
+ qint64 pos = 0;
+ while (pos < maxlen) {
+ *(data + pos) = alphabet[counter];
+ pos++;
+ counter++;
+ if (counter == 26)
+ counter = 0;
+ }
+ return maxlen;
+ }
+ qint64 writeData(const char *data, qint64 maxlen) {
+ return -1;
+ }
+
+};
+
+// This is a testcase for the bug fixed with bd287865
+void tst_QIODevice::peekBug()
+{
+ PeekBug peekBug;
+ peekBug.open(QIODevice::ReadOnly | QIODevice::Unbuffered);
+
+ char onetwo[2];
+ peekBug.peek(onetwo, 2);
+ QCOMPARE(onetwo[0], 'a');
+ QCOMPARE(onetwo[1], 'b');
+
+ peekBug.read(onetwo, 1);
+ QCOMPARE(onetwo[0], 'a');
+
+ peekBug.peek(onetwo, 2);
+ QCOMPARE(onetwo[0], 'b');
+ QCOMPARE(onetwo[1], 'c');
+
+ peekBug.read(onetwo, 1);
+ QCOMPARE(onetwo[0], 'b');
+ peekBug.read(onetwo, 1);
+ QCOMPARE(onetwo[0], 'c');
+ peekBug.read(onetwo, 1);
+ QCOMPARE(onetwo[0], 'd');
+
+ peekBug.peek(onetwo, 2);
+ QCOMPARE(onetwo[0], 'e');
+ QCOMPARE(onetwo[1], 'f');
+
+}
+
QTEST_MAIN(tst_QIODevice)
#include "tst_qiodevice.moc"
diff --git a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
index 2a378fe..97a9b82 100644
--- a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
@@ -235,6 +235,7 @@ private slots:
void enterKey();
void task257859_finalizeEdit();
+ void QTBUG4435_keepSelectionOnCheck();
};
@@ -1168,6 +1169,31 @@ void tst_QItemDelegate::task257859_finalizeEdit()
QTRY_VERIFY(!editor);
}
+void tst_QItemDelegate::QTBUG4435_keepSelectionOnCheck()
+{
+ QStandardItemModel model(3, 1);
+ for (int i = 0; i < 3; ++i) {
+ QStandardItem *item = new QStandardItem(QLatin1String("Item ") + QString::number(i));
+ item->setCheckable(true);
+ item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ model.setItem(i, item);
+ }
+ QTableView view;
+ view.setModel(&model);
+ view.setItemDelegate(new TestItemDelegate);
+ view.show();
+ view.selectAll();
+ QTest::qWaitForWindowShown(&view);
+ QStyleOptionViewItem option;
+ option.rect = view.visualRect(model.index(0, 0));
+ const int checkMargin = qApp->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, 0) + 1;
+ QPoint pos = qApp->style()->subElementRect(QStyle::SE_ViewItemCheckIndicator, &option, 0).center()
+ + QPoint(checkMargin, 0);
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ControlModifier, pos);
+ QTRY_VERIFY(view.selectionModel()->isColumnSelected(0, QModelIndex()));
+ QCOMPARE(model.item(0)->checkState(), Qt::Checked);
+}
+
// ### _not_ covered:
diff --git a/tests/auto/qitemmodel/qitemmodel.pro b/tests/auto/qitemmodel/qitemmodel.pro
index 92709fe..b348a18 100644
--- a/tests/auto/qitemmodel/qitemmodel.pro
+++ b/tests/auto/qitemmodel/qitemmodel.pro
@@ -9,7 +9,7 @@ QT += sql
# memory on Windows Mobile 5.
#wince*: {
-# plugFiles.sources = $$QT_BUILD_TREE/plugins/sqldrivers/*.dll
+# plugFiles.files = $$QT_BUILD_TREE/plugins/sqldrivers/*.dll
# plugFiles.path = sqldrivers
# DEPLOYMENT += plugFiles
#}
@@ -19,7 +19,7 @@ symbian {
qt_not_deployed {
contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
sqlite.path = /sys/bin
- sqlite.sources = sqlite3.dll
+ sqlite.files = sqlite3.dll
DEPLOYMENT += sqlite
}
}
diff --git a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
index 3b2a716..69b1390 100644
--- a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
+++ b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
@@ -94,6 +94,11 @@ private slots:
void task260134_layoutChangedWithAllSelected();
void QTBUG5671_layoutChangedWithAllSelected();
void QTBUG2804_layoutChangedTreeSelection();
+ void deselectRemovedMiddleRange();
+ void rangeOperatorLessThan_data();
+ void rangeOperatorLessThan();
+
+ void testDifferentModels();
private:
QAbstractItemModel *model;
@@ -2353,6 +2358,236 @@ void tst_QItemSelectionModel::QTBUG2804_layoutChangedTreeSelection()
QCOMPARE(selModel.selectedIndexes().count(), 4);
}
+class RemovalObserver : public QObject
+{
+ Q_OBJECT
+ QItemSelectionModel *m_itemSelectionModel;
+public:
+ RemovalObserver(QItemSelectionModel *selectionModel)
+ : m_itemSelectionModel(selectionModel)
+ {
+ connect(m_itemSelectionModel, SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SLOT(selectionChanged(QItemSelection, QItemSelection)));
+ }
+
+public slots:
+ void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
+ {
+ foreach(const QModelIndex &index, deselected.indexes()) {
+ QVERIFY(!m_itemSelectionModel->selection().contains(index));
+ }
+ QVERIFY(m_itemSelectionModel->selection().size() == 2);
+ }
+
+};
+
+void tst_QItemSelectionModel::deselectRemovedMiddleRange()
+{
+ QStandardItemModel model(8, 0);
+
+ for (int row = 0; row < 8; ++row) {
+ static const int column = 0;
+ QStandardItem *item = new QStandardItem(QString::number(row));
+ model.setItem(row, column, item);
+ }
+
+ QItemSelectionModel selModel(&model);
+
+ selModel.select(QItemSelection(model.index(3, 0), model.index(6, 0)), QItemSelectionModel::Select);
+
+ QVERIFY(selModel.selection().size() == 1);
+
+ RemovalObserver ro(&selModel);
+
+ QSignalSpy spy(&selModel, SIGNAL(selectionChanged(QItemSelection, QItemSelection)));
+ bool ok = model.removeRows(4, 2);
+
+ QVERIFY(ok);
+ QVERIFY(spy.size() == 1);
+}
+
+static QStandardItemModel* getModel(QObject *parent)
+{
+ QStandardItemModel *model = new QStandardItemModel(parent);
+
+ for (int i = 0; i < 4; ++i) {
+ QStandardItem *parentItem = model->invisibleRootItem();
+ QList<QStandardItem*> list;
+ for (int j = 0; j < 4; ++j) {
+ list.append(new QStandardItem(QString("item %1, %2").arg(i).arg(j)));
+ }
+ parentItem->appendRow(list);
+ parentItem = list.first();
+ for (int j = 0; j < 4; ++j) {
+ QList<QStandardItem*> list;
+ for (int k = 0; k < 4; ++k) {
+ list.append(new QStandardItem(QString("item %1, %2").arg(i).arg(j)));
+ }
+ parentItem->appendRow(list);
+ }
+ }
+ return model;
+}
+
+enum Result {
+ LessThan,
+ NotLessThan,
+ NotEqual
+};
+
+Q_DECLARE_METATYPE(Result);
+
+void tst_QItemSelectionModel::rangeOperatorLessThan_data()
+{
+ QTest::addColumn<int>("parent1");
+ QTest::addColumn<int>("top1");
+ QTest::addColumn<int>("left1");
+ QTest::addColumn<int>("bottom1");
+ QTest::addColumn<int>("right1");
+ QTest::addColumn<int>("parent2");
+ QTest::addColumn<int>("top2");
+ QTest::addColumn<int>("left2");
+ QTest::addColumn<int>("bottom2");
+ QTest::addColumn<int>("right2");
+ QTest::addColumn<Result>("result");
+
+ QTest::newRow("lt01") << -1 << 0 << 0 << 3 << 3
+ << -1 << 0 << 0 << 3 << 3 << NotLessThan;
+
+ QTest::newRow("lt02") << -1 << 0 << 0 << 2 << 3
+ << -1 << 0 << 0 << 3 << 3 << LessThan;
+ QTest::newRow("lt03") << -1 << 0 << 0 << 3 << 2
+ << -1 << 0 << 0 << 3 << 3 << LessThan;
+ QTest::newRow("lt04") << -1 << 0 << 0 << 2 << 2
+ << -1 << 0 << 0 << 3 << 3 << LessThan;
+
+ QTest::newRow("lt05") << -1 << 0 << 0 << 3 << 3
+ << -1 << 0 << 0 << 2 << 3 << NotLessThan;
+ QTest::newRow("lt06") << -1 << 0 << 0 << 3 << 3
+ << -1 << 0 << 0 << 3 << 2 << NotLessThan;
+ QTest::newRow("lt07") << -1 << 0 << 0 << 3 << 3
+ << -1 << 0 << 0 << 2 << 2 << NotLessThan;
+
+ QTest::newRow("lt08") << -1 << 0 << 0 << 3 << 3
+ << 0 << 0 << 0 << 3 << 3 << NotEqual;
+ QTest::newRow("lt09") << 1 << 0 << 0 << 3 << 3
+ << 0 << 0 << 0 << 3 << 3 << NotEqual;
+ QTest::newRow("lt10") << 1 << 0 << 0 << 1 << 1
+ << 0 << 2 << 2 << 3 << 3 << NotEqual;
+ QTest::newRow("lt11") << 1 << 2 << 2 << 3 << 3
+ << 0 << 0 << 0 << 1 << 1 << NotEqual;
+
+ QTest::newRow("lt12") << -1 << 0 << 0 << 1 << 1
+ << -1 << 2 << 2 << 3 << 3 << LessThan;
+ QTest::newRow("lt13") << -1 << 2 << 2 << 3 << 3
+ << -1 << 0 << 0 << 1 << 1 << NotLessThan;
+ QTest::newRow("lt14") << 1 << 0 << 0 << 1 << 1
+ << 1 << 2 << 2 << 3 << 3 << LessThan;
+ QTest::newRow("lt15") << 1 << 2 << 2 << 3 << 3
+ << 1 << 0 << 0 << 1 << 1 << NotLessThan;
+
+ QTest::newRow("lt16") << -1 << 0 << 0 << 2 << 2
+ << -1 << 1 << 1 << 3 << 3 << LessThan;
+ QTest::newRow("lt17") << -1 << 1 << 1 << 3 << 3
+ << -1 << 0 << 0 << 2 << 2 << NotLessThan;
+ QTest::newRow("lt18") << 1 << 0 << 0 << 2 << 2
+ << 1 << 1 << 1 << 3 << 3 << LessThan;
+ QTest::newRow("lt19") << 1 << 1 << 1 << 3 << 3
+ << 1 << 0 << 0 << 2 << 2 << NotLessThan;
+}
+
+void tst_QItemSelectionModel::rangeOperatorLessThan()
+{
+ QStandardItemModel *model1 = getModel(this);
+ QStandardItemModel *model2 = getModel(this);
+
+ QFETCH(int, parent1);
+ QFETCH(int, top1);
+ QFETCH(int, left1);
+ QFETCH(int, bottom1);
+ QFETCH(int, right1);
+ QFETCH(int, parent2);
+ QFETCH(int, top2);
+ QFETCH(int, left2);
+ QFETCH(int, bottom2);
+ QFETCH(int, right2);
+ QFETCH(Result, result);
+
+ QModelIndex p1 = model1->index(parent1, 0);
+
+ QModelIndex tl1 = model1->index(top1, left1, p1);
+ QModelIndex br1 = model1->index(bottom1, right1, p1);
+
+ QItemSelectionRange r1(tl1, br1);
+
+ QModelIndex p2 = model1->index(parent2, 0);
+
+ QModelIndex tl2 = model1->index(top2, left2, p2);
+ QModelIndex br2 = model1->index(bottom2, right2, p2);
+
+ QItemSelectionRange r2(tl2, br2);
+
+ if (result == LessThan)
+ QVERIFY(r1 < r2);
+ else if (result == NotLessThan)
+ QVERIFY(!(r1 < r2));
+ else if (result == NotEqual)
+ if (!(r1 < r2))
+ QVERIFY(r2 < r1);
+
+ // Ranges in different models are always non-equal
+
+ QModelIndex p3 = model2->index(parent1, 0);
+
+ QModelIndex tl3 = model2->index(top1, left1, p3);
+ QModelIndex br3 = model2->index(bottom1, right1, p3);
+
+ QItemSelectionRange r3(tl3, br3);
+
+ if (!(r1 < r3))
+ QVERIFY(r3 < r1);
+
+ if (!(r2 < r3))
+ QVERIFY(r3 < r2);
+
+ QModelIndex p4 = model2->index(parent2, 0);
+
+ QModelIndex tl4 = model2->index(top2, left2, p4);
+ QModelIndex br4 = model2->index(bottom2, right2, p4);
+
+ QItemSelectionRange r4(tl4, br4);
+
+ if (!(r1 < r4))
+ QVERIFY(r4 < r1);
+
+ if (!(r2 < r4))
+ QVERIFY(r4 < r2);
+}
+
+void tst_QItemSelectionModel::testDifferentModels()
+{
+ QStandardItemModel model1;
+ QStandardItemModel model2;
+ QStandardItem top11("Child1"), top12("Child2"), top13("Child3");
+ QStandardItem top21("Child1"), top22("Child2"), top23("Child3");
+
+ model1.appendColumn(QList<QStandardItem*>() << &top11 << &top12 << &top13);
+ model2.appendColumn(QList<QStandardItem*>() << &top21 << &top22 << &top23);
+
+
+ QModelIndex topIndex1 = model1.index(0, 0);
+ QModelIndex bottomIndex1 = model1.index(2, 0);
+ QModelIndex topIndex2 = model2.index(0, 0);
+
+ QItemSelectionRange range(topIndex1, bottomIndex1);
+
+ QVERIFY(range.intersects(QItemSelectionRange(topIndex1, topIndex1)));
+ QVERIFY(!range.intersects(QItemSelectionRange(topIndex2, topIndex2)));
+
+ QItemSelection newSelection;
+ QItemSelection::split(range, QItemSelectionRange(topIndex2, topIndex2), &newSelection);
+
+ QVERIFY(newSelection.isEmpty());
+}
QTEST_MAIN(tst_QItemSelectionModel)
#include "tst_qitemselectionmodel.moc"
diff --git a/tests/auto/qlabel/qlabel.pro b/tests/auto/qlabel/qlabel.pro
index 297f868..057a6f1 100644
--- a/tests/auto/qlabel/qlabel.pro
+++ b/tests/auto/qlabel/qlabel.pro
@@ -3,7 +3,7 @@ SOURCES += tst_qlabel.cpp
wince*::DEFINES += SRCDIR=\\\"\\\"
else:!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\"
wince*|symbian {
- addFiles.sources = *.png \
+ addFiles.files = *.png \
testdata
addFiles.path = .
DEPLOYMENT += addFiles
diff --git a/tests/auto/qlayout/qlayout.pro b/tests/auto/qlayout/qlayout.pro
index c99f1d9..dfa8584 100644
--- a/tests/auto/qlayout/qlayout.pro
+++ b/tests/auto/qlayout/qlayout.pro
@@ -7,7 +7,7 @@ load(qttest_p4)
SOURCES += tst_qlayout.cpp
contains(QT_CONFIG, qt3support): QT += qt3support
wince*|symbian: {
- addFiles.sources = baseline
+ addFiles.files = baseline
addFiles.path = .
DEPLOYMENT += addFiles
}
diff --git a/tests/auto/qlibrary/tst/tst.pro b/tests/auto/qlibrary/tst/tst.pro
index 4c647c0..28c40b0 100644
--- a/tests/auto/qlibrary/tst/tst.pro
+++ b/tests/auto/qlibrary/tst/tst.pro
@@ -12,18 +12,18 @@ win32 {
}
wince*: {
- addFiles.sources = ../*.dll ../*.dl2 ../mylib_noextension
+ addFiles.files = ../*.dll ../*.dl2 ../mylib_noextension
addFiles.path = .
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\"\\\"
}else:symbian {
- binDep.sources = \
+ binDep.files = \
mylib.dll \
system.trolltech.test.mylib.dll
binDep.path = /sys/bin
#mylib.dl2 nonstandard binary deployment will cause warning in emulator,
#but it can be safely ignored.
- custBinDep.sources = mylib.dl2
+ custBinDep.files = mylib.dl2
custBinDep.path = /sys/bin
DEPLOYMENT += binDep custBinDep
diff --git a/tests/auto/qlibrary/tst_qlibrary.cpp b/tests/auto/qlibrary/tst_qlibrary.cpp
index d4884db..99e6de3 100644
--- a/tests/auto/qlibrary/tst_qlibrary.cpp
+++ b/tests/auto/qlibrary/tst_qlibrary.cpp
@@ -53,6 +53,7 @@
#define a_VALID false
#define so_VALID false
#define dll_VALID false
+#define DLL_VALID false
#if defined(Q_OS_DARWIN)
# undef bundle_VALID
@@ -88,6 +89,8 @@
#elif defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
# undef dll_VALID
# define dll_VALID true
+# undef DLL_VALID
+# define DLL_VALID true
# define SUFFIX ".dll"
# define PREFIX ""
@@ -200,6 +203,7 @@ void tst_QLibrary::version()
VersionFunction fnVersion = (VersionFunction)library.resolve("mylibversion");
QVERIFY(fnVersion);
QCOMPARE(fnVersion(), resultversion);
+ QVERIFY(library.unload());
#else
Q_UNUSED(lib);
Q_UNUSED(loadversion);
@@ -246,6 +250,7 @@ void tst_QLibrary::load()
bool ok = library.load();
if ( result ) {
QVERIFY( ok );
+ QVERIFY(library.unload());
} else {
QVERIFY( !ok );
}
@@ -335,6 +340,7 @@ void tst_QLibrary::resolve()
} else {
QVERIFY( func == 0 );
}
+ library.unload();
}
void tst_QLibrary::library_data()
@@ -352,6 +358,7 @@ void tst_QLibrary::isLibrary_data()
QTest::newRow(".a") << QString("mylib.a") << a_VALID;
QTest::newRow(".bundle") << QString("mylib.bundle") << bundle_VALID;
QTest::newRow(".dll") << QString("mylib.dll") << dll_VALID;
+ QTest::newRow(".DLL") << QString("MYLIB.DLL") << DLL_VALID;
QTest::newRow(".dl2" ) << QString("mylib.dl2") << false;
QTest::newRow(".dylib") << QString("mylib.dylib") << dylib_VALID;
QTest::newRow(".sl") << QString("mylib.sl") << sl_VALID;
@@ -465,7 +472,9 @@ void tst_QLibrary::errorString()
break;
}
QRegExp re(errorString);
- QVERIFY2(re.exactMatch(lib.errorString()), qPrintable(lib.errorString()));
+ QString libErrorString = lib.errorString();
+ QVERIFY(!lib.isLoaded() || lib.unload());
+ QVERIFY2(re.exactMatch(libErrorString), qPrintable(libErrorString));
QCOMPARE(ok, success);
}
@@ -521,6 +530,7 @@ void tst_QLibrary::loadHints()
bool ok = library.load();
if ( result ) {
QVERIFY( ok );
+ QVERIFY(library.unload());
} else {
QVERIFY( !ok );
}
@@ -556,7 +566,12 @@ void tst_QLibrary::fileName()
}
QVERIFY(ok);
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ QCOMPARE(lib.fileName().toLower(), expectedFilename.toLower());
+#else
QCOMPARE(lib.fileName(), expectedFilename);
+#endif
+ QVERIFY(lib.unload());
}
@@ -568,29 +583,42 @@ void tst_QLibrary::multipleInstancesForOneLibrary()
QString lib = QDir::currentPath() + "/mylib";
#endif
- QLibrary lib1(lib);
- QLibrary lib2(lib);
- QCOMPARE(lib1.isLoaded(), false);
- QCOMPARE(lib2.isLoaded(), false);
- lib1.load();
- QCOMPARE(lib1.isLoaded(), true);
- QCOMPARE(lib2.isLoaded(), true);
- QCOMPARE(lib1.unload(), true);
- QCOMPARE(lib1.isLoaded(), false);
- QCOMPARE(lib2.isLoaded(), false);
- lib1.load();
- lib2.load();
- QCOMPARE(lib1.isLoaded(), true);
- QCOMPARE(lib2.isLoaded(), true);
- QCOMPARE(lib1.unload(), false);
- QCOMPARE(lib1.isLoaded(), true);
- QCOMPARE(lib2.isLoaded(), true);
- QCOMPARE(lib2.unload(), true);
- QCOMPARE(lib1.isLoaded(), false);
- QCOMPARE(lib2.isLoaded(), false);
+ {
+ QLibrary lib1(lib);
+ QLibrary lib2(lib);
+ QCOMPARE(lib1.isLoaded(), false);
+ QCOMPARE(lib2.isLoaded(), false);
+ lib1.load();
+ QCOMPARE(lib1.isLoaded(), true);
+ QCOMPARE(lib2.isLoaded(), true);
+ QCOMPARE(lib1.unload(), true);
+ QCOMPARE(lib1.isLoaded(), false);
+ QCOMPARE(lib2.isLoaded(), false);
+ lib1.load();
+ lib2.load();
+ QCOMPARE(lib1.isLoaded(), true);
+ QCOMPARE(lib2.isLoaded(), true);
+ QCOMPARE(lib1.unload(), false);
+ QCOMPARE(lib1.isLoaded(), true);
+ QCOMPARE(lib2.isLoaded(), true);
+ QCOMPARE(lib2.unload(), true);
+ QCOMPARE(lib1.isLoaded(), false);
+ QCOMPARE(lib2.isLoaded(), false);
+
+ // Finally; unload on that is already unloaded
+ QCOMPARE(lib1.unload(), false);
+ }
- // Finally; unload on that is already unloaded
- QCOMPARE(lib1.unload(), false);
+ //now let's try with a 3rd one that will go out of scope
+ {
+ QLibrary lib1(lib);
+ QCOMPARE(lib1.isLoaded(), false);
+ lib1.load();
+ QCOMPARE(lib1.isLoaded(), true);
+ }
+ QLibrary lib2(lib);
+ //lib2 should be loaded because lib1 was loaded and never unloaded
+ QCOMPARE(lib2.isLoaded(), true);
/*
lib1.setLoadHints(QLibrary::ResolveAllSymbolsHint);
diff --git a/tests/auto/qlist/tst_qlist.cpp b/tests/auto/qlist/tst_qlist.cpp
index ba8aefa..14b8057 100644
--- a/tests/auto/qlist/tst_qlist.cpp
+++ b/tests/auto/qlist/tst_qlist.cpp
@@ -89,6 +89,8 @@ private slots:
void testSTLIterators() const;
void testOperators() const;
+
+ void initializeList() const;
};
void tst_QList::length() const
@@ -662,5 +664,19 @@ void tst_QList::testSTLIterators() const
QCOMPARE(*it, QLatin1String("foo"));
}
+void tst_QList::initializeList() const
+{
+#ifdef Q_COMPILER_INITIALIZER_LISTS
+ QList<int> v1{2,3,4};
+ QCOMPARE(v1, QList<int>() << 2 << 3 << 4);
+ QCOMPARE(v1, (QList<int>{2,3,4}));
+
+ QList<QList<int>> v2{ v1, {1}, QList<int>(), {2,3,4} };
+ QList<QList<int>> v3;
+ v3 << v1 << (QList<int>() << 1) << QList<int>() << v1;
+ QCOMPARE(v3, v2);
+#endif
+}
+
QTEST_APPLESS_MAIN(tst_QList)
#include "tst_qlist.moc"
diff --git a/tests/auto/qlocale/test/test.pro b/tests/auto/qlocale/test/test.pro
index 6512e19..8117708 100644
--- a/tests/auto/qlocale/test/test.pro
+++ b/tests/auto/qlocale/test/test.pro
@@ -22,7 +22,7 @@ QT += network
embedded: QT += gui
wince*: {
- addFiles.sources = \
+ addFiles.files = \
../syslocaleapp
addFiles.path = "\\Program Files\\tst_qlocale"
diff --git a/tests/auto/qlocalsocket/test/test.pro b/tests/auto/qlocalsocket/test/test.pro
index 687aae2..f91fe58 100644
--- a/tests/auto/qlocalsocket/test/test.pro
+++ b/tests/auto/qlocalsocket/test/test.pro
@@ -28,19 +28,19 @@ CONFIG(debug_and_release) {
}
wince* {
- additionalFiles.sources = ../lackey/lackey.exe
+ additionalFiles.files = ../lackey/lackey.exe
additionalFiles.path = lackey
}
symbian {
- additionalFiles.sources = lackey.exe
+ additionalFiles.files = lackey.exe
additionalFiles.path = \\sys\\bin
TARGET.UID3 = 0xE0340005
DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x",""))
}
wince*|symbian {
- scriptFiles.sources = ../lackey/scripts/*.js
+ scriptFiles.files = ../lackey/scripts/*.js
scriptFiles.path = lackey/scripts
DEPLOYMENT = additionalFiles scriptFiles
QT += script # for easy deployment of QtScript
diff --git a/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp
index 5709196..22c679a 100644
--- a/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp
+++ b/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp
@@ -2822,10 +2822,9 @@ void tst_QMatrixNxN::convertGeneric()
9.0f, 10.0f, 11.0f, 12.0f,
0.0f, 0.0f, 0.0f, 1.0f
};
-#if !defined(QT_NO_MEMBER_TEMPLATES)
QMatrix4x4 m4(m1);
QVERIFY(isSame(m4, unique4x4));
-#endif
+
QMatrix4x4 m5 = qGenericMatrixToMatrix4x4(m1);
QVERIFY(isSame(m5, unique4x4));
@@ -2835,10 +2834,9 @@ void tst_QMatrixNxN::convertGeneric()
9.0f, 10.0f, 11.0f, 12.0f
};
QMatrix4x4 m9(uniqueValues4);
-#if !defined(QT_NO_MEMBER_TEMPLATES)
+
QMatrix4x3 m10 = m9.toGenericMatrix<4, 3>();
QVERIFY(isSame(m10, conv4x4));
-#endif
QMatrix4x3 m11 = qGenericMatrixFromMatrix4x4<4, 3>(m9);
QVERIFY(isSame(m11, conv4x4));
diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp
index 8c2a0f9..1d0980e 100644
--- a/tests/auto/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp
@@ -155,6 +155,7 @@ private slots:
void connectSlotsByName();
void invokeMetaMember();
void invokeQueuedMetaMember();
+ void invokeBlockingQueuedMetaMember();
void invokeCustomTypes();
void invokeMetaConstructor();
void invokeTypedefTypes();
@@ -336,6 +337,9 @@ public slots:
void testLongLong(qint64 ll1, quint64 ll2);
+ void moveToThread(QThread *t)
+ { QObject::moveToThread(t); }
+
signals:
void sig0();
QString sig1(QString s1);
@@ -583,6 +587,138 @@ void tst_QMetaObject::invokeQueuedMetaMember()
QCOMPARE(obj.slotResult, QString("testLongLong:-1,0"));
}
+void tst_QMetaObject::invokeBlockingQueuedMetaMember()
+{
+ QThread t;
+ t.start();
+ QtTestObject obj;
+ obj.moveToThread(&t);
+
+ QString t1("1"); QString t2("2"); QString t3("3"); QString t4("4"); QString t5("5");
+ QString t6("6"); QString t7("7"); QString t8("8"); QString t9("9"); QString t10("X");
+
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sl1", Qt::BlockingQueuedConnection, Q_ARG(QString, t1)));
+ QCOMPARE(obj.slotResult, QString("sl1:1"));
+
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sl2", Qt::BlockingQueuedConnection, Q_ARG(const QString, t1), Q_ARG(QString, t2)));
+ QCOMPARE(obj.slotResult, QString("sl2:12"));
+
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sl3", Qt::BlockingQueuedConnection, Q_ARG(QString, t1), Q_ARG(QString, t2), Q_ARG(QString, t3)));
+ QCOMPARE(obj.slotResult, QString("sl3:123"));
+
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sl4", Qt::BlockingQueuedConnection, Q_ARG(QString, t1), Q_ARG(QString, t2),
+ Q_ARG(QString, t3), Q_ARG(QString, t4)));
+ QCOMPARE(obj.slotResult, QString("sl4:1234"));
+
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sl5", Qt::BlockingQueuedConnection, Q_ARG(QString, t1), Q_ARG(QString, t2),
+ Q_ARG(QString, t3), Q_ARG(QString, t4), Q_ARG(QString, "5")));
+ QCOMPARE(obj.slotResult, QString("sl5:12345"));
+
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sl6", Qt::BlockingQueuedConnection, Q_ARG(QString, t1), Q_ARG(QString, t2),
+ Q_ARG(QString, t3), Q_ARG(QString, t4), Q_ARG(QString, t5), Q_ARG(QString, t6)));
+ QCOMPARE(obj.slotResult, QString("sl6:123456"));
+
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sl7", Qt::BlockingQueuedConnection, Q_ARG(QString, t1), Q_ARG(QString, t2),
+ Q_ARG(QString, t3), Q_ARG(QString, t4), Q_ARG(QString, t5), Q_ARG(QString, t6),
+ Q_ARG(QString, t7)));
+ QCOMPARE(obj.slotResult, QString("sl7:1234567"));
+
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sl8", Qt::BlockingQueuedConnection, Q_ARG(QString, t1), Q_ARG(QString, t2),
+ Q_ARG(QString, t3), Q_ARG(QString, t4), Q_ARG(QString, t5), Q_ARG(QString, t6),
+ Q_ARG(QString, t7), Q_ARG(QString, t8)));
+ QCOMPARE(obj.slotResult, QString("sl8:12345678"));
+
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sl9", Qt::BlockingQueuedConnection, Q_ARG(QString, t1), Q_ARG(QString, t2),
+ Q_ARG(QString, t3), Q_ARG(QString, t4), Q_ARG(QString, t5), Q_ARG(QString, t6),
+ Q_ARG(QString, t7), Q_ARG(QString, t8), Q_ARG(QString, t9)));
+ QCOMPARE(obj.slotResult, QString("sl9:123456789"));
+
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sl11", Qt::BlockingQueuedConnection));
+ QCOMPARE(obj.slotResult, QString("sl11"));
+
+ QVERIFY(QMetaObject::invokeMethod(&obj, "testSender", Qt::BlockingQueuedConnection));
+ QCOMPARE(obj.slotResult, QString("0x0"));
+
+ QString refStr("whatever");
+ QVERIFY(QMetaObject::invokeMethod(&obj, "testReference", Qt::BlockingQueuedConnection, QGenericArgument("QString&", &refStr)));
+ QCOMPARE(obj.slotResult, QString("testReference:whatever"));
+ QCOMPARE(refStr, QString("gotcha"));
+
+ qint64 ll1 = -1;
+ quint64 ll2 = 0;
+ QVERIFY(QMetaObject::invokeMethod(&obj,
+ "testLongLong",
+ Qt::BlockingQueuedConnection,
+ Q_ARG(qint64, ll1),
+ Q_ARG(quint64, ll2)));
+ QCOMPARE(obj.slotResult, QString("testLongLong:-1,0"));
+
+ QString exp;
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sl1", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QString, exp), Q_ARG(QString, "bubu")));
+ QCOMPARE(exp, QString("yessir"));
+ QCOMPARE(obj.slotResult, QString("sl1:bubu"));
+
+ QObject *ptr = 0;
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sl11", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QObject*,ptr)));
+ QCOMPARE(ptr, (QObject *)&obj);
+ QCOMPARE(obj.slotResult, QString("sl11"));
+ // try again with a space:
+ ptr = 0;
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sl11", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QObject * , ptr)));
+ QCOMPARE(ptr, (QObject *)&obj);
+ QCOMPARE(obj.slotResult, QString("sl11"));
+
+ const char *ptr2 = 0;
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sl12", Qt::BlockingQueuedConnection, Q_RETURN_ARG(const char*, ptr2)));
+ QVERIFY(ptr2 != 0);
+ QCOMPARE(obj.slotResult, QString("sl12"));
+ // try again with a space:
+ ptr2 = 0;
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sl12", Qt::BlockingQueuedConnection, Q_RETURN_ARG(char const * , ptr2)));
+ QVERIFY(ptr2 != 0);
+ QCOMPARE(obj.slotResult, QString("sl12"));
+
+ // test w/ template args
+ QList<QString> returnValue, argument;
+ argument << QString("one") << QString("two") << QString("three");
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sl13", Qt::BlockingQueuedConnection,
+ Q_RETURN_ARG(QList<QString>, returnValue),
+ Q_ARG(QList<QString>, argument)));
+ QCOMPARE(returnValue, argument);
+ QCOMPARE(obj.slotResult, QString("sl13"));
+
+ //test signals
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sig0", Qt::BlockingQueuedConnection));
+ QCOMPARE(obj.slotResult, QString("sl0"));
+
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sig1", Qt::BlockingQueuedConnection, Q_ARG(QString, "baba")));
+ QCOMPARE(obj.slotResult, QString("sl1:baba"));
+
+ exp.clear();
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sig1", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QString, exp), Q_ARG(QString, "hehe")));
+ QCOMPARE(exp, QString("yessir"));
+ QCOMPARE(obj.slotResult, QString("sl1:hehe"));
+
+ QTest::ignoreMessage(QtWarningMsg, "QMetaObject::invokeMethod: No such method QtTestObject::doesNotExist()");
+ QVERIFY(!QMetaObject::invokeMethod(&obj, "doesNotExist", Qt::BlockingQueuedConnection));
+ QTest::ignoreMessage(QtWarningMsg, "QMetaObject::invokeMethod: No such method QtTestObject::sl1(QString)(QString)");
+ QVERIFY(!QMetaObject::invokeMethod(&obj, "sl1(QString)", Qt::BlockingQueuedConnection, Q_ARG(QString, "arg")));
+ QTest::ignoreMessage(QtWarningMsg, "QMetaObject::invokeMethod: No such method QtTestObject::sl3(QString)");
+ QVERIFY(!QMetaObject::invokeMethod(&obj, "sl3", Qt::BlockingQueuedConnection, Q_ARG(QString, "arg")));
+ QTest::ignoreMessage(QtWarningMsg, "QMetaObject::invokeMethod: No such method QtTestObject::sl1(QString,QString,QString)");
+ QVERIFY(!QMetaObject::invokeMethod(&obj, "sl1", Qt::BlockingQueuedConnection, Q_ARG(QString, "arg"), Q_ARG(QString, "arg"), Q_ARG(QString, "arg")));
+
+ //should not have changed since last test.
+ QCOMPARE(exp, QString("yessir"));
+ QCOMPARE(obj.slotResult, QString("sl1:hehe"));
+
+ QVERIFY(QMetaObject::invokeMethod(&obj, "moveToThread", Qt::BlockingQueuedConnection, Q_ARG(QThread*, QThread::currentThread())));
+ t.quit();
+ QVERIFY(t.wait());
+
+}
+
+
void tst_QMetaObject::qtMetaObjectInheritance()
{
diff --git a/tests/auto/qmetatype/tst_qmetatype.cpp b/tests/auto/qmetatype/tst_qmetatype.cpp
index 8558e06..eaa19d0 100644
--- a/tests/auto/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/qmetatype/tst_qmetatype.cpp
@@ -160,6 +160,11 @@ void tst_QMetaType::qMetaTypeId()
QCOMPARE(::qMetaTypeId<QString>(), int(QMetaType::QString));
QCOMPARE(::qMetaTypeId<int>(), int(QMetaType::Int));
QCOMPARE(::qMetaTypeId<TestSpace::Foo>(), QMetaType::type("TestSpace::Foo"));
+
+ QCOMPARE(::qMetaTypeId<char>(), QMetaType::type("char"));
+ QCOMPARE(::qMetaTypeId<uchar>(), QMetaType::type("unsigned char"));
+ QCOMPARE(::qMetaTypeId<signed char>(), QMetaType::type("signed char"));
+ QCOMPARE(::qMetaTypeId<qint8>(), QMetaType::type("qint8"));
}
void tst_QMetaType::properties()
diff --git a/tests/auto/qmovie/qmovie.pro b/tests/auto/qmovie/qmovie.pro
index 510a70e..6973955 100644
--- a/tests/auto/qmovie/qmovie.pro
+++ b/tests/auto/qmovie/qmovie.pro
@@ -7,19 +7,19 @@ MOC_DIR=tmp
!contains(QT_CONFIG, no-mng):DEFINES += QTEST_HAVE_MNG
wince*: {
- addFiles.sources = animations\\*
+ addFiles.files = animations\\*
addFiles.path = animations
DEPLOYMENT += addFiles
}
symbian: {
- addFiles.sources = animations\\*
+ addFiles.files = animations\\*
addFiles.path = animations
DEPLOYMENT += addFiles
qt_not_deployed {
- imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll
+ imagePlugins.files = qjpeg.dll qgif.dll qmng.dll
imagePlugins.path = imageformats
DEPLOYMENT += imagePlugins
}
diff --git a/tests/auto/qnetworkreply/test/test.pro b/tests/auto/qnetworkreply/test/test.pro
index 6e1b1e3..7efc2fb 100644
--- a/tests/auto/qnetworkreply/test/test.pro
+++ b/tests/auto/qnetworkreply/test/test.pro
@@ -16,17 +16,17 @@ QT = core network
RESOURCES += ../qnetworkreply.qrc
wince*: {
- addFiles.sources = ../empty ../rfc3252.txt ../resource
+ addFiles.files = ../empty ../rfc3252.txt ../resource
addFiles.path = .
DEPLOYMENT += addFiles
}
symbian:{
- addFiles.sources = ../empty ../rfc3252.txt ../resource ../bigfile
+ addFiles.files = ../empty ../rfc3252.txt ../resource ../bigfile
addFiles.path = .
DEPLOYMENT += addFiles
- certFiles.sources = ../certs
+ certFiles.files = ../certs
certFiles.path = .
DEPLOYMENT += certFiles
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 306b5f8..f7f0519 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -75,7 +75,7 @@
#include "../network-settings.h"
-
+Q_DECLARE_METATYPE(QSharedPointer<char>)
Q_DECLARE_METATYPE(QNetworkReply*)
Q_DECLARE_METATYPE(QAuthenticator*)
Q_DECLARE_METATYPE(QNetworkProxy)
@@ -289,6 +289,14 @@ private Q_SLOTS:
void symbianOpenCDataUrlCrash();
+ void getFromHttpIntoBuffer_data();
+ void getFromHttpIntoBuffer();
+ void getFromHttpIntoBuffer2_data();
+ void getFromHttpIntoBuffer2();
+
+ void ioGetFromHttpWithoutContentLength();
+
+ void ioGetFromHttpBrokenChunkedEncoding();
void qtbug12908compressedHttpReply();
// NOTE: This test must be last!
@@ -1173,6 +1181,12 @@ void tst_QNetworkReply::getErrors_data()
QTest::addColumn<int>("httpStatusCode");
QTest::addColumn<bool>("dataIsEmpty");
+ // empties
+ QTest::newRow("empty-url") << QString() << int(QNetworkReply::ProtocolUnknownError) << 0 << true;
+ QTest::newRow("empty-scheme-host") << SRCDIR "/rfc3252.txt" << int(QNetworkReply::ProtocolUnknownError) << 0 << true;
+ QTest::newRow("empty-scheme") << "//" + QtNetworkSettings::winServerName() + "/testshare/test.pri"
+ << int(QNetworkReply::ProtocolUnknownError) << 0 << true;
+
// file: errors
QTest::newRow("file-host") << "file://this-host-doesnt-exist.troll.no/foo.txt"
#if !defined Q_OS_WIN
@@ -3932,6 +3946,7 @@ void tst_QNetworkReply::authorizationError()
QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), httpStatusCode);
QFETCH(QString, httpBody);
+ QCOMPARE(qint64(reply->size()), qint64(httpBody.size()));
QCOMPARE(QString(reply->readAll()), httpBody);
}
@@ -4276,6 +4291,263 @@ void tst_QNetworkReply::symbianOpenCDataUrlCrash()
QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), qint64(598));
}
+void tst_QNetworkReply::getFromHttpIntoBuffer_data()
+{
+ QTest::addColumn<QUrl>("url");
+
+ QTest::newRow("rfc-internal") << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt");
+}
+
+// Please note that the whole "zero copy" download buffer API is private right now. Do not use it.
+void tst_QNetworkReply::getFromHttpIntoBuffer()
+{
+ QFETCH(QUrl, url);
+ QNetworkRequest request(url);
+ request.setAttribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute, 1024*128); // 128 kB
+
+ QNetworkAccessManager manager;
+ QNetworkReply *reply = manager.get(request);
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+
+ QTestEventLoop::instance().enterLoop(10);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QVERIFY(reply->isFinished());
+
+ QFile reference(SRCDIR "/rfc3252.txt");
+ QVERIFY(reference.open(QIODevice::ReadOnly));
+
+ QCOMPARE(reference.bytesAvailable(), reply->bytesAvailable());
+ QCOMPARE(reference.size(), reply->size());
+
+ // Compare the memory buffer
+ QVariant downloadBufferAttribute = reply->attribute(QNetworkRequest::DownloadBufferAttribute);
+ QVERIFY(downloadBufferAttribute.isValid());
+ QSharedPointer<char> sharedPointer = downloadBufferAttribute.value<QSharedPointer<char> >();
+ bool memoryComparison =
+ (0 == memcmp(static_cast<void*>(reference.readAll().data()),
+ sharedPointer.data(), reference.size()));
+ QVERIFY(memoryComparison);
+
+ // Make sure the normal reading works
+ reference.seek(0);
+ QCOMPARE(reply->read(42), reference.read(42));
+ QCOMPARE(reply->getChar(0), reference.getChar(0));
+ QCOMPARE(reply->peek(23), reference.peek(23));
+ QCOMPARE(reply->readLine(), reference.readLine());
+ QCOMPARE(reference.bytesAvailable(), reply->bytesAvailable());
+ QCOMPARE(reply->readAll(), reference.readAll());
+ QVERIFY(reply->atEnd());
+}
+
+// FIXME we really need to consolidate all those server implementations
+class GetFromHttpIntoBuffer2Server : QObject {
+ Q_OBJECT;
+ qint64 dataSize;
+ qint64 dataSent;
+ QTcpServer server;
+ QTcpSocket *client;
+ bool serverSendsContentLength;
+ bool chunkedEncoding;
+
+public:
+ GetFromHttpIntoBuffer2Server (qint64 ds, bool sscl, bool ce) : dataSize(ds), dataSent(0),
+ client(0), serverSendsContentLength(sscl), chunkedEncoding(ce) {
+ server.listen();
+ connect(&server, SIGNAL(newConnection()), this, SLOT(newConnectionSlot()));
+ }
+
+ int serverPort() {
+ return server.serverPort();
+ }
+
+public slots:
+
+ void newConnectionSlot() {
+ client = server.nextPendingConnection();
+ client->setParent(this);
+ connect(client, SIGNAL(readyRead()), this, SLOT(readyReadSlot()));
+ connect(client, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot(qint64)));
+ }
+
+ void readyReadSlot() {
+ client->readAll();
+ client->write("HTTP/1.0 200 OK\n");
+ if (serverSendsContentLength)
+ client->write(QString("Content-Length: " + QString::number(dataSize) + "\n").toAscii());
+ if (chunkedEncoding)
+ client->write(QString("Transfer-Encoding: chunked\n").toAscii());
+ client->write("Connection: close\n\n");
+ }
+
+ void bytesWrittenSlot(qint64 amount) {
+ Q_UNUSED(amount);
+ if (dataSent == dataSize && client) {
+ // close eventually
+
+ // chunked encoding: we have to send a last "empty" chunk
+ if (chunkedEncoding)
+ client->write(QString("0\r\n\r\n").toAscii());
+
+ client->disconnectFromHost();
+ server.close();
+ client = 0;
+ return;
+ }
+
+ // send data
+ if (client && client->bytesToWrite() < 100*1024 && dataSent < dataSize) {
+ qint64 amount = qMin(qint64(16*1024), dataSize - dataSent);
+ QByteArray data(amount, '@');
+
+ if (chunkedEncoding) {
+ client->write(QString(QString("%1").arg(amount,0,16).toUpper() + "\r\n").toAscii());
+ client->write(data.constData(), amount);
+ client->write(QString("\r\n").toAscii());
+ } else {
+ client->write(data.constData(), amount);
+ }
+
+ dataSent += amount;
+ }
+ }
+};
+
+class GetFromHttpIntoBuffer2Client : QObject {
+ Q_OBJECT
+private:
+ bool useDownloadBuffer;
+ QNetworkReply *reply;
+ qint64 uploadSize;
+ QList<qint64> bytesAvailableList;
+public:
+ GetFromHttpIntoBuffer2Client (QNetworkReply *reply, bool useDownloadBuffer, qint64 uploadSize)
+ : useDownloadBuffer(useDownloadBuffer), reply(reply), uploadSize(uploadSize)
+ {
+ connect(reply, SIGNAL(metaDataChanged()), this, SLOT(metaDataChangedSlot()));
+ connect(reply, SIGNAL(readyRead()), this, SLOT(readyReadSlot()));
+ connect(reply, SIGNAL(finished()), this, SLOT(finishedSlot()));
+ }
+
+ public slots:
+ void metaDataChangedSlot() {
+ if (useDownloadBuffer) {
+ QSharedPointer<char> sharedPointer = qvariant_cast<QSharedPointer<char> >(reply->attribute(QNetworkRequest::DownloadBufferAttribute));
+ QVERIFY(!sharedPointer.isNull()); // It will be 0 if it failed
+ }
+
+ // metaDataChanged needs to come before everything else
+ QVERIFY(bytesAvailableList.isEmpty());
+ }
+
+ void readyReadSlot() {
+ QVERIFY(!reply->isFinished());
+
+ qint64 bytesAvailable = reply->bytesAvailable();
+
+ // bytesAvailable must never be 0
+ QVERIFY(bytesAvailable != 0);
+
+ if (bytesAvailableList.length() < 5) {
+ // We assume that the first few times the bytes available must be less than the complete size, e.g.
+ // the bytesAvailable() function works correctly in case of a downloadBuffer.
+ QVERIFY(bytesAvailable < uploadSize);
+ }
+ if (!bytesAvailableList.isEmpty()) {
+ // Also check that the same bytesAvailable is not coming twice in a row
+ QVERIFY(bytesAvailableList.last() != bytesAvailable);
+ }
+
+ bytesAvailableList.append(bytesAvailable);
+ // Add bytesAvailable to a list an parse
+ }
+
+ void finishedSlot() {
+ // We should have already received all readyRead
+ QVERIFY(bytesAvailableList.last() == uploadSize);
+ }
+};
+
+void tst_QNetworkReply::getFromHttpIntoBuffer2_data()
+{
+ QTest::addColumn<bool>("useDownloadBuffer");
+
+ QTest::newRow("use-download-buffer") << true;
+ QTest::newRow("do-not-use-download-buffer") << false;
+}
+
+// This test checks mostly that signal emissions are in correct order
+// Please note that the whole "zero copy" download buffer API is private right now. Do not use it.
+void tst_QNetworkReply::getFromHttpIntoBuffer2()
+{
+ QFETCH(bool, useDownloadBuffer);
+
+ // On my Linux Desktop the results are already visible with 128 kB, however we use this to have good results.
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_WINCE_WM)
+ // Show some mercy to non-desktop platform/s
+ enum {UploadSize = 4*1024*1024}; // 4 MB
+#else
+ enum {UploadSize = 32*1024*1024}; // 32 MB
+#endif
+
+ GetFromHttpIntoBuffer2Server server(UploadSize, true, false);
+
+ QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/?bare=1"));
+ if (useDownloadBuffer)
+ request.setAttribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute, 1024*1024*128); // 128 MB is max allowed
+
+ QNetworkAccessManager manager;
+ QNetworkReplyPtr reply = manager.get(request);
+
+ GetFromHttpIntoBuffer2Client client(reply, useDownloadBuffer, UploadSize);
+
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
+ QTestEventLoop::instance().enterLoop(40);
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+}
+
+
+// Is handled somewhere else too, introduced this special test to have it more accessible
+void tst_QNetworkReply::ioGetFromHttpWithoutContentLength()
+{
+ QByteArray dataToSend("HTTP/1.0 200 OK\r\n\r\nHALLO! 123!");
+ MiniHttpServer server(dataToSend);
+ server.doClose = true;
+
+ QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort())));
+ QNetworkReplyPtr reply = manager.get(request);
+
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QCOMPARE(reply->url(), request.url());
+ QVERIFY(reply->isFinished());
+ QVERIFY(reply->error() == QNetworkReply::NoError);
+}
+
+// Is handled somewhere else too, introduced this special test to have it more accessible
+void tst_QNetworkReply::ioGetFromHttpBrokenChunkedEncoding()
+{
+ // This is wrong chunked encoding because of the X. What actually has to follow is \r\n
+ // and then the declaration of the final 0 chunk
+ QByteArray dataToSend("HTTP/1.0 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n3\r\nABCX");
+ MiniHttpServer server(dataToSend);
+ server.doClose = false; // FIXME
+
+ QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort())));
+ QNetworkReplyPtr reply = manager.get(request);
+
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
+
+ QEXPECT_FAIL(0, "We should close the socket and not just do nothing", Continue);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QEXPECT_FAIL(0, "We should close the socket and not just do nothing", Continue);
+ QVERIFY(reply->isFinished());
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+}
+
// TODO:
// Prepare a gzip that has one chunk that expands to the size mentioned in the bugreport.
// Then have a custom HTTP server that waits after this chunk so the returning gets
@@ -4301,7 +4573,6 @@ void tst_QNetworkReply::qtbug12908compressedHttpReply()
QCOMPARE(reply->error(), QNetworkReply::NoError);
}
-
// NOTE: This test must be last testcase in tst_qnetworkreply!
void tst_QNetworkReply::parentingRepliesToTheApp()
{
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index 5f6262e..24cd5a3 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -129,6 +129,12 @@ private slots:
void qMetaObjectConnect();
void qMetaObjectDisconnectOne();
void sameName();
+ void connectByMetaMethods();
+ void connectByMetaMethodSlotInsteadOfSignal();
+ void connectConstructorByMetaMethod();
+ void disconnectByMetaMethod();
+ void disconnectNotSignalMetaMethod();
+
protected:
};
@@ -663,11 +669,9 @@ void tst_QObject::findChildren()
l = qFindChildren<QObject*>(&o, "unnamed");
QCOMPARE(l.size(), 0);
-#ifndef QT_NO_MEMBER_TEMPLATES
tl = o.findChildren<QTimer *>("t1");
QCOMPARE(tl.size(), 1);
QCOMPARE(tl.at(0), &t1);
-#endif
}
@@ -727,6 +731,24 @@ void tst_QObject::connectDisconnectNotify()
// Test disconnectNotify for a complete disconnect
((SenderObject*)s)->disconnect((ReceiverObject*)r);
+ // Obtaining meta methods
+ int signalIndx = ((SenderObject*)s)->metaObject()->indexOfSignal(
+ QMetaObject::normalizedSignature(a_signal.toLatin1().constData()+1).constData());
+ int methodIndx = ((ReceiverObject*)r)->metaObject()->indexOfMethod(
+ QMetaObject::normalizedSignature(a_slot.toLatin1().constData()+1).constData());
+ QMetaMethod signal = ((SenderObject*)s)->metaObject()->method(signalIndx);
+ QMetaMethod method = ((ReceiverObject*)r)->metaObject()->method(methodIndx);
+
+ // Test connectNotify when connecting by QMetaMethod
+ connect( (SenderObject*)s, signal, (ReceiverObject*)r, method );
+ QCOMPARE( s->org_signal, s->nw_signal );
+ QCOMPARE( s->org_signal.toLatin1(), QMetaObject::normalizedSignature(a_signal.toLatin1().constData()) );
+
+ // Test disconnectNotify when disconnecting by QMetaMethod
+ QObject::disconnect( (SenderObject*)s, signal, (ReceiverObject*)r, method );
+ QCOMPARE( s->org_signal, s->nw_signal );
+ QCOMPARE( s->org_signal.toLatin1(), QMetaObject::normalizedSignature(a_signal.toLatin1().constData()) );
+
delete s;
delete r;
}
@@ -1760,9 +1782,12 @@ class SuperObject : public QObject
Q_OBJECT
public:
QObject *theSender;
+ int theSignalId;
+
SuperObject()
{
theSender = 0;
+ theSignalId = 0;
}
friend class tst_QObject;
@@ -1773,16 +1798,17 @@ public slots:
void rememberSender()
{
theSender = sender();
+ theSignalId = senderSignalIndex();
}
void deleteAndRememberSender()
{
delete theSender;
- theSender = sender();
+ rememberSender();
}
signals:
+ void anotherSignal();
void theSignal();
-
};
void tst_QObject::sender()
@@ -1790,12 +1816,23 @@ void tst_QObject::sender()
{
SuperObject sender;
SuperObject receiver;
+ connect(&sender, SIGNAL(anotherSignal()),
+ &receiver, SLOT(rememberSender()));
connect(&sender, SIGNAL(theSignal()),
&receiver, SLOT(rememberSender()));
QCOMPARE(receiver.sender(), (QObject *)0);
+ QCOMPARE(receiver.senderSignalIndex(), -1);
emit sender.theSignal();
QCOMPARE(receiver.theSender, (QObject *)&sender);
QCOMPARE(receiver.sender(), (QObject *)0);
+ QCOMPARE(receiver.theSignalId,
+ sender.metaObject()->indexOfSignal("theSignal()"));
+ QCOMPARE(receiver.senderSignalIndex(), -1);
+
+ emit sender.anotherSignal();
+ QCOMPARE(receiver.theSignalId,
+ sender.metaObject()->indexOfSignal("anotherSignal()"));
+ QCOMPARE(receiver.senderSignalIndex(), -1);
}
{
@@ -1812,11 +1849,16 @@ void tst_QObject::sender()
Qt::DirectConnection);
QCOMPARE(receiver->sender(), (QObject *)0);
+ QCOMPARE(receiver->senderSignalIndex(), -1);
receiver->theSender = 0;
+ receiver->theSignalId = -1;
thread.start();
emit sender->theSignal();
QCOMPARE(receiver->theSender, (QObject *) sender);
QCOMPARE(receiver->sender(), (QObject *)0);
+ QCOMPARE(receiver->theSignalId,
+ sender->metaObject()->indexOfSignal("theSignal()"));
+ QCOMPARE(receiver->senderSignalIndex(), -1);
QVERIFY(thread.wait(10000));
delete receiver;
@@ -3610,5 +3652,200 @@ void tst_QObject::sameName()
QCOMPARE(c1.s, 4);
}
+void tst_QObject::connectByMetaMethods()
+{
+ SenderObject s;
+ ReceiverObject r;
+ const QMetaObject *smeta = s.metaObject();
+ const QMetaObject *rmeta = r.metaObject();
+ int sigIndx = smeta->indexOfSignal(QMetaObject::normalizedSignature("signal1()"));
+ int slotIndx = rmeta->indexOfSlot(QMetaObject::normalizedSignature("slot1()"));
+ QVERIFY( sigIndx != -1 );
+ QVERIFY( slotIndx != -1 );
+ QMetaMethod signal = smeta->method(sigIndx);
+ QMetaMethod slot = rmeta->method(slotIndx);
+
+ QVERIFY(connect(&s,signal, &r,slot));
+
+ QVERIFY(!r.called(1));
+ s.emitSignal1();
+ QVERIFY(r.called(1));
+}
+
+void tst_QObject::connectByMetaMethodSlotInsteadOfSignal()
+{
+ SenderObject s;
+ ReceiverObject r;
+ const QMetaObject *smeta = s.metaObject();
+ const QMetaObject *rmeta = r.metaObject();
+ int badIndx = smeta->indexOfSlot(QMetaObject::normalizedSignature("aPublicSlot()"));
+ int slotIndx = rmeta->indexOfSlot(QMetaObject::normalizedSignature("slot1()"));
+ QVERIFY( badIndx != -1 );
+ QVERIFY( slotIndx != -1 );
+ QMetaMethod badMethod = smeta->method(badIndx);
+ QMetaMethod slot = rmeta->method(slotIndx);
+
+ QTest::ignoreMessage(QtWarningMsg,"QObject::connect: Cannot connect SenderObject::aPublicSlot() to ReceiverObject::slot1()");
+ QVERIFY(!connect(&s,badMethod, &r,slot));
+}
+
+class Constructable: public QObject
+{
+ Q_OBJECT
+
+public:
+ Q_INVOKABLE Constructable(){}
+
+};
+
+void tst_QObject::connectConstructorByMetaMethod()
+{
+ Constructable sc;
+ Constructable rc;
+ SenderObject s;
+ ReceiverObject r;
+
+ const QMetaObject cmeta = Constructable::staticMetaObject;
+ const QMetaObject *smeta = s.metaObject();
+ const QMetaObject *rmeta = r.metaObject();
+ int constructorIndx = cmeta.indexOfConstructor(QMetaObject::normalizedSignature("Constructable()"));
+ int sigIndx = smeta->indexOfSignal(QMetaObject::normalizedSignature("signal1()"));
+ int slotIndx = rmeta->indexOfSlot(QMetaObject::normalizedSignature("slot1()"));
+ QVERIFY( constructorIndx != -1 );
+ QVERIFY( sigIndx != -1 );
+ QVERIFY( slotIndx != -1 );
+
+ QMetaMethod constructor = cmeta.constructor(constructorIndx);
+ QMetaMethod signal = smeta->method(sigIndx);
+ QMetaMethod slot = rmeta->method(slotIndx);
+
+ QTest::ignoreMessage(QtWarningMsg,"QObject::connect: Cannot connect Constructable::Constructable() to ReceiverObject::slot1()");
+ QVERIFY(!connect(&sc,constructor, &r,slot));
+ QTest::ignoreMessage(QtWarningMsg,"QObject::connect: Cannot connect SenderObject::signal1() to Constructable::Constructable()");
+ QVERIFY(!connect(&s,signal, &rc,constructor));
+ QTest::ignoreMessage(QtWarningMsg,"QObject::connect: Cannot connect Constructable::Constructable() to Constructable::Constructable()");
+ QVERIFY(!connect(&sc,constructor, &rc,constructor));
+}
+
+void tst_QObject::disconnectByMetaMethod()
+{
+ SenderObject *s = new SenderObject;
+ ReceiverObject *r1 = new ReceiverObject;
+ ReceiverObject *r2 = new ReceiverObject;
+
+ QMetaMethod signal1 = s->metaObject()->method(
+ s->metaObject()->indexOfMethod("signal1()"));
+ QMetaMethod signal2 = s->metaObject()->method(
+ s->metaObject()->indexOfMethod("signal2()"));
+ QMetaMethod signal3 = s->metaObject()->method(
+ s->metaObject()->indexOfMethod("signal3()"));
+ QMetaMethod signal4 = s->metaObject()->method(
+ s->metaObject()->indexOfMethod("signal4()"));
+
+ QMetaMethod slot1 = r1->metaObject()->method(
+ r1->metaObject()->indexOfMethod("slot1()"));
+ QMetaMethod slot2 = r1->metaObject()->method(
+ r1->metaObject()->indexOfMethod("slot2()"));
+ QMetaMethod slot3 = r1->metaObject()->method(
+ r1->metaObject()->indexOfMethod("slot3()"));
+ QMetaMethod slot4 = r1->metaObject()->method(
+ r1->metaObject()->indexOfMethod("slot4()"));
+
+ connect(s, signal1, r1, slot1);
+
+ s->emitSignal1();
+
+ QVERIFY(r1->called(1));
+ r1->reset();
+
+ // usual disconnect with all parameters given
+ bool ret = QObject::disconnect(s, signal1, r1, slot1);
+
+ s->emitSignal1();
+
+ QVERIFY(!r1->called(1));
+ r1->reset();
+
+ QVERIFY(ret);
+ ret = QObject::disconnect(s, signal1, r1, slot1);
+ QVERIFY(!ret);
+
+ r1->reset();
+
+ connect( s, signal1, r1, slot1 );
+ connect( s, signal1, r1, slot2 );
+ connect( s, signal1, r1, slot3 );
+ connect( s, signal2, r1, slot4 );
+
+ // disconnect s's signal1() from all slots of r1
+ QObject::disconnect(s, signal1, r1, QMetaMethod());
+
+ s->emitSignal1();
+ s->emitSignal2();
+
+ QVERIFY(!r1->called(1));
+ QVERIFY(!r1->called(2));
+ QVERIFY(!r1->called(3));
+ QVERIFY(r1->called(4));
+ r1->reset();
+ // make sure all is disconnected again
+ QObject::disconnect(s, 0, r1, 0);
+
+ connect(s, signal1, r1, slot1);
+ connect(s, signal1, r2, slot1);
+ connect(s, signal2, r1, slot2);
+ connect(s, signal2, r2, slot2);
+ connect(s, signal3, r1, slot3);
+ connect(s, signal3, r2, slot3);
+
+ // disconnect signal1() from all receivers
+ QObject::disconnect(s, signal1, 0, QMetaMethod());
+ s->emitSignal1();
+ s->emitSignal2();
+ s->emitSignal3();
+
+ QVERIFY(!r1->called(1));
+ QVERIFY(!r2->called(1));
+ QVERIFY(r1->called(2));
+ QVERIFY(r2->called(2));
+ QVERIFY(r1->called(2));
+ QVERIFY(r2->called(2));
+
+ r1->reset();
+ r2->reset();
+
+ // disconnect all signals of s from all receivers
+ QObject::disconnect( s, 0, 0, 0 );
+
+ connect( s, signal1, r1, slot1 );
+ connect( s, signal1, r2, slot1 );
+
+ // disconnect all signals from slot1 of r1
+ QObject::disconnect(s, QMetaMethod(), r1, slot1);
+
+ s->emitSignal1();
+
+ QVERIFY(!r1->called(1));
+ QVERIFY(r2->called(1));
+
+ delete r2;
+ delete r1;
+ delete s;
+}
+
+void tst_QObject::disconnectNotSignalMetaMethod()
+{
+ SenderObject s;
+ ReceiverObject r;
+
+ connect(&s, SIGNAL(signal1()), &r, SLOT(slot1()));
+
+ QMetaMethod slot = s.metaObject()->method(
+ s.metaObject()->indexOfMethod("aPublicSlot()"));
+
+ QTest::ignoreMessage(QtWarningMsg,"Object::disconnect: Attempt to unbind non-signal SenderObject::aPublicSlot()");
+ QVERIFY(!QObject::disconnect(&s, slot, &r, QMetaMethod()));
+}
+
QTEST_MAIN(tst_QObject)
#include "tst_qobject.moc"
diff --git a/tests/auto/qobject/tst_qobject.pro b/tests/auto/qobject/tst_qobject.pro
index 1d6993a..5745e67 100644
--- a/tests/auto/qobject/tst_qobject.pro
+++ b/tests/auto/qobject/tst_qobject.pro
@@ -10,12 +10,12 @@ QT = core \
gui
contains(QT_CONFIG, qt3support):DEFINES += QT_HAS_QT3SUPPORT
wince*: {
- addFiles.sources = signalbug.exe
+ addFiles.files = signalbug.exe
addFiles.path = .
DEPLOYMENT += addFiles
}
symbian: {
- addFiles.sources = signalbug.exe
+ addFiles.files = signalbug.exe
addFiles.path = \\sys\\bin
DEPLOYMENT += addFiles
}
diff --git a/tests/auto/qpainter/qpainter.pro b/tests/auto/qpainter/qpainter.pro
index 69dc98d..ee624e1 100644
--- a/tests/auto/qpainter/qpainter.pro
+++ b/tests/auto/qpainter/qpainter.pro
@@ -2,7 +2,7 @@ load(qttest_p4)
contains(QT_CONFIG, qt3support): QT += qt3support
SOURCES += tst_qpainter.cpp
wince*|symbian: {
- addFiles.sources = drawEllipse drawLine_rop_bitmap drawPixmap_rop drawPixmap_rop_bitmap task217400.png
+ addFiles.files = drawEllipse drawLine_rop_bitmap drawPixmap_rop drawPixmap_rop_bitmap task217400.png
addFiles.path = .
DEPLOYMENT += addFiles
}
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 45f5c3e..f7db6b3 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -168,6 +168,8 @@ private slots:
void clippedText();
+ void clipBoundingRect();
+
void setOpacity_data();
void setOpacity();
@@ -219,6 +221,8 @@ private slots:
void drawRect_task215378();
void drawRect_task247505();
+ void drawText_subPixelPositionsInRaster_qtbug5053();
+
void drawImage_data();
void drawImage();
@@ -1300,7 +1304,7 @@ void tst_QPainter::drawRect2()
p.end();
QRect stroke = getPaintedSize(image, Qt::white);
- QCOMPARE(stroke.adjusted(1, 1, 0, 0), fill.adjusted(0, 0, 1, 1));
+ QCOMPARE(stroke, fill.adjusted(0, 0, 1, 1));
}
}
@@ -1397,13 +1401,13 @@ void tst_QPainter::drawPath_data()
{
QPainterPath p;
p.addRect(2.25, 2.25, 10, 10);
- QTest::newRow("non-aligned rect") << p << QRect(3, 3, 10, 10) << 10 * 10;
+ QTest::newRow("non-aligned rect") << p << QRect(2, 2, 10, 10) << 10 * 10;
}
{
QPainterPath p;
p.addRect(2.25, 2.25, 10.5, 10.5);
- QTest::newRow("non-aligned rect 2") << p << QRect(3, 3, 10, 10) << 10 * 10;
+ QTest::newRow("non-aligned rect 2") << p << QRect(2, 2, 11, 11) << 11 * 11;
}
{
@@ -3507,6 +3511,9 @@ bool verifyOutlineFillConsistency(const QImage &img, QRgb outside, QRgb inside,
void tst_QPainter::outlineFillConsistency()
{
+ QSKIP("currently broken...", SkipAll);
+ return;
+
QImage dst(256, 256, QImage::Format_ARGB32_Premultiplied);
QPolygonF poly;
@@ -4523,6 +4530,108 @@ void tst_QPainter::QTBUG5939_attachPainterPrivate()
QCOMPARE(widget->deviceTransform, proxy->deviceTransform);
}
+void tst_QPainter::clipBoundingRect()
+{
+ QPixmap pix(500, 500);
+
+ QPainter p(&pix);
+
+ // Test a basic rectangle
+ p.setClipRect(100, 100, 200, 100);
+ QVERIFY(p.clipBoundingRect().contains(QRectF(100, 100, 200, 100)));
+ QVERIFY(!p.clipBoundingRect().contains(QRectF(50, 50, 300, 200)));
+ p.setClipRect(120, 120, 20, 20, Qt::IntersectClip);
+ QVERIFY(p.clipBoundingRect().contains(QRect(120, 120, 20, 20)));
+ QVERIFY(!p.clipBoundingRect().contains(QRectF(100, 100, 200, 100)));
+
+ // Test a basic float rectangle
+ p.setClipRect(QRectF(100, 100, 200, 100));
+ QVERIFY(p.clipBoundingRect().contains(QRectF(100, 100, 200, 100)));
+ QVERIFY(!p.clipBoundingRect().contains(QRectF(50, 50, 300, 200)));
+ p.setClipRect(QRectF(120, 120, 20, 20), Qt::IntersectClip);
+ QVERIFY(p.clipBoundingRect().contains(QRect(120, 120, 20, 20)));
+ QVERIFY(!p.clipBoundingRect().contains(QRectF(100, 100, 200, 100)));
+
+ // Test a basic path + region
+ QPainterPath path;
+ path.addRect(100, 100, 200, 100);
+ p.setClipPath(path);
+ QVERIFY(p.clipBoundingRect().contains(QRectF(100, 100, 200, 100)));
+ QVERIFY(!p.clipBoundingRect().contains(QRectF(50, 50, 300, 200)));
+ p.setClipRegion(QRegion(120, 120, 20, 20), Qt::IntersectClip);
+ QVERIFY(p.clipBoundingRect().contains(QRect(120, 120, 20, 20)));
+ QVERIFY(!p.clipBoundingRect().contains(QRectF(100, 100, 200, 100)));
+
+ p.setClipRect(0, 0, 500, 500);
+ p.translate(250, 250);
+ for (int i=0; i<360; ++i) {
+ p.rotate(1);
+ p.setClipRect(-100, -100, 200, 200, Qt::IntersectClip);
+ }
+ QVERIFY(p.clipBoundingRect().contains(QRectF(-100, -100, 200, 200)));
+ QVERIFY(!p.clipBoundingRect().contains(QRectF(-250, -250, 500, 500)));
+
+}
+
+void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053()
+{
+#if !defined(Q_WS_MAC) || !defined(QT_MAC_USE_COCOA)
+ QSKIP("Only Mac/Cocoa supports sub pixel positions in raster engine currently", SkipAll);
+#endif
+
+ int w = 10, h = 10;
+ QImage image(w, h, QImage::Format_RGB32);
+ image.fill(0xffffffff);
+ QPainter p(&image);
+ p.drawText(0, h, "X\\");
+ p.end();
+
+ bool foundNonGrayPixel = false;
+ const int *bits = (const int *) ((const QImage &) image).bits();
+ int bpl = image.bytesPerLine() / 4;
+ for (int y=0; y<w; ++y) {
+ for (int x=0; x<h; ++x) {
+ int r = qRed(bits[x]);
+ int g = qGreen(bits[x]);
+ int b = qBlue(bits[x]);
+ if (r != g || r != b) {
+ foundNonGrayPixel = true;
+ break;
+ }
+ }
+ bits += bpl;
+ }
+ if (!foundNonGrayPixel)
+ QSKIP("Font smoothing must be turned on for this test", SkipAll);
+
+ QFontMetricsF fm(qApp->font());
+
+ QImage baseLine(fm.width(QChar::fromLatin1('e')), fm.height(), QImage::Format_RGB32);
+ baseLine.fill(Qt::white);
+ {
+ QPainter p(&baseLine);
+ p.drawText(0, fm.ascent(), QString::fromLatin1("e"));
+ }
+
+ bool foundDifferentRasterization = false;
+ for (int i=1; i<12; ++i) {
+ QImage comparison(baseLine.size(), QImage::Format_RGB32);
+ comparison.fill(Qt::white);
+
+ {
+ QPainter p(&comparison);
+ p.drawText(QPointF(i / 12.0, fm.ascent()), QString::fromLatin1("e"));
+ }
+
+ if (comparison != baseLine) {
+ foundDifferentRasterization = true;
+ break;
+ }
+ }
+
+ QVERIFY(foundDifferentRasterization);
+}
+
void tst_QPainter::drawPointScaled()
{
QImage image(32, 32, QImage::Format_RGB32);
diff --git a/tests/auto/qpixmap/qpixmap.pro b/tests/auto/qpixmap/qpixmap.pro
index ff8258f..185ec1a 100644
--- a/tests/auto/qpixmap/qpixmap.pro
+++ b/tests/auto/qpixmap/qpixmap.pro
@@ -3,16 +3,16 @@ SOURCES += tst_qpixmap.cpp
contains(QT_CONFIG, qt3support): QT += qt3support
wince*|symbian: {
- task31722_0.sources = convertFromImage/task31722_0/*.png
+ task31722_0.files = convertFromImage/task31722_0/*.png
task31722_0.path = convertFromImage/task31722_0
- task31722_1.sources = convertFromImage/task31722_1/*.png
+ task31722_1.files = convertFromImage/task31722_1/*.png
task31722_1.path = convertFromImage/task31722_1
- icons.sources = convertFromToHICON/*
+ icons.files = convertFromToHICON/*
icons.path = convertFromToHICON
- loadFromData.sources = loadFromData/*
+ loadFromData.files = loadFromData/*
loadFromData.path = loadFromData
DEPLOYMENT += task31722_0 task31722_1 icons loadFromData
diff --git a/tests/auto/qpixmapfilter/qpixmapfilter.pro b/tests/auto/qpixmapfilter/qpixmapfilter.pro
index e64d68d..964e56d 100644
--- a/tests/auto/qpixmapfilter/qpixmapfilter.pro
+++ b/tests/auto/qpixmapfilter/qpixmapfilter.pro
@@ -2,7 +2,7 @@ load(qttest_p4)
SOURCES += tst_qpixmapfilter.cpp
wince*: {
- addFiles.sources = noise.png
+ addFiles.files = noise.png
addFiles.path = .
DEPLOYMENT += addFiles
}
diff --git a/tests/auto/qplugin/tst_qplugin.pro b/tests/auto/qplugin/tst_qplugin.pro
index 0d9d809..3629fb3 100644
--- a/tests/auto/qplugin/tst_qplugin.pro
+++ b/tests/auto/qplugin/tst_qplugin.pro
@@ -4,13 +4,13 @@ SOURCES = tst_qplugin.cpp
QT = core
wince*: {
- plugins.sources = plugins/*
+ plugins.files = plugins/*
plugins.path = plugins
DEPLOYMENT += plugins
}
symbian: {
- rpDep.sources = releaseplugin.dll debugplugin.dll
+ rpDep.files = releaseplugin.dll debugplugin.dll
rpDep.path = plugins
DEPLOYMENT += rpDep dpDep
}
diff --git a/tests/auto/qpluginloader/elftest/.gitattributes b/tests/auto/qpluginloader/elftest/.gitattributes
new file mode 100644
index 0000000..891192c
--- /dev/null
+++ b/tests/auto/qpluginloader/elftest/.gitattributes
@@ -0,0 +1,10 @@
+corrupt1.elf64.so set -crlf -diff
+corrupt2.elf64.so set -crlf -diff
+corrupt3.elf64.so set -crlf -diff
+debugobj.so set -crlf -diff
+garbage1.so set -crlf -diff
+garbage2.so set -crlf -diff
+garbage3.so set -crlf -diff
+garbage4.so set -crlf -diff
+garbage5.so set -crlf -diff
+
diff --git a/tests/auto/qpluginloader/elftest/corrupt1.elf64.so b/tests/auto/qpluginloader/elftest/corrupt1.elf64.so
new file mode 100755
index 0000000..12ce736
--- /dev/null
+++ b/tests/auto/qpluginloader/elftest/corrupt1.elf64.so
Binary files differ
diff --git a/tests/auto/qpluginloader/elftest/corrupt2.elf64.so b/tests/auto/qpluginloader/elftest/corrupt2.elf64.so
new file mode 100755
index 0000000..11fdc2c
--- /dev/null
+++ b/tests/auto/qpluginloader/elftest/corrupt2.elf64.so
Binary files differ
diff --git a/tests/auto/qpluginloader/elftest/corrupt3.elf64.so b/tests/auto/qpluginloader/elftest/corrupt3.elf64.so
new file mode 100755
index 0000000..94a2bc3
--- /dev/null
+++ b/tests/auto/qpluginloader/elftest/corrupt3.elf64.so
Binary files differ
diff --git a/tests/auto/qpluginloader/elftest/debugobj.so b/tests/auto/qpluginloader/elftest/debugobj.so
new file mode 100644
index 0000000..f0ee056
--- /dev/null
+++ b/tests/auto/qpluginloader/elftest/debugobj.so
Binary files differ
diff --git a/tests/auto/qpluginloader/elftest/garbage1.so b/tests/auto/qpluginloader/elftest/garbage1.so
new file mode 100644
index 0000000..0c74530
--- /dev/null
+++ b/tests/auto/qpluginloader/elftest/garbage1.so
@@ -0,0 +1,4 @@
+p¶¤Ðã¨ø±ÕÛcdL+ôúæî&‘¿&÷ýeü¥=კ²
+•o°Ã’ÊŽI› §ÙÏmgƒ]!ÀZ
+L'Ž)t±
+ÙN»¸(e©× P)Y8öG ˆ6ß-yÈÏÀ ñŸ§÷—“"ô–ZÖÿ›kõ4â?Ë^náÁÇß5$ž’ôY=£ð#y \ No newline at end of file
diff --git a/tests/auto/qpluginloader/elftest/garbage2.so b/tests/auto/qpluginloader/elftest/garbage2.so
new file mode 100644
index 0000000..c06338e
--- /dev/null
+++ b/tests/auto/qpluginloader/elftest/garbage2.so
@@ -0,0 +1 @@
+£Çv.³Y‹¨tKëW3 \ No newline at end of file
diff --git a/tests/auto/qpluginloader/elftest/garbage3.so b/tests/auto/qpluginloader/elftest/garbage3.so
new file mode 100644
index 0000000..a24c523
--- /dev/null
+++ b/tests/auto/qpluginloader/elftest/garbage3.so
@@ -0,0 +1 @@
+£ÝÈÈ‚åžT-õ«´ÊôÚ¥ Àä¸ï¨ì¾œÀi8¼_ñxÓõª¾I±Ð×®ÝxÎ=úØ4@þñ[¨—úBàKS$ú \ No newline at end of file
diff --git a/tests/auto/qpluginloader/elftest/garbage4.so b/tests/auto/qpluginloader/elftest/garbage4.so
new file mode 100644
index 0000000..4f45cf5
--- /dev/null
+++ b/tests/auto/qpluginloader/elftest/garbage4.so
@@ -0,0 +1 @@
+¶ !¦\~çU­u³†:9©ˆ œ§T+91ˆQ¬EøåÇšx¨ng5Óã—zhŒ–…ÿÆ^t™ŠµŽ¦'ÆÎmm*ˈdXH;vw+ªG“²ÃàØ ¨9Lƒ0! \ No newline at end of file
diff --git a/tests/auto/qpluginloader/elftest/garbage5.so b/tests/auto/qpluginloader/elftest/garbage5.so
new file mode 100644
index 0000000..f8c0a1d
--- /dev/null
+++ b/tests/auto/qpluginloader/elftest/garbage5.so
@@ -0,0 +1,2 @@
+ïÌô’Q²
+ãµ-¢9Ò \ No newline at end of file
diff --git a/tests/auto/qpluginloader/tst/tst.pro b/tests/auto/qpluginloader/tst/tst.pro
index 2d757e7..be243b8 100644
--- a/tests/auto/qpluginloader/tst/tst.pro
+++ b/tests/auto/qpluginloader/tst/tst.pro
@@ -14,16 +14,18 @@ win32 {
wince*: {
- addFiles.sources = $$OUT_PWD/../bin/*.dll
+ addFiles.files = $$OUT_PWD/../bin/*.dll
addFiles.path = bin
DEPLOYMENT += addFiles
}
symbian: {
- libDep.sources = tst_qpluginloaderlib.dll
+ libDep.files = tst_qpluginloaderlib.dll
libDep.path = /sys/bin
- pluginDep.sources = theplugin.dll
+ pluginDep.files = theplugin.dll
pluginDep.path = bin
DEPLOYMENT += libDep pluginDep
}
+
+DEFINES += SRCDIR=\\\"$$PWD/../\\\"
diff --git a/tests/auto/qpluginloader/tst_qpluginloader.cpp b/tests/auto/qpluginloader/tst_qpluginloader.cpp
index e913cb5..46fce5e 100644
--- a/tests/auto/qpluginloader/tst_qpluginloader.cpp
+++ b/tests/auto/qpluginloader/tst_qpluginloader.cpp
@@ -123,6 +123,9 @@ private slots:
void loadHints();
void deleteinstanceOnUnload();
void checkingStubsFromDifferentDrives();
+ void loadDebugObj();
+ void loadCorruptElf();
+ void loadGarbage();
};
tst_QPluginLoader::tst_QPluginLoader()
@@ -287,12 +290,14 @@ void tst_QPluginLoader::deleteinstanceOnUnload()
QSignalSpy spy1(loader1.instance(), SIGNAL(destroyed()));
QSignalSpy spy2(loader2.instance(), SIGNAL(destroyed()));
- QCOMPARE(loader1.unload(), false); // refcount not reached 0, not really unloaded
- QCOMPARE(spy1.count(), 0);
- QCOMPARE(spy2.count(), 0);
+ if (pass == 0) {
+ QCOMPARE(loader2.unload(), false); // refcount not reached 0, not really unloaded
+ QCOMPARE(spy1.count(), 0);
+ QCOMPARE(spy2.count(), 0);
+ }
QCOMPARE(instance1->pluginName(), QLatin1String("Plugin ok"));
QCOMPARE(instance2->pluginName(), QLatin1String("Plugin ok"));
- QCOMPARE(loader2.unload(), true); // refcount reached 0, did really unload
+ QVERIFY(loader1.unload()); // refcount reached 0, did really unload
QCOMPARE(spy1.count(), 1);
QCOMPARE(spy2.count(), 1);
}
@@ -348,5 +353,54 @@ void tst_QPluginLoader::checkingStubsFromDifferentDrives()
#endif//Q_OS_SYMBIAN
}
+void tst_QPluginLoader::loadDebugObj()
+{
+#if defined (__ELF__)
+ QVERIFY(QFile::exists(SRCDIR "elftest/debugobj.so"));
+ QPluginLoader lib1(SRCDIR "elftest/debugobj.so");
+ QCOMPARE(lib1.load(), false);
+#endif
+}
+
+void tst_QPluginLoader::loadCorruptElf()
+{
+#if defined (__ELF__)
+if (sizeof(void*) == 8) {
+ QVERIFY(QFile::exists(SRCDIR "elftest/corrupt1.elf64.so"));
+
+ QPluginLoader lib1(SRCDIR "elftest/corrupt1.elf64.so");
+ QCOMPARE(lib1.load(), false);
+ QVERIFY(lib1.errorString().contains("not an ELF object"));
+
+ QPluginLoader lib2(SRCDIR "elftest/corrupt2.elf64.so");
+ QCOMPARE(lib2.load(), false);
+ QVERIFY(lib2.errorString().contains("invalid"));
+
+ QPluginLoader lib3(SRCDIR "elftest/corrupt3.elf64.so");
+ QCOMPARE(lib3.load(), false);
+ QVERIFY(lib3.errorString().contains("invalid"));
+} else if (sizeof(void*) == 4) {
+ QPluginLoader libW(SRCDIR "elftest/corrupt3.elf64.so");
+ QCOMPARE(libW.load(), false);
+ QVERIFY(libW.errorString().contains("architecture"));
+} else {
+ QFAIL("Please port QElfParser to this platform or blacklist this test.");
+}
+#endif
+}
+
+void tst_QPluginLoader::loadGarbage()
+{
+#if defined (Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
+ for (int i=0; i<5; i++) {
+ QPluginLoader lib(QString(SRCDIR "elftest/garbage%1.so").arg(i));
+ QCOMPARE(lib.load(), false);
+#ifdef SHOW_ERRORS
+ qDebug() << lib.errorString();
+#endif
+ }
+#endif
+}
+
QTEST_APPLESS_MAIN(tst_QPluginLoader)
#include "tst_qpluginloader.moc"
diff --git a/tests/auto/qprocess/test/test.pro b/tests/auto/qprocess/test/test.pro
index d555067..a91cadd 100644
--- a/tests/auto/qprocess/test/test.pro
+++ b/tests/auto/qprocess/test/test.pro
@@ -27,61 +27,61 @@ embedded: QT += gui
wince*: {
- addFile_fileWriterProcess.sources = $$OUT_PWD/../fileWriterProcess/fileWriterProcess.exe
+ addFile_fileWriterProcess.files = $$OUT_PWD/../fileWriterProcess/fileWriterProcess.exe
addFile_fileWriterProcess.path = fileWriterProcess
- addFile_testBatFiles.sources = $$PWD/../testBatFiles/*
+ addFile_testBatFiles.files = $$PWD/../testBatFiles/*
addFile_testBatFiles.path = testBatFiles
- addFile_testDetached.sources = $$OUT_PWD/../testDetached/testDetached.exe
+ addFile_testDetached.files = $$OUT_PWD/../testDetached/testDetached.exe
addFile_testDetached.path = testDetached
- addFile_testExitCodes.sources = $$OUT_PWD/../testExitCodes/testExitCodes.exe
+ addFile_testExitCodes.files = $$OUT_PWD/../testExitCodes/testExitCodes.exe
addFile_testExitCodes.path = testExitCodes
- addFile_testGuiProcess.sources = $$OUT_PWD/../testGuiProcess/testGuiProcess.exe
+ addFile_testGuiProcess.files = $$OUT_PWD/../testGuiProcess/testGuiProcess.exe
addFile_testGuiProcess.path = testGuiProcess
- addFile_testProcessCrash.sources = $$OUT_PWD/../testProcessCrash/testProcessCrash.exe
+ addFile_testProcessCrash.files = $$OUT_PWD/../testProcessCrash/testProcessCrash.exe
addFile_testProcessCrash.path = testProcessCrash
- addFile_testProcessDeadWhileReading.sources = $$OUT_PWD/../testProcessDeadWhileReading/testProcessDeadWhileReading.exe
+ addFile_testProcessDeadWhileReading.files = $$OUT_PWD/../testProcessDeadWhileReading/testProcessDeadWhileReading.exe
addFile_testProcessDeadWhileReading.path = testProcessDeadWhileReading
- addFile_testProcessEcho.sources = $$OUT_PWD/../testProcessEcho/testProcessEcho.exe
+ addFile_testProcessEcho.files = $$OUT_PWD/../testProcessEcho/testProcessEcho.exe
addFile_testProcessEcho.path = testProcessEcho
- addFile_testProcessEcho2.sources = $$OUT_PWD/../testProcessEcho2/testProcessEcho2.exe
+ addFile_testProcessEcho2.files = $$OUT_PWD/../testProcessEcho2/testProcessEcho2.exe
addFile_testProcessEcho2.path = testProcessEcho2
- addFile_testProcessEcho3.sources = $$OUT_PWD/../testProcessEcho3/testProcessEcho3.exe
+ addFile_testProcessEcho3.files = $$OUT_PWD/../testProcessEcho3/testProcessEcho3.exe
addFile_testProcessEcho3.path = testProcessEcho3
- addFile_testProcessEOF.sources = $$OUT_PWD/../testProcessEOF/testProcessEOF.exe
+ addFile_testProcessEOF.files = $$OUT_PWD/../testProcessEOF/testProcessEOF.exe
addFile_testProcessEOF.path = testProcessEOF
- addFile_testProcessLoopback.sources = $$OUT_PWD/../testProcessLoopback/testProcessLoopback.exe
+ addFile_testProcessLoopback.files = $$OUT_PWD/../testProcessLoopback/testProcessLoopback.exe
addFile_testProcessLoopback.path = testProcessLoopback
- addFile_testProcessNormal.sources = $$OUT_PWD/../testProcessNormal/testProcessNormal.exe
+ addFile_testProcessNormal.files = $$OUT_PWD/../testProcessNormal/testProcessNormal.exe
addFile_testProcessNormal.path = testProcessNormal
- addFile_testProcessOutput.sources = $$OUT_PWD/../testProcessOutput/testProcessOutput.exe
+ addFile_testProcessOutput.files = $$OUT_PWD/../testProcessOutput/testProcessOutput.exe
addFile_testProcessOutput.path = testProcessOutput
- addFile_testProcessNoSpacesArgs.sources = $$OUT_PWD/../testProcessSpacesArgs/nospace.exe
+ addFile_testProcessNoSpacesArgs.files = $$OUT_PWD/../testProcessSpacesArgs/nospace.exe
addFile_testProcessNoSpacesArgs.path = testProcessSpacesArgs
- addFile_testProcessOneSpacesArgs.sources = $$OUT_PWD/../testProcessSpacesArgs/"one space".exe
+ addFile_testProcessOneSpacesArgs.files = $$OUT_PWD/../testProcessSpacesArgs/"one space".exe
addFile_testProcessOneSpacesArgs.path = testProcessSpacesArgs
- addFile_testProcessTwoSpacesArgs.sources = $$OUT_PWD/../testProcessSpacesArgs/"two space s".exe
+ addFile_testProcessTwoSpacesArgs.files = $$OUT_PWD/../testProcessSpacesArgs/"two space s".exe
addFile_testProcessTwoSpacesArgs.path = testProcessSpacesArgs
- addFile_testSoftExit.sources = $$OUT_PWD/../testSoftExit/testSoftExit.exe
+ addFile_testSoftExit.files = $$OUT_PWD/../testSoftExit/testSoftExit.exe
addFile_testSoftExit.path = testSoftExit
- addFile_testSpaceInName.sources = $$OUT_PWD/../"test Space In Name"/testSpaceInName.exe
+ addFile_testSpaceInName.files = $$OUT_PWD/../"test Space In Name"/testSpaceInName.exe
addFile_testSpaceInName.path = "test Space In Name"
@@ -108,7 +108,7 @@ wince*: {
}
symbian: {
- binDep.sources = \
+ binDep.files = \
fileWriterProcess.exe \
testDetached.exe \
testExitCodes.exe \
diff --git a/tests/auto/qradiobutton/tst_qradiobutton.cpp b/tests/auto/qradiobutton/tst_qradiobutton.cpp
index c074496..531ebab 100644
--- a/tests/auto/qradiobutton/tst_qradiobutton.cpp
+++ b/tests/auto/qradiobutton/tst_qradiobutton.cpp
@@ -58,6 +58,7 @@ public:
private slots:
void task190739_focus();
+ void minimumSizeHint();
private:
};
@@ -96,6 +97,11 @@ void tst_QRadioButton::task190739_focus()
}
+void tst_QRadioButton::minimumSizeHint()
+{
+ QRadioButton button(tr("QRadioButtons sizeHint is the same as it's minimumSizeHint"));
+ QCOMPARE(button.sizeHint(), button.minimumSizeHint());
+}
QTEST_MAIN(tst_QRadioButton)
diff --git a/tests/auto/qresourceengine/qresourceengine.pro b/tests/auto/qresourceengine/qresourceengine.pro
index 17e36af..6bdeb1e 100644
--- a/tests/auto/qresourceengine/qresourceengine.pro
+++ b/tests/auto/qresourceengine/qresourceengine.pro
@@ -21,22 +21,22 @@ PRE_TARGETDEPS += $${runtime_resource.target}
QT = core
wince*|symbian:{
- deploy.sources += runtime_resource.rcc parentdir.txt
- test.sources = testqrc/*
+ deploy.files += runtime_resource.rcc parentdir.txt
+ test.files = testqrc/*
test.path = testqrc
- alias.sources = testqrc/aliasdir/*
+ alias.files = testqrc/aliasdir/*
alias.path = testqrc/aliasdir
- other.sources = testqrc/otherdir/*
+ other.files = testqrc/otherdir/*
other.path = testqrc/otherdir
- search1.sources = testqrc/searchpath1/*
+ search1.files = testqrc/searchpath1/*
search1.path = testqrc/searchpath1
- search2.sources = testqrc/searchpath2/*
+ search2.files = testqrc/searchpath2/*
search2.path = testqrc/searchpath2
- sub.sources = testqrc/subdir/*
+ sub.files = testqrc/subdir/*
sub.path = testqrc/subdir
- testsub.sources = testqrc/test/*
+ testsub.files = testqrc/test/*
testsub.path = testqrc/test
- testsub2.sources = testqrc/test/test/*
+ testsub2.files = testqrc/test/test/*
testsub2.path = testqrc/test/test
DEPLOYMENT = deploy test alias other search1 search2 sub testsub testsub2
!symbian:DEFINES += SRCDIR=\\\"\\\"
diff --git a/tests/auto/qscriptengine/qscriptengine.pro b/tests/auto/qscriptengine/qscriptengine.pro
index fc35f66..c5c2861 100644
--- a/tests/auto/qscriptengine/qscriptengine.pro
+++ b/tests/auto/qscriptengine/qscriptengine.pro
@@ -10,7 +10,7 @@ wince* {
}
wince*|symbian: {
- addFiles.sources = script
+ addFiles.files = script
addFiles.path = .
DEPLOYMENT += addFiles
}
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 26eb1af..7133a6c 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -1915,7 +1915,6 @@ void tst_QScriptEngine::valueConversion()
QString snum = qScriptValueToValue<QString>(num);
QCOMPARE(snum, QLatin1String("123"));
}
-#ifndef QT_NO_MEMBER_TEMPLATES
{
QScriptValue num = eng.toScriptValue(123);
QCOMPARE(num.isNumber(), true);
@@ -1927,7 +1926,6 @@ void tst_QScriptEngine::valueConversion()
QString snum = eng.fromScriptValue<QString>(num);
QCOMPARE(snum, QLatin1String("123"));
}
-#endif
{
QScriptValue num(&eng, 123);
QCOMPARE(qScriptValueToValue<char>(num), char(123));
@@ -2097,6 +2095,38 @@ void tst_QScriptEngine::valueConversion()
QVERIFY(!val.isVariant());
QVERIFY(val.isUndefined());
}
+ // Checking nested QVariants
+ {
+ QVariant tmp1;
+ QVariant tmp2(QMetaType::QVariant, &tmp1);
+ QVERIFY(QMetaType::Type(tmp2.type()) == QMetaType::QVariant);
+
+ QScriptValue val1 = qScriptValueFromValue(&eng, tmp1);
+ QScriptValue val2 = qScriptValueFromValue(&eng, tmp2);
+ QVERIFY(val1.isValid());
+ QVERIFY(val2.isValid());
+ QVERIFY(val1.isUndefined());
+ QVERIFY(!val2.isUndefined());
+ QVERIFY(!val1.isVariant());
+ 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);
+
+ QScriptValue val1 = qScriptValueFromValue(&eng, tmp2);
+ QScriptValue val2 = qScriptValueFromValue(&eng, tmp3);
+ QVERIFY(val1.isValid());
+ QVERIFY(val2.isValid());
+ QVERIFY(val1.isVariant());
+ QVERIFY(val2.isVariant());
+ QVERIFY(val1.toVariant().toInt() == 123);
+ QVERIFY(qScriptValueFromValue(&eng, val2.toVariant()).toVariant().toInt() == 123);
+ }
{
QScriptValue val = qScriptValueFromValue(&eng, QVariant(true));
QVERIFY(!val.isVariant());
diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
index 11813d8..0d57f0c 100644
--- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
+++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
@@ -1670,6 +1670,7 @@ void tst_QScriptExtQObject::connectAndDisconnect()
m_myObject->emitMySignalWithVariantArg(123);
QCOMPARE(m_engine->evaluate("gotSignal").toBoolean(), true);
QCOMPARE(m_engine->evaluate("signalArgs.length").toNumber(), 1.0);
+ QVERIFY(m_engine->evaluate("signalArgs[0]").isNumber());
QCOMPARE(m_engine->evaluate("signalArgs[0]").toNumber(), 123.0);
QVERIFY(m_engine->evaluate("myObject.mySignalWithVariantArg.disconnect(myHandler)").isUndefined());
@@ -1685,16 +1686,29 @@ void tst_QScriptExtQObject::connectAndDisconnect()
QVERIFY(m_engine->evaluate("signalArgs[0]").isUndefined());
QVERIFY(m_engine->evaluate("myObject.mySignalWithScriptEngineArg.disconnect(myHandler)").isUndefined());
- // signal with QVariant arg: argument conversion should work
+ // signal with QVariant arg: QVariant should be unwrapped only once
m_myObject->clearConnectedSignal();
QVERIFY(m_engine->evaluate("myObject.mySignalWithVariantArg.connect(myHandler)").isUndefined());
QCOMPARE(m_myObject->connectedSignal().constData(), SIGNAL(mySignalWithVariantArg(QVariant)));
m_engine->evaluate("gotSignal = false");
- m_myObject->emitMySignalWithVariantArg(123);
+ QVariant tmp(123);
+ QVariant signalArg(QMetaType::QVariant, &tmp);
+ m_myObject->emitMySignalWithVariantArg(signalArg);
QCOMPARE(m_engine->evaluate("gotSignal").toBoolean(), true);
QCOMPARE(m_engine->evaluate("signalArgs.length").toNumber(), 1.0);
- QVERIFY(m_engine->evaluate("signalArgs[0]").isNumber());
- QCOMPARE(m_engine->evaluate("signalArgs[0]").toNumber(), 123.0);
+ QVERIFY(m_engine->evaluate("signalArgs[0]").isVariant());
+ QCOMPARE(m_engine->evaluate("signalArgs[0]").toVariant().toDouble(), 123.0);
+ QVERIFY(m_engine->evaluate("myObject.mySignalWithVariantArg.disconnect(myHandler)").isUndefined());
+
+ // signal with QVariant arg: with an invalid QVariant
+ m_myObject->clearConnectedSignal();
+ QVERIFY(m_engine->evaluate("myObject.mySignalWithVariantArg.connect(myHandler)").isUndefined());
+ QCOMPARE(m_myObject->connectedSignal().constData(), SIGNAL(mySignalWithVariantArg(QVariant)));
+ m_engine->evaluate("gotSignal = false");
+ m_myObject->emitMySignalWithVariantArg(QVariant());
+ QCOMPARE(m_engine->evaluate("gotSignal").toBoolean(), true);
+ QCOMPARE(m_engine->evaluate("signalArgs.length").toNumber(), 1.0);
+ QVERIFY(m_engine->evaluate("signalArgs[0]").isUndefined());
QVERIFY(m_engine->evaluate("myObject.mySignalWithVariantArg.disconnect(myHandler)").isUndefined());
// signal with argument type that's unknown to the meta-type system
diff --git a/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro
index 07a4672..b1ddd64 100644
--- a/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro
+++ b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro
@@ -5,7 +5,7 @@ SOURCES += tst_qscriptjstestsuite.cpp
!symbian: DEFINES += SRCDIR=\\\"$$PWD\\\"
wince*|symbian: {
-testFiles.sources = tests
+testFiles.files = tests
testFiles.path = .
DEPLOYMENT += testFiles
}
diff --git a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro
index 03e26bd..5d8e5af4 100644
--- a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro
+++ b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qscriptv8testsuite.cpp
!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\"
wince*|symbian: {
-testFiles.sources = tests
+testFiles.files = tests
testFiles.path = .
DEPLOYMENT += testFiles
}
diff --git a/tests/auto/qscriptvalue/testgen/testgenerator.cpp b/tests/auto/qscriptvalue/testgen/testgenerator.cpp
index a291110..9d7d33d 100644
--- a/tests/auto/qscriptvalue/testgen/testgenerator.cpp
+++ b/tests/auto/qscriptvalue/testgen/testgenerator.cpp
@@ -162,7 +162,7 @@ static QString generateIsXXXDef(const QString& name, const QList<QString>& list)
" initScriptValues();\n"\
"}\n"\
"\n"\
- "static QString %1_array [] = {%2};\n\n"\
+ "static QString %1_array[] = {%2};\n\n"\
"void tst_QScriptValue::%1_makeData(const char* expr)\n"\
"{\n"\
" static QSet<QString> %1;\n"\
@@ -193,9 +193,11 @@ static QString generateIsXXXDef(const QString& name, const QList<QString>& list)
QStringList set;
set.reserve(3 * list.count());
foreach(const QString& t, list) {
+ if (!set.isEmpty())
+ set.append("\",");
set.append("\n \"");
set.append(escape(t));
- set.append("\",");
+ set.append("\"");
}
return result.arg(name, set.join(QString()), QString::number(list.count()));
@@ -211,8 +213,8 @@ static QString generateToXXXDef(const QString& name, const QList<QPair<QString,
" initScriptValues();\n"\
"}\n"\
"\n"\
- "static QString %1_tagArray [] = {%4};\n\n"\
- "static %2 %1_valueArray [] = {%5};\n\n"\
+ "static QString %1_tagArray[] = {%4};\n\n"\
+ "static %2 %1_valueArray[] = {%5};\n\n"\
"void tst_QScriptValue::%1_makeData(const char* expr)\n"\
"{\n"\
" static QHash<QString, %2> %1;\n"\
@@ -236,19 +238,23 @@ static QString generateToXXXDef(const QString& name, const QList<QPair<QString,
typename QList<QPair<QString, T> >::const_iterator i = list.constBegin();
QStringList tagSet, valueSet;
- tagSet.reserve(list.count());
- valueSet.reserve(list.count());
- int tmp = -1;
- for(; i != list.constEnd(); ++i) {
+ tagSet.reserve(4 * list.count());
+ valueSet.reserve(3 * list.count());
+ for(int lineBreaker = 0; i != list.constEnd(); ++i) {
QPair<QString, T> t = *i;
t.first = escape(t.first);
+ if (!valueSet.isEmpty()) {
+ valueSet.append(QString(","));
+ tagSet.append(QString::fromAscii(","));
+ }
tagSet.append(QString("\n \""));
tagSet.append(t.first);
- tagSet.append(QString::fromAscii("\","));
- if (!((++tmp)%2))
+ tagSet.append(QString::fromAscii("\""));
+ if (!((lineBreaker++)%2))
valueSet.append(QString("\n "));
+ else
+ valueSet.append(QString::fromAscii(" "));
valueSet.append(prepareToInsert<T>(t.second));
- valueSet.append(QString::fromAscii(", "));
}
return result.arg(name,
typeName<T>(),
@@ -268,8 +274,8 @@ QString generateToXXXDef<qsreal>(const QString& name, const QList<QPair<QString,
" initScriptValues();\n"\
"}\n"\
"\n"\
- "static QString %1_tagArray [] = {%3};\n"\
- "static %2 %1_valueArray [] = {%4};\n"\
+ "static QString %1_tagArray[] = {%3};\n"\
+ "static %2 %1_valueArray[] = {%4};\n"\
"void tst_QScriptValue::%1_makeData(const char* expr)\n"\
"{\n"\
" static QHash<QString, %2> %1;\n"\
@@ -299,20 +305,25 @@ QString generateToXXXDef<qsreal>(const QString& name, const QList<QPair<QString,
QList<QPair<QString, qsreal> >::const_iterator i = list.constBegin();
QStringList tagSet, valueSet;
- tagSet.reserve(list.count());
- valueSet.reserve(list.count());
- int tmp = -1;
- for(; i != list.constEnd(); ++i) {
+ tagSet.reserve(4 * list.count());
+ valueSet.reserve(3 * list.count());
+ for(int lineBreaker = 0; i != list.constEnd(); ++i) {
QPair<QString, qsreal> t = *i;
t.first = escape(t.first);
+ if (!valueSet.isEmpty()) {
+ valueSet.append(QString(","));
+ tagSet.append(QString::fromAscii(","));
+ }
tagSet.append(QString("\n \""));
tagSet.append(t.first);
- tagSet.append(QString::fromAscii("\","));
- if (!((++tmp)%10))
+ tagSet.append(QString::fromAscii("\""));
+ if (!((lineBreaker++)%10))
valueSet.append(QString("\n "));
+ else
+ valueSet.append(QString::fromAscii(" "));
valueSet.append(prepareToInsert<qsreal>(t.second));
- valueSet.append(QString::fromAscii(", "));
}
+
// toInteger shouldn't return NaN, so it would be nice to catch the case.
QString hook;
if (name == "toNumber") {
@@ -340,8 +351,8 @@ static QString generateCastDef(const QList<QPair<QString, T> >& list)
" initScriptValues();\n"\
"}\n"\
"\n"\
- "static QString qscriptvalue_cast%1_tagArray [] = {%2};\n"\
- "static %1 qscriptvalue_cast%1_valueArray [] = {%3};\n"\
+ "static QString qscriptvalue_cast%1_tagArray[] = {%2};\n"\
+ "static %1 qscriptvalue_cast%1_valueArray[] = {%3};\n"\
"void tst_QScriptValue::qscriptvalue_cast%1_makeData(const char* expr)\n"\
"{\n"\
" static QHash<QString, %1> value;\n"\
@@ -365,19 +376,23 @@ static QString generateCastDef(const QList<QPair<QString, T> >& list)
typename QList<QPair<QString, T> >::const_iterator i = list.constBegin();
QStringList tagSet, valueSet;
- tagSet.reserve(list.count());
- valueSet.reserve(list.count());
- int tmp = -1;
- for(; i != list.constEnd(); ++i) {
+ tagSet.reserve(4 * list.count());
+ valueSet.reserve(3 * list.count());
+ for(int lineBreaker = 0; i != list.constEnd(); ++i) {
QPair<QString, T> t = *i;
t.first = escape(t.first);
+ if (!valueSet.isEmpty()) {
+ valueSet.append(QString(","));
+ tagSet.append(QString::fromAscii(","));
+ }
tagSet.append(QString("\n \""));
tagSet.append(t.first);
- tagSet.append(QString::fromAscii("\","));
- if (!((++tmp)%2))
+ tagSet.append(QString::fromAscii("\""));
+ if (!((lineBreaker++)%2))
valueSet.append(QString("\n "));
+ else
+ valueSet.append(QString::fromAscii(" "));
valueSet.append(prepareToInsert<T>(t.second));
- valueSet.append(QString::fromAscii(", "));
}
return result.arg(typeName<T>(), tagSet.join(QString()), valueSet.join(QString()), QString::number(list.count()));
}
@@ -392,8 +407,8 @@ QString generateCastDef<qsreal>(const QList<QPair<QString, qsreal> >& list)
" initScriptValues();\n"\
"}\n"\
"\n"\
- "static QString qscriptvalue_cast%1_tagArray [] = {%2};\n"\
- "static %1 qscriptvalue_cast%1_valueArray [] = {%3};\n"\
+ "static QString qscriptvalue_cast%1_tagArray[] = {%2};\n"\
+ "static %1 qscriptvalue_cast%1_valueArray[] = {%3};\n"\
"void tst_QScriptValue::qscriptvalue_cast%1_makeData(const char* expr)\n"\
"{\n"\
" static QHash<QString, %1> value;\n"\
@@ -427,19 +442,23 @@ QString generateCastDef<qsreal>(const QList<QPair<QString, qsreal> >& list)
QList<QPair<QString, qsreal> >::const_iterator i = list.constBegin();
QStringList tagSet, valueSet;
- tagSet.reserve(list.count());
- valueSet.reserve(list.count());
- int tmp = -1;
- for(; i != list.constEnd(); ++i) {
+ tagSet.reserve(4 * list.count());
+ valueSet.reserve(3 * list.count());
+ for(int lineBreaker = 0; i != list.constEnd(); ++i) {
QPair<QString, qsreal> t = *i;
t.first = escape(t.first);
+ if (!valueSet.isEmpty()) {
+ valueSet.append(QString(","));
+ tagSet.append(QString::fromAscii(","));
+ }
tagSet.append(QString("\n \""));
tagSet.append(t.first);
- tagSet.append(QString::fromAscii("\","));
- if (!((++tmp)%10))
+ tagSet.append(QString::fromAscii("\""));
+ if (!((lineBreaker++)%10))
valueSet.append(QString("\n "));
+ else
+ valueSet.append(QString::fromAscii(" "));
valueSet.append(prepareToInsert<qsreal>(t.second));
- valueSet.append(QString::fromAscii(", "));
}
return result.arg(typeName<qsreal>(),
tagSet.join(QString()),
@@ -457,7 +476,7 @@ static QString generateCompareDef(const QString& comparisionType, const QList<QS
" initScriptValues();\n"\
"}\n"\
"\n"\
- "static QString %1_array [] = {%2};\n\n"\
+ "static QString %1_array[] = {%2};\n\n"\
"void tst_QScriptValue::%1_makeData(const char *expr)\n"\
"{\n"\
" static QSet<QString> equals;\n"\
@@ -488,9 +507,13 @@ static QString generateCompareDef(const QString& comparisionType, const QList<QS
QString result = templ;
QStringList set;
- set.reserve(tags.count());
+ set.reserve(4 * tags.count());
foreach(const QString& tmp, tags) {
- set.append("\n \"" + escape(tmp) + "\",");
+ if (!set.isEmpty())
+ set.append(",");
+ set.append("\n \"");
+ set.append(escape(tmp));
+ set.append("\"");
}
return result.arg(comparisionType, set.join(""), QString::number(tags.count()));
}
@@ -500,7 +523,7 @@ static QString generateInitDef(const QVector<QString>& allDataTags)
static const QString templ = "void tst_QScriptValue::initScriptValues()\n"\
"{\n"\
" m_values.clear();\n"\
- " if (engine) \n"\
+ " if (engine)\n"\
" delete engine;\n"\
" engine = new QScriptEngine;\n"\
"%1\n}\n\n";
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index 83a3388..18480cc 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -2238,19 +2238,36 @@ void tst_QScriptValue::getSetScope()
void tst_QScriptValue::getSetData()
{
QScriptEngine eng;
- QScriptValue object = eng.newObject();
- QVERIFY(!object.data().isValid());
- QScriptValue v1(true);
- object.setData(v1);
- QVERIFY(object.data().strictlyEquals(v1));
- QScriptValue v2(123);
- object.setData(v2);
- QVERIFY(object.data().strictlyEquals(v2));
- QScriptValue v3 = eng.newObject();
- object.setData(v3);
- QVERIFY(object.data().strictlyEquals(v3));
- object.setData(QScriptValue());
- QVERIFY(!object.data().isValid());
+ {
+ QScriptValue object = eng.newObject();
+ QVERIFY(!object.data().isValid());
+ QScriptValue v1(true);
+ object.setData(v1);
+ QVERIFY(object.data().strictlyEquals(v1));
+ QScriptValue v2(123);
+ object.setData(v2);
+ QVERIFY(object.data().strictlyEquals(v2));
+ QScriptValue v3 = eng.newObject();
+ object.setData(v3);
+ QVERIFY(object.data().strictlyEquals(v3));
+ object.setData(QScriptValue());
+ QVERIFY(!object.data().isValid());
+ }
+ {
+ QScriptValue value = eng.undefinedValue();
+ QVERIFY(!value.data().isValid());
+ QScriptValue v1(true);
+ value.setData(v1);
+ QVERIFY(!value.data().isValid());
+ QScriptValue v2(123);
+ value.setData(v2);
+ QVERIFY(!value.data().isValid());
+ QScriptValue v3 = eng.newObject();
+ value.setData(v3);
+ QVERIFY(!value.data().isValid());
+ value.setData(QScriptValue());
+ QVERIFY(!value.data().isValid());
+ }
}
class TestScriptClass : public QScriptClass
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index 6b4904f..5e624e4 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -732,7 +732,6 @@ void tst_QSharedPointer::objectCast()
ptr = baseptr.objectCast<OtherObject>();
QVERIFY(ptr == data);
-#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION
// again:
ptr = qobject_cast<OtherObject *>(baseptr);
QVERIFY(ptr == data);
@@ -740,7 +739,6 @@ void tst_QSharedPointer::objectCast()
// again:
ptr = qobject_cast<QSharedPointer<OtherObject> >(baseptr);
QVERIFY(ptr == data);
-#endif
}
check();
@@ -760,7 +758,6 @@ void tst_QSharedPointer::objectCast()
ptr = baseptr.objectCast<const OtherObject>();
QVERIFY(ptr == data);
-#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION
// again:
ptr = qobject_cast<const OtherObject *>(baseptr);
QVERIFY(ptr == data);
@@ -768,7 +765,6 @@ void tst_QSharedPointer::objectCast()
// again:
ptr = qobject_cast<QSharedPointer<const OtherObject> >(baseptr);
QVERIFY(ptr == data);
-#endif
}
check();
@@ -802,7 +798,6 @@ void tst_QSharedPointer::objectCast()
QSharedPointer<OtherObject> otherptr = qSharedPointerObjectCast<OtherObject>(weakptr);
QVERIFY(otherptr.isNull());
-#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION
// again:
otherptr = qobject_cast<OtherObject *>(weakptr);
QVERIFY(otherptr.isNull());
@@ -810,7 +805,6 @@ void tst_QSharedPointer::objectCast()
// again:
otherptr = qobject_cast<QSharedPointer<OtherObject> >(weakptr);
QVERIFY(otherptr.isNull());
-#endif
}
check();
}
@@ -1736,12 +1730,10 @@ void tst_QSharedPointer::invalidConstructs_data()
<< &QTest::QExternalTest::tryCompileFail
<< "QSharedPointer<const QObject> baseptr = QSharedPointer<const QObject>(new QObject);\n"
"qSharedPointerObjectCast<QCoreApplication>(baseptr);";
-#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION
QTest::newRow("const-dropping-object-cast2")
<< &QTest::QExternalTest::tryCompileFail
<< "QSharedPointer<const QObject> baseptr = QSharedPointer<const QObject>(new QObject);\n"
"qobject_cast<QCoreApplication *>(baseptr);";
-#endif
// arithmethics through automatic cast operators
QTest::newRow("arithmethic1")
diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index 66caf4a..2b62ccc 100644
--- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -2796,10 +2796,12 @@ void tst_QSortFilterProxyModel::task252507_mapFromToSource()
QCOMPARE(proxy.mapFromSource(QModelIndex()), QModelIndex());
QCOMPARE(proxy.mapToSource(QModelIndex()), QModelIndex());
+#ifdef QT_NO_DEBUG //if Qt is compiled in debug mode, this will assert
QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapToSource ");
QCOMPARE(proxy.mapToSource(source.index(2, 3)), QModelIndex());
QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapFromSource ");
QCOMPARE(proxy.mapFromSource(proxy.index(6, 2)), QModelIndex());
+#endif
}
static QStandardItem *addEntry(QStandardItem* pParent, const QString &description)
diff --git a/tests/auto/qsound/qsound.pro b/tests/auto/qsound/qsound.pro
index bb1981c..a1760f8 100644
--- a/tests/auto/qsound/qsound.pro
+++ b/tests/auto/qsound/qsound.pro
@@ -2,7 +2,7 @@ load(qttest_p4)
SOURCES += tst_qsound.cpp
wince*|symbian: {
- deploy.sources += 4.wav
+ deploy.files += 4.wav
DEPLOYMENT = deploy
!symbian:DEFINES += SRCDIR=\\\"\\\"
} else {
diff --git a/tests/auto/qsplitter/qsplitter.pro b/tests/auto/qsplitter/qsplitter.pro
index b11e408..5422fae 100644
--- a/tests/auto/qsplitter/qsplitter.pro
+++ b/tests/auto/qsplitter/qsplitter.pro
@@ -5,7 +5,7 @@ SOURCES += tst_qsplitter.cpp
contains(QT_CONFIG, qt3support): QT += qt3support
wince*|symbian: {
- addFiles.sources = extradata.txt setSizes3.dat
+ addFiles.files = extradata.txt setSizes3.dat
addFiles.path = .
DEPLOYMENT += addFiles
!symbian:DEFINES += SRCDIR=\\\"./\\\"
diff --git a/tests/auto/qsql/qsql.pro b/tests/auto/qsql/qsql.pro
index 0ec581d..9bf30f8 100644
--- a/tests/auto/qsql/qsql.pro
+++ b/tests/auto/qsql/qsql.pro
@@ -13,7 +13,7 @@ symbian {
qt_not_deployed {
contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
sqlite.path = /sys/bin
- sqlite.sources = sqlite3.dll
+ sqlite.files = sqlite3.dll
DEPLOYMENT += sqlite
}
}
diff --git a/tests/auto/qsqldatabase/qsqldatabase.pro b/tests/auto/qsqldatabase/qsqldatabase.pro
index 6381219..066c24f 100644
--- a/tests/auto/qsqldatabase/qsqldatabase.pro
+++ b/tests/auto/qsqldatabase/qsqldatabase.pro
@@ -13,7 +13,7 @@ win32: {
wince*: {
DEPLOYMENT_PLUGIN += qsqlite
- testData.sources = testdata
+ testData.files = testdata
testData.path = .
DEPLOYMENT += testData
@@ -26,7 +26,7 @@ symbian {
qt_not_deployed {
contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
sqlite.path = /sys/bin
- sqlite.sources = sqlite3.dll
+ sqlite.files = sqlite3.dll
DEPLOYMENT += sqlite
}
}
diff --git a/tests/auto/qsqldriver/qsqldriver.pro b/tests/auto/qsqldriver/qsqldriver.pro
index 2e9ed67..c02d74a 100644
--- a/tests/auto/qsqldriver/qsqldriver.pro
+++ b/tests/auto/qsqldriver/qsqldriver.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qsqldriver.cpp
QT += sql
wince*: {
- plugFiles.sources = ../../../plugins/sqldrivers
+ plugFiles.files = ../../../plugins/sqldrivers
plugFiles.path = .
DEPLOYMENT += plugFiles
LIBS += -lws2
@@ -20,7 +20,7 @@ symbian {
qt_not_deployed {
contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
sqlite.path = /sys/bin
- sqlite.sources = sqlite3.dll
+ sqlite.files = sqlite3.dll
DEPLOYMENT += sqlite
}
}
diff --git a/tests/auto/qsqlerror/qsqlerror.pro b/tests/auto/qsqlerror/qsqlerror.pro
index 456f585..ebf6d24 100644
--- a/tests/auto/qsqlerror/qsqlerror.pro
+++ b/tests/auto/qsqlerror/qsqlerror.pro
@@ -11,7 +11,7 @@ symbian {
qt_not_deployed {
contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
sqlite.path = /sys/bin
- sqlite.sources = sqlite3.dll
+ sqlite.files = sqlite3.dll
DEPLOYMENT += sqlite
}
}
diff --git a/tests/auto/qsqlfield/qsqlfield.pro b/tests/auto/qsqlfield/qsqlfield.pro
index 7339854..2359151 100644
--- a/tests/auto/qsqlfield/qsqlfield.pro
+++ b/tests/auto/qsqlfield/qsqlfield.pro
@@ -7,7 +7,7 @@ symbian {
qt_not_deployed {
contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
sqlite.path = /sys/bin
- sqlite.sources = sqlite3.dll
+ sqlite.files = sqlite3.dll
DEPLOYMENT += sqlite
}
}
diff --git a/tests/auto/qsqlquery/qsqlquery.pro b/tests/auto/qsqlquery/qsqlquery.pro
index 97646ed..fbcc998 100644
--- a/tests/auto/qsqlquery/qsqlquery.pro
+++ b/tests/auto/qsqlquery/qsqlquery.pro
@@ -8,7 +8,7 @@ QT = core sql
wince*: {
- plugFiles.sources = ../../../plugins/sqldrivers
+ plugFiles.files = ../../../plugins/sqldrivers
plugFiles.path = .
DEPLOYMENT += plugFiles
LIBS += -lws2
@@ -18,7 +18,7 @@ symbian {
qt_not_deployed {
contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
sqlite.path = /sys/bin
- sqlite.sources = sqlite3.dll
+ sqlite.files = sqlite3.dll
DEPLOYMENT += sqlite
}
}
diff --git a/tests/auto/qsqlquerymodel/qsqlquerymodel.pro b/tests/auto/qsqlquerymodel/qsqlquerymodel.pro
index cda8cab..4b23e94 100644
--- a/tests/auto/qsqlquerymodel/qsqlquerymodel.pro
+++ b/tests/auto/qsqlquerymodel/qsqlquerymodel.pro
@@ -10,7 +10,7 @@ wince*: {
qt_not_deployed {
contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
sqlite.path = /sys/bin
- sqlite.sources = sqlite3.dll
+ sqlite.files = sqlite3.dll
DEPLOYMENT += sqlite
}
}
diff --git a/tests/auto/qsqlrecord/qsqlrecord.pro b/tests/auto/qsqlrecord/qsqlrecord.pro
index f36f076..16e3ae4 100644
--- a/tests/auto/qsqlrecord/qsqlrecord.pro
+++ b/tests/auto/qsqlrecord/qsqlrecord.pro
@@ -5,7 +5,7 @@ symbian {
qt_not_deployed {
contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
sqlite.path = /sys/bin
- sqlite.sources = sqlite3.dll
+ sqlite.files = sqlite3.dll
DEPLOYMENT += sqlite
}
}
diff --git a/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro b/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
index c6681d5..dad42d5 100644
--- a/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
+++ b/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qsqlrelationaltablemodel.cpp
QT += sql
wince*: {
- plugFiles.sources = ../../../plugins/sqldrivers
+ plugFiles.files = ../../../plugins/sqldrivers
plugFiles.path = .
DEPLOYMENT += plugFiles
LIBS += -lws2
@@ -12,7 +12,7 @@ wince*: {
qt_not_deployed {
contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
sqlite.path = /sys/bin
- sqlite.sources = sqlite3.dll
+ sqlite.files = sqlite3.dll
DEPLOYMENT += sqlite
}
}
diff --git a/tests/auto/qsqltablemodel/qsqltablemodel.pro b/tests/auto/qsqltablemodel/qsqltablemodel.pro
index 9a23237..e49020f 100644
--- a/tests/auto/qsqltablemodel/qsqltablemodel.pro
+++ b/tests/auto/qsqltablemodel/qsqltablemodel.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qsqltablemodel.cpp
QT += sql
wince*: {
- plugFiles.sources = ../../../plugins/sqldrivers
+ plugFiles.files = ../../../plugins/sqldrivers
plugFiles.path = .
DEPLOYMENT += plugFiles
LIBS += -lws2
@@ -12,7 +12,7 @@ wince*: {
qt_not_deployed {
contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
sqlite.path = /sys/bin
- sqlite.sources = sqlite3.dll
+ sqlite.files = sqlite3.dll
DEPLOYMENT += sqlite
}
}
diff --git a/tests/auto/qsqlthread/qsqlthread.pro b/tests/auto/qsqlthread/qsqlthread.pro
index 5522232..2e4c72a 100644
--- a/tests/auto/qsqlthread/qsqlthread.pro
+++ b/tests/auto/qsqlthread/qsqlthread.pro
@@ -5,7 +5,7 @@ QT = core sql
wince*: {
- plugFiles.sources = ../../../plugins/sqldrivers
+ plugFiles.files = ../../../plugins/sqldrivers
plugFiles.path = .
DEPLOYMENT += plugFiles
LIBS += -lws2
@@ -13,7 +13,7 @@ wince*: {
qt_not_deployed {
contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
sqlite.path = /sys/bin
- sqlite.sources = sqlite3.dll
+ sqlite.files = sqlite3.dll
DEPLOYMENT += sqlite
}
}
diff --git a/tests/auto/qsslcertificate/qsslcertificate.pro b/tests/auto/qsslcertificate/qsslcertificate.pro
index d7671ea..e21587b 100644
--- a/tests/auto/qsslcertificate/qsslcertificate.pro
+++ b/tests/auto/qsslcertificate/qsslcertificate.pro
@@ -15,7 +15,7 @@ win32 {
}
wince*|symbian: {
- certFiles.sources = certificates more-certificates
+ certFiles.files = certificates more-certificates
certFiles.path = .
DEPLOYMENT += certFiles
}
diff --git a/tests/auto/qsslkey/qsslkey.pro b/tests/auto/qsslkey/qsslkey.pro
index dff0db1..5a90b76 100644
--- a/tests/auto/qsslkey/qsslkey.pro
+++ b/tests/auto/qsslkey/qsslkey.pro
@@ -15,10 +15,10 @@ win32 {
}
wince*|symbian: {
- keyFiles.sources = keys
+ keyFiles.files = keys
keyFiles.path = .
- passphraseFiles.sources = rsa-without-passphrase.pem rsa-with-passphrase.pem
+ passphraseFiles.files = rsa-without-passphrase.pem rsa-with-passphrase.pem
passphraseFiles.path = .
DEPLOYMENT += keyFiles passphraseFiles
diff --git a/tests/auto/qsslsocket/qsslsocket.pro b/tests/auto/qsslsocket/qsslsocket.pro
index accfa89..aeeae8f 100644
--- a/tests/auto/qsslsocket/qsslsocket.pro
+++ b/tests/auto/qsslsocket/qsslsocket.pro
@@ -18,7 +18,7 @@ win32 {
wince* {
DEFINES += SRCDIR=\\\"./\\\"
- certFiles.sources = certs ssl.tar.gz
+ certFiles.files = certs ssl.tar.gz
certFiles.path = .
DEPLOYMENT += certFiles
} else:symbian {
@@ -26,7 +26,7 @@ wince* {
TARGET.EPOCHEAPSIZE="0x100 0x1000000"
TARGET.CAPABILITY=NetworkServices
- certFiles.sources = certs ssl.tar.gz
+ certFiles.files = certs ssl.tar.gz
certFiles.path = .
DEPLOYMENT += certFiles
INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE # Needed for e32svr.h in S^3 envs
diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp
index 68c3ea9..daf0fa3 100644
--- a/tests/auto/qstatictext/tst_qstatictext.cpp
+++ b/tests/auto/qstatictext/tst_qstatictext.cpp
@@ -79,8 +79,11 @@ private slots:
void rotatedPainter();
void scaledPainter();
void projectedPainter();
+#if 0
+ void rotatedScaledAndTranslatedPainter_data();
void rotatedScaledAndTranslatedPainter();
- void transformationChanged();
+#endif
+ void transformationChanged();
void plainTextVsRichText();
@@ -358,7 +361,7 @@ bool tst_QStaticText::supportsTransformations() const
QPaintEngine::Type type = engine->type();
if (type == QPaintEngine::OpenGL
-#if !defined Q_WS_WIN
+#if !defined(Q_WS_WIN) && !defined(Q_WS_X11)
|| type == QPaintEngine::Raster
#endif
)
@@ -455,12 +458,26 @@ void tst_QStaticText::projectedPainter()
QCOMPARE(imageDrawStaticText, imageDrawText);
}
+#if 0
+void tst_QStaticText::rotatedScaledAndTranslatedPainter_data()
+{
+ QTest::addColumn<qreal>("offset");
+
+ for (int i=0; i<100; ++i) {
+ qreal offset = 300 + i / 100.;
+ QTest::newRow(QByteArray::number(offset).constData()) << offset;
+ }
+}
+
void tst_QStaticText::rotatedScaledAndTranslatedPainter()
{
+ QFETCH(qreal, offset);
+
QPixmap imageDrawText(1000, 1000);
imageDrawText.fill(Qt::white);
{
QPainter p(&imageDrawText);
+ p.translate(offset, 0);
p.rotate(45.0);
p.scale(2.0, 2.0);
p.translate(100, 200);
@@ -472,6 +489,7 @@ void tst_QStaticText::rotatedScaledAndTranslatedPainter()
imageDrawStaticText.fill(Qt::white);
{
QPainter p(&imageDrawStaticText);
+ p.translate(offset, 0);
p.rotate(45.0);
p.scale(2.0, 2.0);
p.translate(100, 200);
@@ -491,6 +509,7 @@ void tst_QStaticText::rotatedScaledAndTranslatedPainter()
QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort);
QCOMPARE(imageDrawStaticText, imageDrawText);
}
+#endif
void tst_QStaticText::transformationChanged()
{
diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp
index ef82769..af6b371 100644
--- a/tests/auto/qstring/tst_qstring.cpp
+++ b/tests/auto/qstring/tst_qstring.cpp
@@ -57,6 +57,10 @@ Q_DECLARE_METATYPE(qlonglong)
//TESTED_CLASS=
//TESTED_FILES=
+#define CREATE_REF(string) \
+ const QString padded = QString::fromLatin1(" %1 ").arg(string); \
+ QStringRef ref = padded.midRef(1, padded.size() - 2);
+
class tst_QString : public QObject
{
Q_OBJECT
@@ -135,6 +139,7 @@ private slots:
void leftRef();
void stringRef();
void contains();
+ void count();
void lastIndexOf_data();
void lastIndexOf();
void indexOf_data();
@@ -169,6 +174,12 @@ private slots:
void fromLatin1Roundtrip();
void toLatin1Roundtrip_data();
void toLatin1Roundtrip();
+ void stringRef_toLatin1Roundtrip_data();
+ void stringRef_toLatin1Roundtrip();
+ void stringRef_utf8_data();
+ void stringRef_utf8();
+ void stringRef_local8Bit_data();
+ void stringRef_local8Bit();
void fromLatin1();
void fromAscii();
void arg();
@@ -1065,12 +1076,14 @@ void tst_QString::indexOf()
QFETCH( int, startpos );
QFETCH( bool, bcs );
QFETCH( int, resultpos );
+ CREATE_REF(needle);
Qt::CaseSensitivity cs = bcs ? Qt::CaseSensitive : Qt::CaseInsensitive;
bool needleIsLatin = (QString::fromLatin1(needle.toLatin1()) == needle);
QCOMPARE( haystack.indexOf(needle, startpos, cs), resultpos );
+ QCOMPARE( haystack.indexOf(ref, startpos, cs), resultpos );
if (needleIsLatin) {
QCOMPARE( haystack.indexOf(needle.toLatin1(), startpos, cs), resultpos );
QCOMPARE( haystack.indexOf(needle.toLatin1().data(), startpos, cs), resultpos );
@@ -1098,12 +1111,14 @@ void tst_QString::indexOf()
if (cs == Qt::CaseSensitive) {
QCOMPARE( haystack.indexOf(needle, startpos), resultpos );
+ QCOMPARE( haystack.indexOf(ref, startpos), resultpos );
if (needleIsLatin) {
QCOMPARE( haystack.indexOf(needle.toLatin1(), startpos), resultpos );
QCOMPARE( haystack.indexOf(needle.toLatin1().data(), startpos), resultpos );
}
if (startpos == 0) {
QCOMPARE( haystack.indexOf(needle), resultpos );
+ QCOMPARE( haystack.indexOf(ref), resultpos );
if (needleIsLatin) {
QCOMPARE( haystack.indexOf(needle.toLatin1()), resultpos );
QCOMPARE( haystack.indexOf(needle.toLatin1().data()), resultpos );
@@ -1112,6 +1127,7 @@ void tst_QString::indexOf()
}
if (needle.size() == 1) {
QCOMPARE(haystack.indexOf(needle.at(0), startpos, cs), resultpos);
+ QCOMPARE(haystack.indexOf(ref.at(0), startpos, cs), resultpos);
}
}
@@ -1172,14 +1188,17 @@ void tst_QString::indexOf2()
QFETCH( QString, haystack );
QFETCH( QString, needle );
QFETCH( int, resultpos );
+ CREATE_REF(needle);
QByteArray chaystack = haystack.toLatin1();
QByteArray cneedle = needle.toLatin1();
int got;
QCOMPARE( haystack.indexOf(needle, 0, Qt::CaseSensitive), resultpos );
+ QCOMPARE( haystack.indexOf(ref, 0, Qt::CaseSensitive), resultpos );
QCOMPARE( QStringMatcher(needle, Qt::CaseSensitive).indexIn(haystack, 0), resultpos );
QCOMPARE( haystack.indexOf(needle, 0, Qt::CaseInsensitive), resultpos );
+ QCOMPARE( haystack.indexOf(ref, 0, Qt::CaseInsensitive), resultpos );
QCOMPARE( QStringMatcher(needle, Qt::CaseInsensitive).indexIn(haystack, 0), resultpos );
if ( needle.length() > 0 ) {
got = haystack.lastIndexOf( needle, -1, Qt::CaseSensitive );
@@ -1246,10 +1265,12 @@ void tst_QString::lastIndexOf()
QFETCH(int, from);
QFETCH(int, expected);
QFETCH(bool, caseSensitive);
+ CREATE_REF(needle);
Qt::CaseSensitivity cs = (caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive);
QCOMPARE(haystack.lastIndexOf(needle, from, cs), expected);
+ QCOMPARE(haystack.lastIndexOf(ref, from, cs), expected);
QCOMPARE(haystack.lastIndexOf(needle.toLatin1(), from, cs), expected);
QCOMPARE(haystack.lastIndexOf(needle.toLatin1().data(), from, cs), expected);
@@ -1279,20 +1300,23 @@ void tst_QString::lastIndexOf()
if (cs == Qt::CaseSensitive) {
QCOMPARE(haystack.lastIndexOf(needle, from), expected);
+ QCOMPARE(haystack.lastIndexOf(ref, from), expected);
QCOMPARE(haystack.lastIndexOf(needle.toLatin1(), from), expected);
QCOMPARE(haystack.lastIndexOf(needle.toLatin1().data(), from), expected);
if (from == -1) {
QCOMPARE(haystack.lastIndexOf(needle), expected);
+ QCOMPARE(haystack.lastIndexOf(ref), expected);
QCOMPARE(haystack.lastIndexOf(needle.toLatin1()), expected);
QCOMPARE(haystack.lastIndexOf(needle.toLatin1().data()), expected);
}
}
if (needle.size() == 1) {
QCOMPARE(haystack.lastIndexOf(needle.at(0), from), expected);
+ QCOMPARE(haystack.lastIndexOf(ref.at(0), from), expected);
}
}
-void tst_QString::contains()
+void tst_QString::count()
{
QString a;
a="ABCDEFGHIEfGEFG"; // 15 chars
@@ -1307,8 +1331,42 @@ void tst_QString::contains()
QCOMPARE(a.count( "", Qt::CaseInsensitive), 16);
QCOMPARE(a.count(QRegExp("[FG][HI]")),1);
QCOMPARE(a.count(QRegExp("[G][HE]")),2);
+
+ CREATE_REF(QLatin1String("FG"));
+ QCOMPARE(a.count(ref),2);
+ QCOMPARE(a.count(ref,Qt::CaseInsensitive),3);
+ QCOMPARE(a.count( QStringRef(), Qt::CaseInsensitive), 16);
+ QStringRef emptyRef(&a, 0, 0);
+ QCOMPARE(a.count( emptyRef, Qt::CaseInsensitive), 16);
+
+}
+
+void tst_QString::contains()
+{
+ QString a;
+ a="ABCDEFGHIEfGEFG"; // 15 chars
+ QVERIFY(a.contains('A'));
+ QVERIFY(!a.contains('Z'));
+ QVERIFY(a.contains('E'));
+ QVERIFY(a.contains('F'));
+ QVERIFY(a.contains('F',Qt::CaseInsensitive));
+ QVERIFY(a.contains("FG"));
+ QVERIFY(a.contains("FG",Qt::CaseInsensitive));
+ QVERIFY(a.contains( QString(), Qt::CaseInsensitive));
+ QVERIFY(a.contains( "", Qt::CaseInsensitive));
+ QVERIFY(a.contains(QRegExp("[FG][HI]")));
+ QVERIFY(a.contains(QRegExp("[G][HE]")));
+
+ CREATE_REF(QLatin1String("FG"));
+ QVERIFY(a.contains(ref));
+ QVERIFY(a.contains(ref, Qt::CaseInsensitive));
+ QVERIFY(a.contains( QStringRef(), Qt::CaseInsensitive));
+ QStringRef emptyRef(&a, 0, 0);
+ QVERIFY(a.contains(emptyRef, Qt::CaseInsensitive));
+
}
+
void tst_QString::left()
{
QString a;
@@ -2829,6 +2887,14 @@ void tst_QString::startsWith()
QVERIFY( !a.startsWith(QChar(), Qt::CaseSensitive) );
QVERIFY( !a.startsWith(QLatin1Char(0), Qt::CaseSensitive) );
+#define TEST_REF_STARTS_WITH(string, yes) { CREATE_REF(string); QCOMPARE(a.startsWith(ref), yes); }
+
+ TEST_REF_STARTS_WITH("A", true);
+ TEST_REF_STARTS_WITH("AB", true);
+ TEST_REF_STARTS_WITH("C", false);
+ TEST_REF_STARTS_WITH("ABCDEF", false);
+#undef TEST_REF_STARTS_WITH
+
a = "";
QVERIFY( a.startsWith("") );
QVERIFY( a.startsWith(QString::null) );
@@ -2854,6 +2920,7 @@ void tst_QString::startsWith()
QVERIFY( !a.startsWith(QLatin1Char(0)) );
QVERIFY( !a.startsWith(QLatin1Char('x')) );
QVERIFY( !a.startsWith(QChar()) );
+
}
void tst_QString::endsWith()
@@ -2921,6 +2988,17 @@ void tst_QString::endsWith()
QVERIFY( !a.endsWith(QChar(), Qt::CaseSensitive) );
QVERIFY( !a.endsWith(QLatin1Char(0), Qt::CaseSensitive) );
+
+#define TEST_REF_ENDS_WITH(string, yes) { CREATE_REF(string); QCOMPARE(a.endsWith(ref), yes); }
+ TEST_REF_ENDS_WITH(QLatin1String("B"), true);
+ TEST_REF_ENDS_WITH(QLatin1String("AB"), true);
+ TEST_REF_ENDS_WITH(QLatin1String("C"), false);
+ TEST_REF_ENDS_WITH(QLatin1String("ABCDEF"), false);
+ TEST_REF_ENDS_WITH(QLatin1String(""), true);
+ TEST_REF_ENDS_WITH(QLatin1String(0), true);
+
+#undef TEST_REF_STARTS_WITH
+
a = "";
QVERIFY( a.endsWith("") );
QVERIFY( a.endsWith(QString::null) );
@@ -3056,6 +3134,20 @@ void tst_QString::utf8()
QCOMPARE( utf8, QByteArray(res.toUtf8()) );
}
+void tst_QString::stringRef_utf8_data()
+{
+ utf8_data();
+}
+
+void tst_QString::stringRef_utf8()
+{
+ QFETCH( QByteArray, utf8 );
+ QFETCH( QString, res );
+
+ QStringRef ref(&res, 0, res.length());
+ QCOMPARE( utf8, QByteArray(ref.toUtf8()) );
+}
+
// copied to tst_QTextCodec::utf8Codec_data()
void tst_QString::fromUtf8_data()
{
@@ -3235,6 +3327,20 @@ void tst_QString::local8Bit()
QCOMPARE(local8Bit.toLocal8Bit(), QByteArray(result));
}
+void tst_QString::stringRef_local8Bit_data()
+{
+ local8Bit_data();
+}
+
+void tst_QString::stringRef_local8Bit()
+{
+ QFETCH(QString, local8Bit);
+ QFETCH(QByteArray, result);
+
+ QStringRef ref(&local8Bit, 0, local8Bit.length());
+ QCOMPARE(ref.toLocal8Bit(), QByteArray(result));
+}
+
void tst_QString::fromLatin1Roundtrip_data()
{
QTest::addColumn<QByteArray>("latin1");
@@ -3338,6 +3444,38 @@ void tst_QString::toLatin1Roundtrip()
QCOMPARE(QString::fromLatin1(latin1, latin1.length()), unicodedst);
}
+void tst_QString::stringRef_toLatin1Roundtrip_data()
+{
+ toLatin1Roundtrip_data();
+}
+
+void tst_QString::stringRef_toLatin1Roundtrip()
+{
+ QFETCH(QByteArray, latin1);
+ QFETCH(QString, unicodesrc);
+ QFETCH(QString, unicodedst);
+
+ // QtTest safety check:
+ Q_ASSERT(latin1.isNull() == unicodesrc.isNull());
+ Q_ASSERT(latin1.isEmpty() == unicodesrc.isEmpty());
+ Q_ASSERT(latin1.length() == unicodesrc.length());
+ Q_ASSERT(latin1.isNull() == unicodedst.isNull());
+ Q_ASSERT(latin1.isEmpty() == unicodedst.isEmpty());
+ Q_ASSERT(latin1.length() == unicodedst.length());
+
+ if (!latin1.isEmpty())
+ while (latin1.length() < 128) {
+ latin1 += latin1;
+ unicodesrc += unicodesrc;
+ unicodedst += unicodedst;
+ }
+
+ // toLatin1
+ QStringRef src(&unicodesrc, 0, unicodesrc.length());
+ QCOMPARE(src.toLatin1().length(), latin1.length());
+ QCOMPARE(src.toLatin1(), latin1);
+}
+
void tst_QString::fromLatin1()
{
QString a;
diff --git a/tests/auto/qstringref/qstringref.pro b/tests/auto/qstringref/qstringref.pro
new file mode 100644
index 0000000..48e7ddf
--- /dev/null
+++ b/tests/auto/qstringref/qstringref.pro
@@ -0,0 +1,4 @@
+load(qttest_p4)
+SOURCES += tst_qstringref.cpp
+
+QT = core
diff --git a/tests/auto/qstringref/tst_qstringref.cpp b/tests/auto/qstringref/tst_qstringref.cpp
new file mode 100644
index 0000000..585e14e
--- /dev/null
+++ b/tests/auto/qstringref/tst_qstringref.cpp
@@ -0,0 +1,881 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <qstringlist.h>
+#include <qvariant.h>
+
+#include <qlocale.h>
+#include <locale.h>
+
+Q_DECLARE_METATYPE(qlonglong)
+
+//TESTED_CLASS=
+//TESTED_FILES=
+
+
+class tst_QStringRef : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QStringRef();
+ virtual ~tst_QStringRef();
+
+
+public slots:
+ void init();
+ void cleanup();
+private slots:
+ void endsWith();
+ void startsWith();
+ void contains();
+ void count();
+ void lastIndexOf_data();
+ void lastIndexOf();
+ void indexOf_data();
+ void indexOf();
+ void indexOf2_data();
+ void indexOf2();
+ void length_data();
+ void length();
+ void isEmpty();
+ void compare_data();
+ void compare();
+ void operator_eqeq_nullstring();
+};
+
+static QStringRef emptyRef()
+{
+ static const QString empty("");
+ return empty.midRef(0);
+}
+
+#define CREATE_REF(string) \
+ const QString padded = QString::fromLatin1(" %1 ").arg(string); \
+ QStringRef ref = padded.midRef(1, padded.size() - 2);
+
+typedef QList<int> IntList;
+
+Q_DECLARE_METATYPE(QList<QVariant>)
+Q_DECLARE_METATYPE(IntList)
+
+// This next bit is needed for the NAN and INF in string -> number conversion tests
+#include <float.h>
+#include <limits.h>
+#include <math.h>
+#if defined(Q_WS_WIN)
+# include <windows.h>
+// mingw defines NAN and INFINITY to 0/0 and x/0
+# if defined(Q_CC_GNU)
+# undef NAN
+# undef INFINITY
+# else
+# define isnan(d) _isnan(d)
+# endif
+#endif
+#if defined(Q_OS_MAC) && !defined isnan
+#define isnan(d) __isnand(d)
+#endif
+#if defined(Q_OS_SOLARIS)
+# include <ieeefp.h>
+#endif
+#if defined(Q_OS_OSF) && (defined(__DECC) || defined(__DECCXX))
+# define INFINITY DBL_INFINITY
+# define NAN DBL_QNAN
+#endif
+#if defined(Q_OS_IRIX) && defined(Q_CC_GNU)
+# include <ieeefp.h>
+# define isnan(d) isnand(d)
+#endif
+
+enum {
+ LittleEndian,
+ BigEndian
+#ifdef Q_BYTE_ORDER
+# if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ , ByteOrder = BigEndian
+# elif Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+ , ByteOrder = LittleEndian
+# else
+# error "undefined byte order"
+# endif
+};
+#else
+};
+static const unsigned int one = 1;
+static const bool ByteOrder = ((*((unsigned char *) &one) == 0) ? BigEndian : LittleEndian);
+#endif
+#if !defined(INFINITY)
+static const unsigned char be_inf_bytes[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0,0 };
+static const unsigned char le_inf_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f };
+static inline double inf()
+{
+ if (ByteOrder == BigEndian)
+ return *reinterpret_cast<const double *>(be_inf_bytes);
+ return *reinterpret_cast<const double *>(le_inf_bytes);
+}
+# define INFINITY (::inf())
+#endif
+#if !defined(NAN)
+static const unsigned char be_nan_bytes[] = { 0x7f, 0xf8, 0, 0, 0, 0, 0,0 };
+static const unsigned char le_nan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f };
+static inline double nan()
+{
+ if (ByteOrder == BigEndian)
+ return *reinterpret_cast<const double *>(be_nan_bytes);
+ return *reinterpret_cast<const double *>(le_nan_bytes);
+}
+# define NAN (::nan())
+#endif
+
+tst_QStringRef::tst_QStringRef()
+{
+}
+
+tst_QStringRef::~tst_QStringRef()
+{
+}
+
+void tst_QStringRef::init()
+{
+}
+
+void tst_QStringRef::cleanup()
+{
+ QLocale::setDefault(QString(QLatin1Char('C')));
+}
+
+void tst_QStringRef::length_data()
+{
+ QTest::addColumn<QString>("s1");
+ QTest::addColumn<int>("res");
+
+ QTest::newRow("data0") << QString("Test") << 4;
+ QTest::newRow("data1") << QString("The quick brown fox jumps over the lazy dog") << 43;
+ QTest::newRow("data2") << QString() << 0;
+ QTest::newRow("data3") << QString("A") << 1;
+ QTest::newRow("data4") << QString("AB") << 2;
+ QTest::newRow("data5") << QString("AB\n") << 3;
+ QTest::newRow("data6") << QString("AB\nC") << 4;
+ QTest::newRow("data7") << QString("\n") << 1;
+ QTest::newRow("data8") << QString("\nA") << 2;
+ QTest::newRow("data9") << QString("\nAB") << 3;
+ QTest::newRow("data10") << QString("\nAB\nCDE") << 7;
+ QTest::newRow("data11") << QString("shdnftrheid fhgnt gjvnfmd chfugkh bnfhg thgjf vnghturkf chfnguh bjgnfhvygh hnbhgutjfv dhdnjds dcjs d") << 100;
+ QTest::newRow("data12") << QString("") << 0;
+}
+
+
+void tst_QStringRef::length()
+{
+ QFETCH(QString, s1);
+ CREATE_REF(s1);
+ QTEST(ref.length(), "res");
+}
+
+
+void tst_QStringRef::isEmpty()
+{
+ QStringRef a;
+ QVERIFY(a.isEmpty());
+ QVERIFY(emptyRef().isEmpty());
+ CREATE_REF("Not empty");
+ QVERIFY(!ref.isEmpty());
+}
+
+void tst_QStringRef::indexOf_data()
+{
+ QTest::addColumn<QString>("haystack");
+ QTest::addColumn<QString>("needle");
+ QTest::addColumn<int>("startpos");
+ QTest::addColumn<bool>("bcs");
+ QTest::addColumn<int>("resultpos");
+
+ QTest::newRow("data0") << QString("abc") << QString("a") << 0 << true << 0;
+ QTest::newRow("data1") << QString("abc") << QString("a") << 0 << false << 0;
+ QTest::newRow("data2") << QString("abc") << QString("A") << 0 << true << -1;
+ QTest::newRow("data3") << QString("abc") << QString("A") << 0 << false << 0;
+ QTest::newRow("data4") << QString("abc") << QString("a") << 1 << true << -1;
+ QTest::newRow("data5") << QString("abc") << QString("a") << 1 << false << -1;
+ QTest::newRow("data6") << QString("abc") << QString("A") << 1 << true << -1;
+ QTest::newRow("data7") << QString("abc") << QString("A") << 1 << false << -1;
+ QTest::newRow("data8") << QString("abc") << QString("b") << 0 << true << 1;
+ QTest::newRow("data9") << QString("abc") << QString("b") << 0 << false << 1;
+ QTest::newRow("data10") << QString("abc") << QString("B") << 0 << true << -1;
+ QTest::newRow("data11") << QString("abc") << QString("B") << 0 << false << 1;
+ QTest::newRow("data12") << QString("abc") << QString("b") << 1 << true << 1;
+ QTest::newRow("data13") << QString("abc") << QString("b") << 1 << false << 1;
+ QTest::newRow("data14") << QString("abc") << QString("B") << 1 << true << -1;
+ QTest::newRow("data15") << QString("abc") << QString("B") << 1 << false << 1;
+ QTest::newRow("data16") << QString("abc") << QString("b") << 2 << true << -1;
+ QTest::newRow("data17") << QString("abc") << QString("b") << 2 << false << -1;
+
+ QTest::newRow("data20") << QString("ABC") << QString("A") << 0 << true << 0;
+ QTest::newRow("data21") << QString("ABC") << QString("A") << 0 << false << 0;
+ QTest::newRow("data22") << QString("ABC") << QString("a") << 0 << true << -1;
+ QTest::newRow("data23") << QString("ABC") << QString("a") << 0 << false << 0;
+ QTest::newRow("data24") << QString("ABC") << QString("A") << 1 << true << -1;
+ QTest::newRow("data25") << QString("ABC") << QString("A") << 1 << false << -1;
+ QTest::newRow("data26") << QString("ABC") << QString("a") << 1 << true << -1;
+ QTest::newRow("data27") << QString("ABC") << QString("a") << 1 << false << -1;
+ QTest::newRow("data28") << QString("ABC") << QString("B") << 0 << true << 1;
+ QTest::newRow("data29") << QString("ABC") << QString("B") << 0 << false << 1;
+ QTest::newRow("data30") << QString("ABC") << QString("b") << 0 << true << -1;
+ QTest::newRow("data31") << QString("ABC") << QString("b") << 0 << false << 1;
+ QTest::newRow("data32") << QString("ABC") << QString("B") << 1 << true << 1;
+ QTest::newRow("data33") << QString("ABC") << QString("B") << 1 << false << 1;
+ QTest::newRow("data34") << QString("ABC") << QString("b") << 1 << true << -1;
+ QTest::newRow("data35") << QString("ABC") << QString("b") << 1 << false << 1;
+ QTest::newRow("data36") << QString("ABC") << QString("B") << 2 << true << -1;
+ QTest::newRow("data37") << QString("ABC") << QString("B") << 2 << false << -1;
+
+ QTest::newRow("data40") << QString("aBc") << QString("bc") << 0 << true << -1;
+ QTest::newRow("data41") << QString("aBc") << QString("Bc") << 0 << true << 1;
+ QTest::newRow("data42") << QString("aBc") << QString("bC") << 0 << true << -1;
+ QTest::newRow("data43") << QString("aBc") << QString("BC") << 0 << true << -1;
+ QTest::newRow("data44") << QString("aBc") << QString("bc") << 0 << false << 1;
+ QTest::newRow("data45") << QString("aBc") << QString("Bc") << 0 << false << 1;
+ QTest::newRow("data46") << QString("aBc") << QString("bC") << 0 << false << 1;
+ QTest::newRow("data47") << QString("aBc") << QString("BC") << 0 << false << 1;
+ QTest::newRow("data48") << QString("AbC") << QString("bc") << 0 << true << -1;
+ QTest::newRow("data49") << QString("AbC") << QString("Bc") << 0 << true << -1;
+ QTest::newRow("data50") << QString("AbC") << QString("bC") << 0 << true << 1;
+ QTest::newRow("data51") << QString("AbC") << QString("BC") << 0 << true << -1;
+ QTest::newRow("data52") << QString("AbC") << QString("bc") << 0 << false << 1;
+ QTest::newRow("data53") << QString("AbC") << QString("Bc") << 0 << false << 1;
+
+ QTest::newRow("data54") << QString("AbC") << QString("bC") << 0 << false << 1;
+ QTest::newRow("data55") << QString("AbC") << QString("BC") << 0 << false << 1;
+ QTest::newRow("data56") << QString("AbC") << QString("BC") << 1 << false << 1;
+ QTest::newRow("data57") << QString("AbC") << QString("BC") << 2 << false << -1;
+#if 0
+ QTest::newRow("null-in-null") << QString() << QString() << 0 << false << 0;
+ QTest::newRow("empty-in-null") << QString() << QString("") << 0 << false << 0;
+ QTest::newRow("null-in-empty") << QString("") << QString() << 0 << false << 0;
+ QTest::newRow("empty-in-empty") << QString("") << QString("") << 0 << false << 0;
+#endif
+
+
+ QString s1 = "abc";
+ s1 += QChar(0xb5);
+ QString s2;
+ s2 += QChar(0x3bc);
+ QTest::newRow("data58") << QString(s1) << QString(s2) << 0 << false << 3;
+ s2.prepend("C");
+ QTest::newRow("data59") << QString(s1) << QString(s2) << 0 << false << 2;
+
+ QString veryBigHaystack(500, 'a');
+ veryBigHaystack += 'B';
+ QTest::newRow("BoyerMooreStressTest") << veryBigHaystack << veryBigHaystack << 0 << true << 0;
+ QTest::newRow("BoyerMooreStressTest2") << veryBigHaystack + 'c' << veryBigHaystack << 0 << true << 0;
+ QTest::newRow("BoyerMooreStressTest3") << 'c' + veryBigHaystack << veryBigHaystack << 0 << true << 1;
+ QTest::newRow("BoyerMooreStressTest4") << veryBigHaystack << veryBigHaystack + 'c' << 0 << true << -1;
+ QTest::newRow("BoyerMooreStressTest5") << veryBigHaystack << 'c' + veryBigHaystack << 0 << true << -1;
+ QTest::newRow("BoyerMooreStressTest6") << 'd' + veryBigHaystack << 'c' + veryBigHaystack << 0 << true << -1;
+ QTest::newRow("BoyerMooreStressTest6") << veryBigHaystack + 'c' << 'c' + veryBigHaystack << 0 << true << -1;
+
+ QTest::newRow("BoyerMooreInsensitiveStressTest") << veryBigHaystack << veryBigHaystack << 0 << false << 0;
+
+}
+
+void tst_QStringRef::indexOf()
+{
+ QFETCH(QString, haystack);
+ QFETCH(QString, needle);
+ QFETCH(int, startpos);
+ QFETCH(bool, bcs);
+ QFETCH(int, resultpos);
+
+ const QString haystackPadded = QString::fromLatin1(" %1 ").arg(haystack);
+ const QString needlePadded = QString::fromLatin1(" %1 ").arg(needle);
+ const QStringRef haystackRef(&haystackPadded, 1, haystack.size());
+ const QStringRef needleRef(&needlePadded, 1, needle.size());
+
+ Qt::CaseSensitivity cs = bcs ? Qt::CaseSensitive : Qt::CaseInsensitive;
+
+ QCOMPARE(haystack.indexOf(needle, startpos, cs), resultpos);
+ QCOMPARE(haystackRef.indexOf(needle, startpos, cs), resultpos);
+ QCOMPARE(haystackRef.indexOf(needleRef, startpos, cs), resultpos);
+ QCOMPARE(haystack.indexOf(needleRef, startpos, cs), resultpos);
+
+ if (cs == Qt::CaseSensitive) {
+ QCOMPARE(haystack.indexOf(needle, startpos), resultpos);
+ QCOMPARE(haystackRef.indexOf(needle, startpos), resultpos);
+ QCOMPARE(haystackRef.indexOf(needleRef, startpos), resultpos);
+ QCOMPARE(haystack.indexOf(needleRef, startpos), resultpos);
+ if (startpos == 0) {
+ QCOMPARE(haystack.indexOf(needle), resultpos);
+ QCOMPARE(haystackRef.indexOf(needle), resultpos);
+ QCOMPARE(haystackRef.indexOf(needleRef), resultpos);
+ QCOMPARE(haystack.indexOf(needleRef), resultpos);
+ }
+ }
+ if (needle.size() == 1) {
+ QCOMPARE(needle.at(0), needleRef.at(0));
+ QCOMPARE(haystack.indexOf(needleRef.at(0), startpos, cs), resultpos);
+ QCOMPARE(haystackRef.indexOf(needle.at(0), startpos, cs), resultpos);
+ QCOMPARE(haystackRef.indexOf(needleRef.at(0), startpos, cs), resultpos);
+ QCOMPARE(haystack.indexOf(needleRef.at(0), startpos ,cs), resultpos);
+ }
+}
+
+void tst_QStringRef::indexOf2_data()
+{
+ QTest::addColumn<QString>("haystack");
+ QTest::addColumn<QString>("needle");
+ QTest::addColumn<int>("resultpos");
+
+ QTest::newRow("data0") << QString() << QString() << 0;
+ QTest::newRow("data1") << QString() << QString("") << 0;
+ QTest::newRow("data2") << QString("") << QString() << 0;
+ QTest::newRow("data3") << QString("") << QString("") << 0;
+ QTest::newRow("data4") << QString() << QString("a") << -1;
+ QTest::newRow("data5") << QString() << QString("abcdefg") << -1;
+ QTest::newRow("data6") << QString("") << QString("a") << -1;
+ QTest::newRow("data7") << QString("") << QString("abcdefg") << -1;
+
+ QTest::newRow("data8") << QString("a") << QString() << 0;
+ QTest::newRow("data9") << QString("a") << QString("") << 0;
+ QTest::newRow("data10") << QString("a") << QString("a") << 0;
+ QTest::newRow("data11") << QString("a") << QString("b") << -1;
+ QTest::newRow("data12") << QString("a") << QString("abcdefg") << -1;
+ QTest::newRow("data13") << QString("ab") << QString() << 0;
+ QTest::newRow("data14") << QString("ab") << QString("") << 0;
+ QTest::newRow("data15") << QString("ab") << QString("a") << 0;
+ QTest::newRow("data16") << QString("ab") << QString("b") << 1;
+ QTest::newRow("data17") << QString("ab") << QString("ab") << 0;
+ QTest::newRow("data18") << QString("ab") << QString("bc") << -1;
+ QTest::newRow("data19") << QString("ab") << QString("abcdefg") << -1;
+
+ QTest::newRow("data30") << QString("abc") << QString("a") << 0;
+ QTest::newRow("data31") << QString("abc") << QString("b") << 1;
+ QTest::newRow("data32") << QString("abc") << QString("c") << 2;
+ QTest::newRow("data33") << QString("abc") << QString("d") << -1;
+ QTest::newRow("data34") << QString("abc") << QString("ab") << 0;
+ QTest::newRow("data35") << QString("abc") << QString("bc") << 1;
+ QTest::newRow("data36") << QString("abc") << QString("cd") << -1;
+ QTest::newRow("data37") << QString("abc") << QString("ac") << -1;
+
+ // sizeof(whale) > 32
+ QString whale = "a5zby6cx7dw8evf9ug0th1si2rj3qkp4lomn";
+ QString minnow = "zby";
+ QTest::newRow("data40") << whale << minnow << 2;
+ QTest::newRow("data41") << (whale + whale) << minnow << 2;
+ QTest::newRow("data42") << (minnow + whale) << minnow << 0;
+ QTest::newRow("data43") << whale << whale << 0;
+ QTest::newRow("data44") << (whale + whale) << whale << 0;
+ QTest::newRow("data45") << whale << (whale + whale) << -1;
+ QTest::newRow("data46") << (whale + whale) << (whale + whale) << 0;
+ QTest::newRow("data47") << (whale + whale) << (whale + minnow) << -1;
+ QTest::newRow("data48") << (minnow + whale) << whale << (int)minnow.length();
+}
+
+void tst_QStringRef::indexOf2()
+{
+ QFETCH(QString, haystack);
+ QFETCH(QString, needle);
+ QFETCH(int, resultpos);
+
+ const QString haystackPadded = QString::fromLatin1(" %1 ").arg(haystack);
+ const QString needlePadded = QString::fromLatin1(" %1 ").arg(needle);
+ const QStringRef haystackRef(&haystackPadded, 1, haystack.size());
+ const QStringRef needleRef(&needlePadded, 1, needle.size());
+
+
+ int got;
+
+ QCOMPARE(haystack.indexOf(needleRef, 0, Qt::CaseSensitive), resultpos);
+ QCOMPARE(haystackRef.indexOf(needle, 0, Qt::CaseSensitive), resultpos);
+ QCOMPARE(haystackRef.indexOf(needleRef, 0, Qt::CaseSensitive), resultpos);
+ QCOMPARE(haystack.indexOf(needleRef, 0, Qt::CaseInsensitive), resultpos);
+ QCOMPARE(haystackRef.indexOf(needle, 0, Qt::CaseInsensitive), resultpos);
+ QCOMPARE(haystackRef.indexOf(needleRef, 0, Qt::CaseInsensitive), resultpos);
+ if (needle.length() > 0) {
+ got = haystackRef.lastIndexOf(needle, -1, Qt::CaseSensitive);
+ QVERIFY(got == resultpos || (resultpos >= 0 && got >= resultpos));
+ got = haystackRef.lastIndexOf(needle, -1, Qt::CaseInsensitive);
+ QVERIFY(got == resultpos || (resultpos >= 0 && got >= resultpos));
+
+ got = haystack.lastIndexOf(needleRef, -1, Qt::CaseSensitive);
+ QVERIFY(got == resultpos || (resultpos >= 0 && got >= resultpos));
+ got = haystack.lastIndexOf(needleRef, -1, Qt::CaseInsensitive);
+ QVERIFY(got == resultpos || (resultpos >= 0 && got >= resultpos));
+
+ got = haystackRef.lastIndexOf(needleRef, -1, Qt::CaseSensitive);
+ QVERIFY(got == resultpos || (resultpos >= 0 && got >= resultpos));
+ got = haystackRef.lastIndexOf(needleRef, -1, Qt::CaseInsensitive);
+ QVERIFY(got == resultpos || (resultpos >= 0 && got >= resultpos));
+ }
+}
+
+void tst_QStringRef::lastIndexOf_data()
+{
+ QTest::addColumn<QString>("haystack");
+ QTest::addColumn<QString>("needle");
+ QTest::addColumn<int>("from");
+ QTest::addColumn<int>("expected");
+ QTest::addColumn<bool>("caseSensitive");
+
+ QString a = "ABCDEFGHIEfGEFG";
+
+ QTest::newRow("-1") << a << "G" << a.size() - 1 << 14 << true;
+ QTest::newRow("1") << a << "G" << - 1 << 14 << true;
+ QTest::newRow("2") << a << "G" << -3 << 11 << true;
+ QTest::newRow("3") << a << "G" << -5 << 6 << true;
+ QTest::newRow("4") << a << "G" << 14 << 14 << true;
+ QTest::newRow("5") << a << "G" << 13 << 11 << true;
+ QTest::newRow("6") << a << "B" << a.size() - 1 << 1 << true;
+ QTest::newRow("6") << a << "B" << - 1 << 1 << true;
+ QTest::newRow("7") << a << "B" << 1 << 1 << true;
+ QTest::newRow("8") << a << "B" << 0 << -1 << true;
+
+ QTest::newRow("9") << a << "G" << -1 << a.size()-1 << true;
+ QTest::newRow("10") << a << "G" << a.size()-1 << a.size()-1 << true;
+ QTest::newRow("11") << a << "G" << a.size() << -1 << true;
+ QTest::newRow("12") << a << "A" << 0 << 0 << true;
+ QTest::newRow("13") << a << "A" << -1*a.size() << 0 << true;
+
+ QTest::newRow("15") << a << "efg" << 0 << -1 << false;
+ QTest::newRow("16") << a << "efg" << a.size() << -1 << false;
+ QTest::newRow("17") << a << "efg" << -1 * a.size() << -1 << false;
+ QTest::newRow("19") << a << "efg" << a.size() - 1 << 12 << false;
+ QTest::newRow("20") << a << "efg" << 12 << 12 << false;
+ QTest::newRow("21") << a << "efg" << -12 << -1 << false;
+ QTest::newRow("22") << a << "efg" << 11 << 9 << false;
+
+ QTest::newRow("24") << "" << "asdf" << -1 << -1 << false;
+ QTest::newRow("25") << "asd" << "asdf" << -1 << -1 << false;
+ QTest::newRow("26") << "" << QString() << -1 << -1 << false;
+
+ QTest::newRow("27") << a << "" << a.size() << a.size() << false;
+ QTest::newRow("28") << a << "" << a.size() + 10 << -1 << false;
+}
+
+void tst_QStringRef::lastIndexOf()
+{
+ QFETCH(QString, haystack);
+ QFETCH(QString, needle);
+ QFETCH(int, from);
+ QFETCH(int, expected);
+ QFETCH(bool, caseSensitive);
+
+ const QString haystackPadded = QString::fromLatin1(" %1 ").arg(haystack);
+ const QString needlePadded = QString::fromLatin1(" %1 ").arg(needle);
+ const QStringRef haystackRef(&haystackPadded, 1, haystack.size());
+ const QStringRef needleRef(&needlePadded, 1, needle.size());
+
+ Qt::CaseSensitivity cs = (caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive);
+
+ QCOMPARE(haystack.lastIndexOf(needleRef, from, cs), expected);
+ QCOMPARE(haystackRef.lastIndexOf(needle, from, cs), expected);
+ QCOMPARE(haystackRef.lastIndexOf(needleRef, from, cs), expected);
+
+
+ if (cs == Qt::CaseSensitive) {
+ QCOMPARE(haystack.lastIndexOf(needleRef, from), expected);
+ QCOMPARE(haystackRef.lastIndexOf(needle, from), expected);
+ QCOMPARE(haystackRef.lastIndexOf(needleRef, from), expected);
+
+ if (from == -1) {
+ QCOMPARE(haystack.lastIndexOf(needleRef), expected);
+ QCOMPARE(haystackRef.lastIndexOf(needle), expected);
+ QCOMPARE(haystackRef.lastIndexOf(needleRef), expected);
+
+ }
+ }
+ if (needle.size() == 1) {
+ QCOMPARE(haystack.lastIndexOf(needleRef.at(0), from), expected);
+ QCOMPARE(haystackRef.lastIndexOf(needle.at(0), from), expected);
+ QCOMPARE(haystackRef.lastIndexOf(needleRef.at(0), from), expected);
+ }
+}
+
+void tst_QStringRef::count()
+{
+ const QString a = QString::fromLatin1("ABCDEFGHIEfGEFG"); // 15 chars
+ CREATE_REF(a);
+ QCOMPARE(ref.count('A'),1);
+ QCOMPARE(ref.count('Z'),0);
+ QCOMPARE(ref.count('E'),3);
+ QCOMPARE(ref.count('F'),2);
+ QCOMPARE(ref.count('F',Qt::CaseInsensitive),3);
+ QCOMPARE(ref.count("FG"),2);
+ QCOMPARE(ref.count("FG",Qt::CaseInsensitive),3);
+ QCOMPARE(ref.count(QString(), Qt::CaseInsensitive), 16);
+ QCOMPARE(ref.count("", Qt::CaseInsensitive), 16);
+}
+
+void tst_QStringRef::contains()
+{
+ const QString a = QString::fromLatin1("ABCDEFGHIEfGEFG"); // 15 chars
+ CREATE_REF(a);
+ QVERIFY(ref.contains('A'));
+ QVERIFY(!ref.contains('Z'));
+ QVERIFY(ref.contains('E'));
+ QVERIFY(ref.contains('F'));
+ QVERIFY(ref.contains('F',Qt::CaseInsensitive));
+ QVERIFY(ref.contains("FG"));
+ QVERIFY(ref.contains(QString("FG").midRef(0)));
+ const QString ref2 = QString::fromLatin1(" FG ");
+ QVERIFY(ref.contains(ref2.midRef(1, 2),Qt::CaseInsensitive));
+ QVERIFY(ref.contains(QString(), Qt::CaseInsensitive));
+ QVERIFY(ref.contains("", Qt::CaseInsensitive)); // apparently
+}
+
+void tst_QStringRef::startsWith()
+{
+ {
+ const QString a = QString::fromLatin1("AB");
+ CREATE_REF(a);
+ QVERIFY(ref.startsWith("A"));
+ QVERIFY(ref.startsWith("AB"));
+ QVERIFY(!ref.startsWith("C"));
+ QVERIFY(!ref.startsWith("ABCDEF"));
+ QVERIFY(ref.startsWith(""));
+ QVERIFY(ref.startsWith(QString::null));
+ QVERIFY(ref.startsWith('A'));
+ QVERIFY(ref.startsWith(QLatin1Char('A')));
+ QVERIFY(ref.startsWith(QChar('A')));
+ QVERIFY(!ref.startsWith('C'));
+ QVERIFY(!ref.startsWith(QChar()));
+ QVERIFY(!ref.startsWith(QLatin1Char(0)));
+
+ QVERIFY(ref.startsWith(QLatin1String("A")));
+ QVERIFY(ref.startsWith(QLatin1String("AB")));
+ QVERIFY(!ref.startsWith(QLatin1String("C")));
+ QVERIFY(!ref.startsWith(QLatin1String("ABCDEF")));
+ QVERIFY(ref.startsWith(QLatin1String("")));
+ QVERIFY(ref.startsWith(QLatin1String(0)));
+
+ QVERIFY(ref.startsWith("A", Qt::CaseSensitive));
+ QVERIFY(ref.startsWith("A", Qt::CaseInsensitive));
+ QVERIFY(!ref.startsWith("a", Qt::CaseSensitive));
+ QVERIFY(ref.startsWith("a", Qt::CaseInsensitive));
+ QVERIFY(!ref.startsWith("aB", Qt::CaseSensitive));
+ QVERIFY(ref.startsWith("aB", Qt::CaseInsensitive));
+ QVERIFY(!ref.startsWith("C", Qt::CaseSensitive));
+ QVERIFY(!ref.startsWith("C", Qt::CaseInsensitive));
+ QVERIFY(!ref.startsWith("c", Qt::CaseSensitive));
+ QVERIFY(!ref.startsWith("c", Qt::CaseInsensitive));
+ QVERIFY(!ref.startsWith("abcdef", Qt::CaseInsensitive));
+ QVERIFY(ref.startsWith("", Qt::CaseInsensitive));
+ QVERIFY(ref.startsWith(QString::null, Qt::CaseInsensitive));
+ QVERIFY(ref.startsWith('a', Qt::CaseInsensitive));
+ QVERIFY(ref.startsWith('A', Qt::CaseInsensitive));
+ QVERIFY(ref.startsWith(QLatin1Char('a'), Qt::CaseInsensitive));
+ QVERIFY(ref.startsWith(QChar('a'), Qt::CaseInsensitive));
+ QVERIFY(!ref.startsWith('c', Qt::CaseInsensitive));
+ QVERIFY(!ref.startsWith(QChar(), Qt::CaseInsensitive));
+ QVERIFY(!ref.startsWith(QLatin1Char(0), Qt::CaseInsensitive));
+
+ QVERIFY(ref.startsWith(QLatin1String("A"), Qt::CaseSensitive));
+ QVERIFY(ref.startsWith(QLatin1String("A"), Qt::CaseInsensitive));
+ QVERIFY(!ref.startsWith(QLatin1String("a"), Qt::CaseSensitive));
+ QVERIFY(ref.startsWith(QLatin1String("a"), Qt::CaseInsensitive));
+ QVERIFY(!ref.startsWith(QLatin1String("aB"), Qt::CaseSensitive));
+ QVERIFY(ref.startsWith(QLatin1String("aB"), Qt::CaseInsensitive));
+ QVERIFY(!ref.startsWith(QLatin1String("C"), Qt::CaseSensitive));
+ QVERIFY(!ref.startsWith(QLatin1String("C"), Qt::CaseInsensitive));
+ QVERIFY(!ref.startsWith(QLatin1String("c"), Qt::CaseSensitive));
+ QVERIFY(!ref.startsWith(QLatin1String("c"), Qt::CaseInsensitive));
+ QVERIFY(!ref.startsWith(QLatin1String("abcdef"), Qt::CaseInsensitive));
+ QVERIFY(ref.startsWith(QLatin1String(""), Qt::CaseInsensitive));
+ QVERIFY(ref.startsWith(QLatin1String(0), Qt::CaseInsensitive));
+ QVERIFY(ref.startsWith('A', Qt::CaseSensitive));
+ QVERIFY(ref.startsWith(QLatin1Char('A'), Qt::CaseSensitive));
+ QVERIFY(ref.startsWith(QChar('A'), Qt::CaseSensitive));
+ QVERIFY(!ref.startsWith('a', Qt::CaseSensitive));
+ QVERIFY(!ref.startsWith(QChar(), Qt::CaseSensitive));
+ QVERIFY(!ref.startsWith(QLatin1Char(0), Qt::CaseSensitive));
+ }
+ {
+ const QString a = QString::fromLatin1("");
+ CREATE_REF(a);
+ QVERIFY(ref.startsWith(""));
+ QVERIFY(ref.startsWith(QString::null));
+ QVERIFY(!ref.startsWith("ABC"));
+
+ QVERIFY(ref.startsWith(QLatin1String("")));
+ QVERIFY(ref.startsWith(QLatin1String(0)));
+ QVERIFY(!ref.startsWith(QLatin1String("ABC")));
+
+ QVERIFY(!ref.startsWith(QLatin1Char(0)));
+ QVERIFY(!ref.startsWith(QLatin1Char('x')));
+ QVERIFY(!ref.startsWith(QChar()));
+ }
+ {
+ const QStringRef ref;
+ QVERIFY(!ref.startsWith(""));
+ QVERIFY(ref.startsWith(QString::null));
+ QVERIFY(!ref.startsWith("ABC"));
+
+ QVERIFY(!ref.startsWith(QLatin1String("")));
+ QVERIFY(ref.startsWith(QLatin1String(0)));
+ QVERIFY(!ref.startsWith(QLatin1String("ABC")));
+
+ QVERIFY(!ref.startsWith(QLatin1Char(0)));
+ QVERIFY(!ref.startsWith(QLatin1Char('x')));
+ QVERIFY(!ref.startsWith(QChar()));
+ }
+}
+
+void tst_QStringRef::endsWith()
+{
+ {
+ const QString a = QString::fromLatin1("AB");
+ CREATE_REF(a);
+ QVERIFY(ref.endsWith("B"));
+ QVERIFY(ref.endsWith("AB"));
+ QVERIFY(!ref.endsWith("C"));
+ QVERIFY(!ref.endsWith("ABCDEF"));
+ QVERIFY(ref.endsWith(""));
+ QVERIFY(ref.endsWith(QString::null));
+ QVERIFY(ref.endsWith('B'));
+ QVERIFY(ref.endsWith(QLatin1Char('B')));
+ QVERIFY(ref.endsWith(QChar('B')));
+ QVERIFY(!ref.endsWith('C'));
+ QVERIFY(!ref.endsWith(QChar()));
+ QVERIFY(!ref.endsWith(QLatin1Char(0)));
+
+ QVERIFY(ref.endsWith(QLatin1String("B")));
+ QVERIFY(ref.endsWith(QLatin1String("AB")));
+ QVERIFY(!ref.endsWith(QLatin1String("C")));
+ QVERIFY(!ref.endsWith(QLatin1String("ABCDEF")));
+ QVERIFY(ref.endsWith(QLatin1String("")));
+ QVERIFY(ref.endsWith(QLatin1String(0)));
+
+ QVERIFY(ref.endsWith("B", Qt::CaseSensitive));
+ QVERIFY(ref.endsWith("B", Qt::CaseInsensitive));
+ QVERIFY(!ref.endsWith("b", Qt::CaseSensitive));
+ QVERIFY(ref.endsWith("b", Qt::CaseInsensitive));
+ QVERIFY(!ref.endsWith("aB", Qt::CaseSensitive));
+ QVERIFY(ref.endsWith("aB", Qt::CaseInsensitive));
+ QVERIFY(!ref.endsWith("C", Qt::CaseSensitive));
+ QVERIFY(!ref.endsWith("C", Qt::CaseInsensitive));
+ QVERIFY(!ref.endsWith("c", Qt::CaseSensitive));
+ QVERIFY(!ref.endsWith("c", Qt::CaseInsensitive));
+ QVERIFY(!ref.endsWith("abcdef", Qt::CaseInsensitive));
+ QVERIFY(ref.endsWith("", Qt::CaseInsensitive));
+ QVERIFY(ref.endsWith(QString::null, Qt::CaseInsensitive));
+ QVERIFY(ref.endsWith('b', Qt::CaseInsensitive));
+ QVERIFY(ref.endsWith('B', Qt::CaseInsensitive));
+ QVERIFY(ref.endsWith(QLatin1Char('b'), Qt::CaseInsensitive));
+ QVERIFY(ref.endsWith(QChar('b'), Qt::CaseInsensitive));
+ QVERIFY(!ref.endsWith('c', Qt::CaseInsensitive));
+ QVERIFY(!ref.endsWith(QChar(), Qt::CaseInsensitive));
+ QVERIFY(!ref.endsWith(QLatin1Char(0), Qt::CaseInsensitive));
+
+ QVERIFY(ref.endsWith(QLatin1String("B"), Qt::CaseSensitive));
+ QVERIFY(ref.endsWith(QLatin1String("B"), Qt::CaseInsensitive));
+ QVERIFY(!ref.endsWith(QLatin1String("b"), Qt::CaseSensitive));
+ QVERIFY(ref.endsWith(QLatin1String("b"), Qt::CaseInsensitive));
+ QVERIFY(!ref.endsWith(QLatin1String("aB"), Qt::CaseSensitive));
+ QVERIFY(ref.endsWith(QLatin1String("aB"), Qt::CaseInsensitive));
+ QVERIFY(!ref.endsWith(QLatin1String("C"), Qt::CaseSensitive));
+ QVERIFY(!ref.endsWith(QLatin1String("C"), Qt::CaseInsensitive));
+ QVERIFY(!ref.endsWith(QLatin1String("c"), Qt::CaseSensitive));
+ QVERIFY(!ref.endsWith(QLatin1String("c"), Qt::CaseInsensitive));
+ QVERIFY(!ref.endsWith(QLatin1String("abcdef"), Qt::CaseInsensitive));
+ QVERIFY(ref.endsWith(QLatin1String(""), Qt::CaseInsensitive));
+ QVERIFY(ref.endsWith(QLatin1String(0), Qt::CaseInsensitive));
+ QVERIFY(ref.endsWith('B', Qt::CaseSensitive));
+ QVERIFY(ref.endsWith(QLatin1Char('B'), Qt::CaseSensitive));
+ QVERIFY(ref.endsWith(QChar('B'), Qt::CaseSensitive));
+ QVERIFY(!ref.endsWith('b', Qt::CaseSensitive));
+ QVERIFY(!ref.endsWith(QChar(), Qt::CaseSensitive));
+ QVERIFY(!ref.endsWith(QLatin1Char(0), Qt::CaseSensitive));
+
+ }
+ {
+ const QString a = QString::fromLatin1("");
+ CREATE_REF(a);
+ QVERIFY(ref.endsWith(""));
+ QVERIFY(ref.endsWith(QString::null));
+ QVERIFY(!ref.endsWith("ABC"));
+ QVERIFY(!ref.endsWith(QLatin1Char(0)));
+ QVERIFY(!ref.endsWith(QLatin1Char('x')));
+ QVERIFY(!ref.endsWith(QChar()));
+
+ QVERIFY(ref.endsWith(QLatin1String("")));
+ QVERIFY(ref.endsWith(QLatin1String(0)));
+ QVERIFY(!ref.endsWith(QLatin1String("ABC")));
+ }
+
+ {
+ QStringRef ref;
+ QVERIFY(!ref.endsWith(""));
+ QVERIFY(ref.endsWith(QString::null));
+ QVERIFY(!ref.endsWith("ABC"));
+
+ QVERIFY(!ref.endsWith(QLatin1String("")));
+ QVERIFY(ref.endsWith(QLatin1String(0)));
+ QVERIFY(!ref.endsWith(QLatin1String("ABC")));
+
+ QVERIFY(!ref.endsWith(QLatin1Char(0)));
+ QVERIFY(!ref.endsWith(QLatin1Char('x')));
+ QVERIFY(!ref.endsWith(QChar()));
+ }
+}
+
+void tst_QStringRef::operator_eqeq_nullstring()
+{
+ /* Some of these might not be all that logical but it's the behaviour we've had since 3.0.0
+ so we should probably stick with it. */
+
+ QVERIFY(QStringRef() == "");
+ QVERIFY("" == QStringRef());
+
+ QVERIFY(QString("") == "");
+ QVERIFY("" == QString(""));
+
+ QVERIFY(QStringRef().size() == 0);
+
+ QVERIFY(QString("").size() == 0);
+
+ QVERIFY(QStringRef() == QString(""));
+ QVERIFY(QString("") == QString());
+}
+
+static inline int sign(int x)
+{
+ return x == 0 ? 0 : (x < 0 ? -1 : 1);
+}
+
+void tst_QStringRef::compare_data()
+{
+ QTest::addColumn<QString>("s1");
+ QTest::addColumn<QString>("s2");
+ QTest::addColumn<int>("csr"); // case sensitive result
+ QTest::addColumn<int>("cir"); // case insensitive result
+
+
+ // null strings
+ QTest::newRow("data0") << QString("") << QString("") << 0 << 0;
+ QTest::newRow("data1") << QString("a") << QString("") << 1 << 1;
+ QTest::newRow("data2") << QString("") << QString("a") << -1 << -1;
+
+ // equal length
+ QTest::newRow("data3") << QString("abc") << QString("abc") << 0 << 0;
+ QTest::newRow("data4") << QString("abC") << QString("abc") << -1 << 0;
+ QTest::newRow("data5") << QString("abc") << QString("abC") << 1 << 0;
+
+ // different length
+ QTest::newRow("data6") << QString("abcdef") << QString("abc") << 1 << 1;
+ QTest::newRow("data6") << QString("abCdef") << QString("abc") << -1 << 1;
+ QTest::newRow("data7") << QString("abc") << QString("abcdef") << -1 << -1;
+
+ QString upper;
+ upper += QChar(QChar::highSurrogate(0x10400));
+ upper += QChar(QChar::lowSurrogate(0x10400));
+ QString lower;
+ lower += QChar(QChar::highSurrogate(0x10428));
+ lower += QChar(QChar::lowSurrogate(0x10428));
+ QTest::newRow("data8") << upper << lower << -1 << 0;
+
+ // embedded nulls
+ // These dont work as of now. Its OK that these dont work since \0 is not a valid unicode
+ /*QTest::newRow("data9") << QString(QByteArray("\0", 1)) << QString(QByteArray("\0", 1)) << 0 << 0;
+ QTest::newRow("data10") << QString(QByteArray("\0", 1)) << QString("") << 1 << 1;
+ QTest::newRow("data11") << QString("") << QString(QByteArray("\0", 1)) << -1 << -1;
+ QTest::newRow("data12") << QString("ab\0c") << QString(QByteArray("ab\0c", 4)) << 0 << 0;
+ QTest::newRow("data13") << QString(QByteArray("ab\0c", 4)) << QString("abc") << -1 << -1;
+ QTest::newRow("data14") << QString("abc") << QString(QByteArray("ab\0c", 4)) << 1 << 1;*/
+}
+
+static bool isLatin(const QString &s)
+{
+ for (int i = 0; i < s.length(); ++i)
+ if (s.at(i).unicode() > 0xff)
+ return false;
+ return true;
+}
+
+void tst_QStringRef::compare()
+{
+ QFETCH(QString, s1);
+ QFETCH(QString, s2);
+ QFETCH(int, csr);
+ QFETCH(int, cir);
+
+ QStringRef r1(&s1, 0, s1.length());
+ QStringRef r2(&s2, 0, s2.length());
+
+ QCOMPARE(sign(QString::compare(s1, s2)), csr);
+ QCOMPARE(sign(QStringRef::compare(r1, r2)), csr);
+ QCOMPARE(sign(s1.compare(s2)), csr);
+ QCOMPARE(sign(s1.compare(r2)), csr);
+ QCOMPARE(sign(r1.compare(r2)), csr);
+
+ QCOMPARE(sign(s1.compare(s2, Qt::CaseSensitive)), csr);
+ QCOMPARE(sign(s1.compare(s2, Qt::CaseInsensitive)), cir);
+ QCOMPARE(sign(s1.compare(r2, Qt::CaseSensitive)), csr);
+ QCOMPARE(sign(s1.compare(r2, Qt::CaseInsensitive)), cir);
+ QCOMPARE(sign(r1.compare(r2, Qt::CaseSensitive)), csr);
+ QCOMPARE(sign(r1.compare(r2, Qt::CaseInsensitive)), cir);
+
+ QCOMPARE(sign(QString::compare(s1, s2, Qt::CaseSensitive)), csr);
+ QCOMPARE(sign(QString::compare(s1, s2, Qt::CaseInsensitive)), cir);
+ QCOMPARE(sign(QString::compare(s1, r2, Qt::CaseSensitive)), csr);
+ QCOMPARE(sign(QString::compare(s1, r2, Qt::CaseInsensitive)), cir);
+ QCOMPARE(sign(QStringRef::compare(r1, r2, Qt::CaseSensitive)), csr);
+ QCOMPARE(sign(QStringRef::compare(r1, r2, Qt::CaseInsensitive)), cir);
+
+ if (!cir) {
+ QCOMPARE(s1.toCaseFolded(), s2.toCaseFolded());
+ }
+
+ if (isLatin(s2)) {
+ QCOMPARE(sign(QString::compare(s1, QLatin1String(s2.toLatin1()))), csr);
+ QCOMPARE(sign(QString::compare(s1, QLatin1String(s2.toLatin1()), Qt::CaseInsensitive)), cir);
+ QCOMPARE(sign(QStringRef::compare(r1, QLatin1String(s2.toLatin1()))), csr);
+ QCOMPARE(sign(QStringRef::compare(r1, QLatin1String(s2.toLatin1()), Qt::CaseInsensitive)), cir);
+ }
+
+ if (isLatin(s1)) {
+ QCOMPARE(sign(QString::compare(QLatin1String(s1.toLatin1()), s2)), csr);
+ QCOMPARE(sign(QString::compare(QLatin1String(s1.toLatin1()), s2, Qt::CaseInsensitive)), cir);
+ }
+}
+
+QTEST_APPLESS_MAIN(tst_QStringRef)
+
+#include "tst_qstringref.moc"
diff --git a/tests/auto/qstyle/qstyle.pro b/tests/auto/qstyle/qstyle.pro
index 11f5943..eb198e2 100644
--- a/tests/auto/qstyle/qstyle.pro
+++ b/tests/auto/qstyle/qstyle.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qstyle.cpp
wince*|symbian: {
!symbian:DEFINES += SRCDIR=\\\".\\\"
- addPixmap.sources = task_25863.png
+ addPixmap.files = task_25863.png
addPixmap.path = .
DEPLOYMENT += addPixmap
} else {
diff --git a/tests/auto/qsvggenerator/qsvggenerator.pro b/tests/auto/qsvggenerator/qsvggenerator.pro
index 1ccf8e9..2e899a9 100644
--- a/tests/auto/qsvggenerator/qsvggenerator.pro
+++ b/tests/auto/qsvggenerator/qsvggenerator.pro
@@ -8,7 +8,7 @@ QT += svg xml
SOURCES += tst_qsvggenerator.cpp
wince*|symbian {
- addFiles.sources = referenceSvgs
+ addFiles.files = referenceSvgs
addFiles.path = .
DEPLOYMENT += addFiles
}
diff --git a/tests/auto/qsvgrenderer/qsvgrenderer.pro b/tests/auto/qsvgrenderer/qsvgrenderer.pro
index 0b785e3..49337e2 100644
--- a/tests/auto/qsvgrenderer/qsvgrenderer.pro
+++ b/tests/auto/qsvgrenderer/qsvgrenderer.pro
@@ -9,7 +9,7 @@ SOURCES += tst_qsvgrenderer.cpp
RESOURCES += resources.qrc
wince*|symbian {
- addFiles.sources = *.svg *.svgz
+ addFiles.files = *.svg *.svgz
addFiles.path = .
DEPLOYMENT += addFiles
diff --git a/tests/auto/qtabbar/tst_qtabbar.cpp b/tests/auto/qtabbar/tst_qtabbar.cpp
index ac3de20..84a6991 100644
--- a/tests/auto/qtabbar/tst_qtabbar.cpp
+++ b/tests/auto/qtabbar/tst_qtabbar.cpp
@@ -76,6 +76,7 @@ private slots:
void setElideMode_data();
void setElideMode();
+ void sizeHints();
void setUsesScrollButtons_data();
void setUsesScrollButtons();
@@ -280,6 +281,46 @@ void tst_QTabBar::setElideMode()
QTEST(int(tabBar.elideMode()), "expectedMode");
}
+void tst_QTabBar::sizeHints()
+{
+ QTabBar tabBar;
+ QSKIP("To be fixed on Mac (font size below not large enough) and Linux QWS (probably too large for the screen).", SkipSingle);
+ tabBar.setFont(QFont("Arial", 10));
+ tabBar.addTab("tab 01");
+ tabBar.addTab("tab 02");
+ tabBar.addTab("tab 03");
+ tabBar.addTab("tab 04");
+ tabBar.addTab("tab 05");
+ tabBar.addTab("tab 06");
+ tabBar.addTab("This is tab7");
+ tabBar.addTab("This is tab8");
+ tabBar.addTab("This is tab9 with a very long title");
+
+ // No eliding and no scrolling -> tabbar becomes very wide
+ tabBar.setUsesScrollButtons(false);
+ tabBar.setElideMode(Qt::ElideNone);
+// qDebug() << tabBar.minimumSizeHint() << tabBar.sizeHint();
+ QVERIFY(tabBar.minimumSizeHint().width() > 700);
+ QVERIFY(tabBar.sizeHint().width() > 700);
+
+ // Scrolling enabled -> no reason to become very wide
+ tabBar.setUsesScrollButtons(true);
+ // qDebug() << tabBar.minimumSizeHint() << tabBar.sizeHint();
+ QVERIFY(tabBar.minimumSizeHint().width() < 200);
+ QVERIFY(tabBar.sizeHint().width() > 700); // unchanged
+
+ // Eliding enabled -> no reason to become very wide
+ tabBar.setUsesScrollButtons(false);
+ tabBar.setElideMode(Qt::ElideRight);
+// qDebug() << tabBar.minimumSizeHint() << tabBar.sizeHint();
+ QVERIFY(tabBar.minimumSizeHint().width() < 500);
+ QVERIFY(tabBar.sizeHint().width() > 700); // unchanged
+
+ tabBar.addTab("This is tab10 with a very long title");
+ QVERIFY(tabBar.minimumSizeHint().width() < 600);
+ QVERIFY(tabBar.sizeHint().width() > 700); // unchanged
+}
+
void tst_QTabBar::setUsesScrollButtons_data()
{
QTest::addColumn<int>("usesArrows");
diff --git a/tests/auto/qtabwidget/tst_qtabwidget.cpp b/tests/auto/qtabwidget/tst_qtabwidget.cpp
index 504579f..27581b0 100644
--- a/tests/auto/qtabwidget/tst_qtabwidget.cpp
+++ b/tests/auto/qtabwidget/tst_qtabwidget.cpp
@@ -45,6 +45,7 @@
#include <qdebug.h>
#include <qapplication.h>
#include <qlabel.h>
+#include <QtGui/qboxlayout.h>
//TESTED_CLASS=
//TESTED_FILES=
@@ -120,6 +121,9 @@ class tst_QTabWidget:public QObject {
void clear();
void keyboardNavigation();
void paintEventCount();
+ void minimumSizeHint();
+ void heightForWidth_data();
+ void heightForWidth();
private:
int addPage();
@@ -624,6 +628,74 @@ void tst_QTabWidget::paintEventCount()
QCOMPARE(tab2->count, 1);
}
+void tst_QTabWidget::minimumSizeHint()
+{
+ QTabWidget tw;
+ QWidget *page = new QWidget;
+ QVBoxLayout *lay = new QVBoxLayout;
+
+ QLabel *label = new QLabel(QLatin1String("XXgypq lorem ipsum must be long, must be long. lorem ipsumMMMW"));
+ lay->addWidget(label);
+
+ page->setLayout(lay);
+
+ tw.addTab(page, QLatin1String("page1"));
+
+ tw.show();
+ QTest::qWaitForWindowShown(&tw);
+ tw.resize(tw.minimumSizeHint());
+
+ QSize minSize = label->minimumSizeHint();
+ QSize actSize = label->geometry().size();
+ QVERIFY(minSize.width() <= actSize.width());
+ QVERIFY(minSize.height() <= actSize.height());
+}
+
+void tst_QTabWidget::heightForWidth_data()
+{
+ QTest::addColumn<int>("tabPosition");
+ QTest::newRow("West") << int(QTabWidget::West);
+ QTest::newRow("North") << int(QTabWidget::North);
+ QTest::newRow("East") << int(QTabWidget::East);
+ QTest::newRow("South") << int(QTabWidget::South);
+}
+
+void tst_QTabWidget::heightForWidth()
+{
+ QFETCH(int, tabPosition);
+
+ QWidget *window = new QWidget;
+ QVBoxLayout *lay = new QVBoxLayout(window);
+ lay->setMargin(0);
+ lay->setSpacing(0);
+ QTabWidget *tabWid = new QTabWidget(window);
+ QWidget *w = new QWidget;
+ tabWid->addTab(w, QLatin1String("HFW page"));
+ tabWid->setTabPosition(QTabWidget::TabPosition(tabPosition));
+ QVBoxLayout *lay2 = new QVBoxLayout(w);
+ QLabel *label = new QLabel("Label with wordwrap turned on makes it trade height for width."
+ " Make it a really long text so that it spans on several lines"
+ " when the label is on its narrowest."
+ " I don't like to repeat myself."
+ " I don't like to repeat myself."
+ " I don't like to repeat myself."
+ " I don't like to repeat myself."
+ );
+ label->setWordWrap(true);
+ lay2->addWidget(label);
+ lay2->setMargin(0);
+
+ lay->addWidget(tabWid);
+ int h = window->heightForWidth(160);
+ window->resize(160, h);
+ window->show();
+
+ QTest::qWaitForWindowShown(window);
+ QVERIFY(label->height() >= label->heightForWidth(label->width()));
+
+ delete window;
+}
+
QTEST_MAIN(tst_QTabWidget)
#include "tst_qtabwidget.moc"
diff --git a/tests/auto/qtcpserver/test/test.pro b/tests/auto/qtcpserver/test/test.pro
index 123c79e..e91ba20 100644
--- a/tests/auto/qtcpserver/test/test.pro
+++ b/tests/auto/qtcpserver/test/test.pro
@@ -4,7 +4,7 @@ SOURCES += ../tst_qtcpserver.cpp
win32: {
wince*: {
LIBS += -lws2
- crashApp.sources = ../crashingServer/crashingServer.exe
+ crashApp.files = ../crashingServer/crashingServer.exe
crashApp.path = crashingServer
DEPLOYMENT += crashApp
} else {
@@ -13,7 +13,7 @@ wince*: {
}
symbian {
- crashApp.sources = $$QT_BUILD_TREE/examples/widgets/wiggly/$${BUILD_DIR}/crashingServer.exe
+ crashApp.files = $$QT_BUILD_TREE/examples/widgets/wiggly/$${BUILD_DIR}/crashingServer.exe
crashApp.path = .
DEPLOYMENT += crashApp
}
diff --git a/tests/auto/qtemporaryfile/qtemporaryfile.pro b/tests/auto/qtemporaryfile/qtemporaryfile.pro
index c93a2e5..543c143 100644
--- a/tests/auto/qtemporaryfile/qtemporaryfile.pro
+++ b/tests/auto/qtemporaryfile/qtemporaryfile.pro
@@ -4,7 +4,7 @@ QT = core
symbian {
- testData.sources = tst_qtemporaryfile.cpp
+ testData.files = tst_qtemporaryfile.cpp
testData.path = .
DEPLOYMENT += testData
}else {
diff --git a/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro
index aa1fbb5..e8fb9cb 100644
--- a/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro
+++ b/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro
@@ -5,7 +5,7 @@ SOURCES += tst_qtextboundaryfinder.cpp
!symbian:*:DEFINES += SRCDIR=\\\"$$PWD\\\"
wince*|symbian:{
- addFiles.sources = data
+ addFiles.files = data
addFiles.path = .
DEPLOYMENT += addFiles
}
diff --git a/tests/auto/qtextbrowser/qtextbrowser.pro b/tests/auto/qtextbrowser/qtextbrowser.pro
index 88061a9..773fb97 100644
--- a/tests/auto/qtextbrowser/qtextbrowser.pro
+++ b/tests/auto/qtextbrowser/qtextbrowser.pro
@@ -6,9 +6,9 @@ contains(QT_CONFIG, qt3support): QT += qt3support
wince*|symbian: {
- addFiles.sources = *.html
+ addFiles.files = *.html
addFiles.path = .
- addDir.sources = subdir/*
+ addDir.files = subdir/*
addDir.path = subdir
DEPLOYMENT += addFiles addDir
}
diff --git a/tests/auto/qtextcodec/test/test.pro b/tests/auto/qtextcodec/test/test.pro
index b85032a..2188d2f 100644
--- a/tests/auto/qtextcodec/test/test.pro
+++ b/tests/auto/qtextcodec/test/test.pro
@@ -17,7 +17,7 @@ win32: {
}
wince*|symbian {
- addFiles.sources = ../*.txt
+ addFiles.files = ../*.txt
addFiles.path = .
DEPLOYMENT += addFiles
wince*|qt_not_deployed {
diff --git a/tests/auto/qtextedit/qtextedit.pro b/tests/auto/qtextedit/qtextedit.pro
index 43813da..e7d6c03 100644
--- a/tests/auto/qtextedit/qtextedit.pro
+++ b/tests/auto/qtextedit/qtextedit.pro
@@ -6,7 +6,7 @@ HEADERS +=
SOURCES += tst_qtextedit.cpp
wince*|symbian: {
- addImages.sources = fullWidthSelection/*
+ addImages.files = fullWidthSelection/*
addImages.path = fullWidthSelection
DEPLOYMENT += addImages
}
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index 659ba1a..dcc43d0 100644
--- a/tests/auto/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp
@@ -85,6 +85,7 @@ private slots:
void cursorToXForSetColumns();
void defaultWordSeparators_data();
void defaultWordSeparators();
+ void cursorMovementFromInvalidPositions();
void cursorMovementInsideSpaces();
void charWordStopOnLineSeparator();
void xToCursorAtEndOfLine();
@@ -544,6 +545,10 @@ void tst_QTextLayout::defaultWordSeparators_data()
QTest::newRow("lineseparator")
<< QString::fromLatin1("abcd") + QString(QChar::LineSeparator) + QString::fromLatin1("efgh")
<< 0 << 5;
+
+ QTest::newRow("empty")
+ << QString()
+ << 0 << 0;
}
void tst_QTextLayout::defaultWordSeparators()
@@ -557,12 +562,31 @@ void tst_QTextLayout::defaultWordSeparators()
QCOMPARE(layout.previousCursorPosition(endPos, QTextLayout::SkipWords), startPos);
}
+void tst_QTextLayout::cursorMovementFromInvalidPositions()
+{
+ int badpos = 10000;
+
+ QTextLayout layout("ABC", testFont);
+
+ QCOMPARE(layout.previousCursorPosition(-badpos, QTextLayout::SkipCharacters), -badpos);
+ QCOMPARE(layout.nextCursorPosition(-badpos, QTextLayout::SkipCharacters), -badpos);
+
+ QCOMPARE(layout.previousCursorPosition(badpos, QTextLayout::SkipCharacters), badpos);
+ QCOMPARE(layout.nextCursorPosition(badpos, QTextLayout::SkipCharacters), badpos);
+}
+
void tst_QTextLayout::cursorMovementInsideSpaces()
{
QTextLayout layout("ABC DEF", testFont);
QCOMPARE(layout.previousCursorPosition(6, QTextLayout::SkipWords), 0);
QCOMPARE(layout.nextCursorPosition(6, QTextLayout::SkipWords), 15);
+
+
+ QTextLayout layout2("ABC\t\t\t\t\t\t\t\t\t\t\t\tDEF", testFont);
+
+ QCOMPARE(layout2.previousCursorPosition(6, QTextLayout::SkipWords), 0);
+ QCOMPARE(layout2.nextCursorPosition(6, QTextLayout::SkipWords), 15);
}
void tst_QTextLayout::charWordStopOnLineSeparator()
diff --git a/tests/auto/qtextlist/tst_qtextlist.cpp b/tests/auto/qtextlist/tst_qtextlist.cpp
index 3e92836..8ad0898 100644
--- a/tests/auto/qtextlist/tst_qtextlist.cpp
+++ b/tests/auto/qtextlist/tst_qtextlist.cpp
@@ -67,6 +67,9 @@ private slots:
void item();
void autoNumbering();
void autoNumberingRTL();
+ void autoNumberingPrefixAndSuffix();
+ void autoNumberingPrefixAndSuffixRTL();
+ void autoNumberingPrefixAndSuffixHtmlExportImport();
void romanNumbering();
void romanNumberingLimit();
void formatChange();
@@ -128,6 +131,76 @@ void tst_QTextList::autoNumbering()
QVERIFY(cursor.currentList()->itemText(cursor.block()) == "ab.");
}
+void tst_QTextList::autoNumberingPrefixAndSuffix()
+{
+ QTextListFormat fmt;
+ fmt.setStyle(QTextListFormat::ListLowerAlpha);
+ fmt.setNumberPrefix("-");
+ fmt.setNumberSuffix(")");
+ QTextList *list = cursor.createList(fmt);
+ QVERIFY(list);
+
+ for (int i = 0; i < 27; ++i)
+ cursor.insertBlock();
+
+ QVERIFY(list->count() == 28);
+
+ QVERIFY(cursor.currentList());
+ QVERIFY(cursor.currentList()->itemNumber(cursor.block()) == 27);
+ QVERIFY(cursor.currentList()->itemText(cursor.block()) == "-ab)");
+}
+
+void tst_QTextList::autoNumberingPrefixAndSuffixRTL()
+{
+ QTextBlockFormat bfmt;
+ bfmt.setLayoutDirection(Qt::RightToLeft);
+ cursor.setBlockFormat(bfmt);
+
+ QTextListFormat fmt;
+ fmt.setStyle(QTextListFormat::ListUpperAlpha);
+ fmt.setNumberPrefix("-");
+ fmt.setNumberSuffix("*");
+ QTextList *list = cursor.createList(fmt);
+ QVERIFY(list);
+
+ cursor.insertBlock();
+
+ QVERIFY(list->count() == 2);
+
+ QVERIFY(cursor.currentList()->itemText(cursor.block()) == "*B-");
+}
+
+void tst_QTextList::autoNumberingPrefixAndSuffixHtmlExportImport()
+{
+ QTextListFormat fmt;
+ fmt.setStyle(QTextListFormat::ListLowerAlpha);
+ fmt.setNumberPrefix("\"");
+ fmt.setNumberSuffix("#");
+ fmt.setIndent(10);
+ // FIXME: Would like to test "'" but there's a problem in the css parser (Scanner::preprocess
+ // is called before the values are being parsed), so the quoting does not work.
+ QTextList *list = cursor.createList(fmt);
+ QVERIFY(list);
+
+ for (int i = 0; i < 27; ++i)
+ cursor.insertBlock();
+
+ QVERIFY(list->count() == 28);
+
+ QString htmlExport = doc->toHtml();
+ QTextDocument importDoc;
+ importDoc.setHtml(htmlExport);
+
+ QTextCursor importCursor(&importDoc);
+ for (int i = 0; i < 27; ++i)
+ importCursor.movePosition(QTextCursor::NextBlock);
+
+ QVERIFY(importCursor.currentList());
+ QVERIFY(importCursor.currentList()->itemNumber(importCursor.block()) == 27);
+ QVERIFY(importCursor.currentList()->itemText(importCursor.block()) == "\"ab#");
+ QVERIFY(importCursor.currentList()->format().indent() == 10);
+}
+
void tst_QTextList::autoNumberingRTL()
{
QTextBlockFormat bfmt;
diff --git a/tests/auto/qtextstream/test/test.pro b/tests/auto/qtextstream/test/test.pro
index 20823de..8805fb9 100644
--- a/tests/auto/qtextstream/test/test.pro
+++ b/tests/auto/qtextstream/test/test.pro
@@ -18,9 +18,9 @@ QT = core network
wince*|symbian: {
- addFiles.sources = ../rfc3261.txt ../shift-jis.txt ../task113817.txt ../qtextstream.qrc ../tst_qtextstream.cpp
+ addFiles.files = ../rfc3261.txt ../shift-jis.txt ../task113817.txt ../qtextstream.qrc ../tst_qtextstream.cpp
addFiles.path = .
- res.sources = ../resources
+ res.files = ../resources
res.path = .
DEPLOYMENT += addFiles
}
@@ -30,7 +30,7 @@ wince*: {
}else:symbian {
# Symbian can't define SRCDIR meaningfully here
qt_not_deployed {
- codecs_plugins.sources = qcncodecs.dll qjpcodecs.dll qtwcodecs.dll qkrcodecs.dll
+ codecs_plugins.files = qcncodecs.dll qjpcodecs.dll qtwcodecs.dll qkrcodecs.dll
codecs_plugins.path = $$QT_PLUGINS_BASE_DIR/codecs
DEPLOYMENT += codecs_plugins
}
diff --git a/tests/auto/qthreadpool/tst_qthreadpool.cpp b/tests/auto/qthreadpool/tst_qthreadpool.cpp
index 7c8b410..cd6070f 100644
--- a/tests/auto/qthreadpool/tst_qthreadpool.cpp
+++ b/tests/auto/qthreadpool/tst_qthreadpool.cpp
@@ -89,6 +89,7 @@ private slots:
void tryStartPeakThreadCount();
void tryStartCount();
void waitForDone();
+ void waitForDoneTimeout();
void destroyingWaitsForTasksToFinish();
void stressTest();
};
@@ -774,6 +775,32 @@ void tst_QThreadPool::waitForDone()
}
}
+void tst_QThreadPool::waitForDoneTimeout()
+{
+ class BlockedTask : public QRunnable
+ {
+ public:
+ QMutex mutex;
+ BlockedTask() { setAutoDelete(false); }
+
+ void run()
+ {
+ mutex.lock();
+ mutex.unlock();
+ QTest::qSleep(50);
+ }
+ };
+
+ QThreadPool threadPool;
+
+ BlockedTask *task = new BlockedTask;
+ task->mutex.lock();
+ threadPool.start(task);
+ QVERIFY(!threadPool.waitForDone(100));
+ task->mutex.unlock();
+ QVERIFY(threadPool.waitForDone(400));
+}
+
void tst_QThreadPool::destroyingWaitsForTasksToFinish()
{
QTime total, pass;
diff --git a/tests/auto/qtipc/qsharedmemory/test/test.pro b/tests/auto/qtipc/qsharedmemory/test/test.pro
index 68a5362..50c2669 100644
--- a/tests/auto/qtipc/qsharedmemory/test/test.pro
+++ b/tests/auto/qtipc/qsharedmemory/test/test.pro
@@ -20,16 +20,16 @@ TARGET = ../tst_qsharedmemory
wince*:{
requires(contains(QT_CONFIG,script))
QT += gui script
-addFiles.sources = $$OUT_PWD/../../lackey/lackey.exe ../../lackey/scripts
+addFiles.files = $$OUT_PWD/../../lackey/lackey.exe ../../lackey/scripts
addFiles.path = .
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\".\\\"
}else:symbian{
requires(contains(QT_CONFIG,script))
QT += gui script
-addFiles.sources = ../../lackey/scripts
+addFiles.files = ../../lackey/scripts
addFiles.path = /data/qsharedmemorytemp/lackey
-addBin.sources = lackey.exe
+addBin.files = lackey.exe
addBin.path = /sys/bin
DEPLOYMENT += addFiles addBin
} else {
diff --git a/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp
index 1f65ae7..dc071ab 100644
--- a/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp
+++ b/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp
@@ -225,11 +225,17 @@ void tst_QSharedMemory::key_data()
{
QTest::addColumn<QString>("constructorKey");
QTest::addColumn<QString>("setKey");
-
- QTest::newRow("null, null") << QString() << QString();
- QTest::newRow("null, one") << QString() << QString("one");
- QTest::newRow("one, two") << QString("one") << QString("two");
- QTest::newRow("invalid") << QString("o/e") << QString("t/o");
+ QTest::addColumn<QString>("setNativeKey");
+
+ QTest::newRow("null, null, null") << QString() << QString() << QString();
+ QTest::newRow("one, null, null") << QString("one") << QString() << QString();
+ QTest::newRow("null, one, null") << QString() << QString("one") << QString();
+ QTest::newRow("null, null, one") << QString() << QString() << QString("one");
+ QTest::newRow("one, two, null") << QString("one") << QString("two") << QString();
+ QTest::newRow("one, null, two") << QString("one") << QString() << QString("two");
+ QTest::newRow("null, one, two") << QString() << QString("one") << QString("two");
+ QTest::newRow("one, two, three") << QString("one") << QString("two") << QString("three");
+ QTest::newRow("invalid") << QString("o/e") << QString("t/o") << QString("|x");
}
/*!
@@ -239,11 +245,17 @@ void tst_QSharedMemory::key()
{
QFETCH(QString, constructorKey);
QFETCH(QString, setKey);
+ QFETCH(QString, setNativeKey);
QSharedMemory sm(constructorKey);
QCOMPARE(sm.key(), constructorKey);
+ QCOMPARE(sm.nativeKey().isEmpty(), constructorKey.isEmpty());
sm.setKey(setKey);
QCOMPARE(sm.key(), setKey);
+ QCOMPARE(sm.nativeKey().isEmpty(), setKey.isEmpty());
+ sm.setNativeKey(setNativeKey);
+ QVERIFY(sm.key().isNull());
+ QCOMPARE(sm.nativeKey(), setNativeKey);
QCOMPARE(sm.isAttached(), false);
QCOMPARE(sm.error(), QSharedMemory::NoError);
@@ -262,7 +274,7 @@ void tst_QSharedMemory::create_data()
QTest::addColumn<QSharedMemory::SharedMemoryError>("error");
QTest::newRow("null key") << QString() << 1024
- << false << QSharedMemory::LockError;
+ << false << QSharedMemory::KeyError;
QTest::newRow("-1 size") << QString("negsize") << -1
<< false << QSharedMemory::InvalidSize;
QTest::newRow("nor size") << QString("norsize") << 1024
@@ -302,7 +314,7 @@ void tst_QSharedMemory::attach_data()
QTest::addColumn<bool>("exists");
QTest::addColumn<QSharedMemory::SharedMemoryError>("error");
- QTest::newRow("null key") << QString() << false << QSharedMemory::LockError;
+ QTest::newRow("null key") << QString() << false << QSharedMemory::KeyError;
QTest::newRow("doesn't exists") << QString("doesntexists") << false << QSharedMemory::NotFound;
QTest::newRow("already exists") << QString(EXISTING_SHARE) << true << QSharedMemory::NoError;
}
diff --git a/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro b/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro
index 8a5f8b2..bb319ee 100644
--- a/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro
+++ b/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro
@@ -17,7 +17,7 @@ requires(contains(QT_CONFIG,script))
# this test calls lackey, which then again depends on QtScript.
# let's add it here so that it gets deployed easily
QT += script
-lackey.sources = $$OUT_PWD/../lackey/lackey.exe ../lackey/scripts
+lackey.files = $$OUT_PWD/../lackey/lackey.exe ../lackey/scripts
lackey.path = .
DEPLOYMENT += lackey
}
@@ -28,7 +28,7 @@ requires(contains(QT_CONFIG,script))
# let's add it here so that it gets deployed easily
QT += script
-lackey.sources = ../lackey/lackey.exe
+lackey.files = ../lackey/lackey.exe
lackey.path = /sys/bin
DEPLOYMENT += lackey
}
diff --git a/tests/auto/qtranslator/qtranslator.pro b/tests/auto/qtranslator/qtranslator.pro
index 5b742f7..0001d1c 100644
--- a/tests/auto/qtranslator/qtranslator.pro
+++ b/tests/auto/qtranslator/qtranslator.pro
@@ -3,7 +3,7 @@ SOURCES += tst_qtranslator.cpp
RESOURCES += qtranslator.qrc
wince*|symbian: {
- addFiles.sources = hellotr_la.qm msgfmt_from_po.qm
+ addFiles.files = hellotr_la.qm msgfmt_from_po.qm
addFiles.path = .
DEPLOYMENT += addFiles
}
diff --git a/tests/auto/qudpsocket/test/test.pro b/tests/auto/qudpsocket/test/test.pro
index 9c0d009..7e5ffe4 100644
--- a/tests/auto/qudpsocket/test/test.pro
+++ b/tests/auto/qudpsocket/test/test.pro
@@ -15,7 +15,7 @@ win32 {
}
wince*|symbian: {
- addApp.sources = ../clientserver/clientserver.exe
+ addApp.files = ../clientserver/clientserver.exe
addApp.path = clientserver
DEPLOYMENT += addApp
}
diff --git a/tests/auto/qudpsocket/tst_qudpsocket.cpp b/tests/auto/qudpsocket/tst_qudpsocket.cpp
index abed55c..32fab6b 100644
--- a/tests/auto/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/qudpsocket/tst_qudpsocket.cpp
@@ -50,11 +50,13 @@
#include <qhostinfo.h>
#include <qmap.h>
#include <QNetworkProxy>
+#include <QNetworkInterface>
#include <qstringlist.h>
#include "../network-settings.h"
Q_DECLARE_METATYPE(QHostAddress)
+Q_DECLARE_METATYPE(QNetworkInterface)
//TESTED_CLASS=
//TESTED_FILES=
@@ -94,6 +96,18 @@ private slots:
void outOfProcessConnectedClientServerTest();
void outOfProcessUnconnectedClientServerTest();
void zeroLengthDatagram();
+ void multicastTtlOption_data();
+ void multicastTtlOption();
+ void multicastLoopbackOption_data();
+ void multicastLoopbackOption();
+ void multicastJoinBeforeBind_data();
+ void multicastJoinBeforeBind();
+ void multicastLeaveAfterClose_data();
+ void multicastLeaveAfterClose();
+ void setMulticastInterface_data();
+ void setMulticastInterface();
+ void multicast_data();
+ void multicast();
protected slots:
void empty_readyReadSlot();
@@ -844,5 +858,242 @@ void tst_QUdpSocket::zeroLengthDatagram()
QCOMPARE(receiver.readDatagram(&buf, 1), qint64(0));
}
+void tst_QUdpSocket::multicastTtlOption_data()
+{
+ QTest::addColumn<QHostAddress>("bindAddress");
+ QTest::addColumn<int>("ttl");
+ QTest::addColumn<int>("expected");
+
+ QList<QHostAddress> addresses;
+ addresses += QHostAddress(QHostAddress::Any);
+ addresses += QHostAddress(QHostAddress::AnyIPv6);
+
+ foreach (const QHostAddress &address, addresses) {
+ QTest::newRow(QString("%1 0").arg(address.toString()).toAscii()) << address << 0 << 0;
+ QTest::newRow(QString("%1 1").arg(address.toString()).toAscii()) << address << 1 << 1;
+ QTest::newRow(QString("%1 2").arg(address.toString()).toAscii()) << address << 2 << 2;
+ QTest::newRow(QString("%1 128").arg(address.toString()).toAscii()) << address << 128 << 128;
+ QTest::newRow(QString("%1 255").arg(address.toString()).toAscii()) << address << 255 << 255;
+ QTest::newRow(QString("%1 1024").arg(address.toString()).toAscii()) << address << 1024 << 1;
+ }
+}
+
+void tst_QUdpSocket::multicastTtlOption()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ QFETCH(QHostAddress, bindAddress);
+ QFETCH(int, ttl);
+ QFETCH(int, expected);
+ if (setProxy) {
+ // UDP multicast does not work with proxies
+ expected = 0;
+ }
+
+ QUdpSocket udpSocket;
+ // bind, but ignore the result, we are only interested in initializing the socket
+ (void) udpSocket.bind(bindAddress, 0);
+ udpSocket.setSocketOption(QUdpSocket::MulticastTtlOption, ttl);
+ QCOMPARE(udpSocket.socketOption(QUdpSocket::MulticastTtlOption).toInt(), expected);
+}
+
+void tst_QUdpSocket::multicastLoopbackOption_data()
+{
+ QTest::addColumn<QHostAddress>("bindAddress");
+ QTest::addColumn<int>("loopback");
+ QTest::addColumn<int>("expected");
+
+ QList<QHostAddress> addresses;
+ addresses += QHostAddress(QHostAddress::Any);
+ addresses += QHostAddress(QHostAddress::AnyIPv6);
+
+ foreach (const QHostAddress &address, addresses) {
+ QTest::newRow(QString("%1 0").arg(address.toString()).toAscii()) << address << 0 << 0;
+ QTest::newRow(QString("%1 1").arg(address.toString()).toAscii()) << address << 1 << 1;
+ QTest::newRow(QString("%1 2").arg(address.toString()).toAscii()) << address << 2 << 1;
+ QTest::newRow(QString("%1 0 again").arg(address.toString()).toAscii()) << address << 0 << 0;
+ QTest::newRow(QString("%1 2 again").arg(address.toString()).toAscii()) << address << 2 << 1;
+ QTest::newRow(QString("%1 0 last time").arg(address.toString()).toAscii()) << address << 0 << 0;
+ QTest::newRow(QString("%1 1 again").arg(address.toString()).toAscii()) << address << 1 << 1;
+ }
+}
+
+void tst_QUdpSocket::multicastLoopbackOption()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ QFETCH(QHostAddress, bindAddress);
+ QFETCH(int, loopback);
+ QFETCH(int, expected);
+ if (setProxy) {
+ // UDP multicast does not work with proxies
+ expected = 0;
+ }
+
+ QUdpSocket udpSocket;
+ // bind, but ignore the result, we are only interested in initializing the socket
+ (void) udpSocket.bind(bindAddress, 0);
+ udpSocket.setSocketOption(QUdpSocket::MulticastLoopbackOption, loopback);
+ QCOMPARE(udpSocket.socketOption(QUdpSocket::MulticastLoopbackOption).toInt(), expected);
+}
+
+void tst_QUdpSocket::multicastJoinBeforeBind_data()
+{
+ QTest::addColumn<QHostAddress>("groupAddress");
+ QTest::newRow("valid ipv4 group address") << QHostAddress("239.255.118.62");
+ QTest::newRow("invalid ipv4 group address") << QHostAddress(QHostAddress::Broadcast);
+ QTest::newRow("valid ipv6 group address") << QHostAddress("FF01::114");
+ QTest::newRow("invalid ipv6 group address") << QHostAddress(QHostAddress::AnyIPv6);
+}
+
+void tst_QUdpSocket::multicastJoinBeforeBind()
+{
+ QFETCH(QHostAddress, groupAddress);
+
+ QUdpSocket udpSocket;
+ // cannot join group before binding
+ QTest::ignoreMessage(QtWarningMsg, "QUdpSocket::joinMulticastGroup() called on a QUdpSocket when not in QUdpSocket::BoundState");
+ QVERIFY(!udpSocket.joinMulticastGroup(groupAddress));
+}
+
+void tst_QUdpSocket::multicastLeaveAfterClose_data()
+{
+ QTest::addColumn<QHostAddress>("groupAddress");
+ QTest::newRow("valid ipv4 group address") << QHostAddress("239.255.118.62");
+ QTest::newRow("valid ipv6 group address") << QHostAddress("FF01::114");
+}
+
+void tst_QUdpSocket::multicastLeaveAfterClose()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ QFETCH(QHostAddress, groupAddress);
+ if (setProxy) {
+ QSKIP("UDP Multicast does not work with proxies", SkipAll);
+ }
+
+ QUdpSocket udpSocket;
+ QVERIFY2(udpSocket.bind(groupAddress, 0),
+ qPrintable(udpSocket.errorString()));
+ QVERIFY2(udpSocket.joinMulticastGroup(groupAddress),
+ qPrintable(udpSocket.errorString()));
+ udpSocket.close();
+ QTest::ignoreMessage(QtWarningMsg, "QUdpSocket::leaveMulticastGroup() called on a QUdpSocket when not in QUdpSocket::BoundState");
+ QVERIFY(!udpSocket.leaveMulticastGroup(groupAddress));
+}
+
+void tst_QUdpSocket::setMulticastInterface_data()
+{
+ QTest::addColumn<QNetworkInterface>("iface");
+ QTest::addColumn<QHostAddress>("address");
+ QList<QNetworkInterface> interfaces = QNetworkInterface::allInterfaces();
+ foreach (const QNetworkInterface &iface, interfaces) {
+ foreach (const QNetworkAddressEntry &entry, iface.addressEntries()) {
+ QTest::newRow(QString("%1:%2").arg(iface.name()).arg(entry.ip().toString()).toAscii())
+ << iface
+ << entry.ip();
+ }
+ }
+}
+
+void tst_QUdpSocket::setMulticastInterface()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ QFETCH(QNetworkInterface, iface);
+ QFETCH(QHostAddress, address);
+
+ QUdpSocket udpSocket;
+ // bind initializes the socket
+ bool bound = udpSocket.bind((address.protocol() == QAbstractSocket::IPv6Protocol
+ ? QHostAddress(QHostAddress::AnyIPv6)
+ : QHostAddress(QHostAddress::Any)),
+ 0);
+ if (!bound)
+ QTest::ignoreMessage(QtWarningMsg, "QUdpSocket::setMulticastInterface() called on a QUdpSocket when not in QUdpSocket::BoundState");
+ udpSocket.setMulticastInterface(iface);
+ if (!bound)
+ QTest::ignoreMessage(QtWarningMsg, "QUdpSocket::multicastInterface() called on a QUdpSocket when not in QUdpSocket::BoundState");
+ QNetworkInterface iface2 = udpSocket.multicastInterface();
+ if (!setProxy) {
+ QVERIFY(iface2.isValid());
+ QCOMPARE(iface.name(), iface2.name());
+ } else {
+ QVERIFY(!iface2.isValid());
+ }
+}
+
+void tst_QUdpSocket::multicast_data()
+{
+ QHostAddress anyAddress = QHostAddress(QHostAddress::Any);
+ QHostAddress groupAddress = QHostAddress("239.255.118.62");
+ QHostAddress any6Address = QHostAddress(QHostAddress::AnyIPv6);
+ QHostAddress group6Address = QHostAddress("FF01::114");
+
+ QTest::addColumn<QHostAddress>("bindAddress");
+ QTest::addColumn<bool>("bindResult");
+ QTest::addColumn<QHostAddress>("groupAddress");
+ QTest::addColumn<bool>("joinResult");
+ QTest::newRow("valid bind, group ipv4 address") << anyAddress << true << groupAddress << true;
+ QTest::newRow("valid bind, invalid group ipv4 address") << anyAddress << true << anyAddress << false;
+ QTest::newRow("same bind, group ipv4 address") << groupAddress << true << groupAddress << true;
+ QTest::newRow("valid bind, group ipv6 address") << any6Address << true << group6Address << true;
+ QTest::newRow("valid bind, invalid group ipv6 address") << any6Address << true << any6Address << false;
+ QTest::newRow("same bind, group ipv6 address") << group6Address << true << group6Address << true;
+}
+
+void tst_QUdpSocket::multicast()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ QFETCH(QHostAddress, bindAddress);
+ QFETCH(bool, bindResult);
+ QFETCH(QHostAddress, groupAddress);
+ QFETCH(bool, joinResult);
+ if (setProxy) {
+ // UDP multicast does not work with proxies
+ if ((bindAddress.protocol() == QAbstractSocket::IPv4Protocol && (bindAddress.toIPv4Address() & 0xffff0000) == 0xefff0000)
+ || bindAddress.protocol() == QAbstractSocket::IPv6Protocol) {
+ // proxy cannot bind to IPv6 or multicast addresses
+ bindResult = false;
+ }
+ joinResult = false;
+ }
+
+ QUdpSocket receiver;
+
+ // bind first, then verify that we can join the multicast group
+ QVERIFY2(receiver.bind(bindAddress, 0) == bindResult,
+ qPrintable(receiver.errorString()));
+ if (!bindResult)
+ return;
+
+ QVERIFY2(receiver.joinMulticastGroup(groupAddress) == joinResult,
+ qPrintable(receiver.errorString()));
+ if (!joinResult)
+ return;
+
+ QList<QByteArray> datagrams = QList<QByteArray>()
+ << QByteArray("0123")
+ << QByteArray("4567")
+ << QByteArray("89ab")
+ << QByteArray("cdef");
+
+ QUdpSocket sender;
+ foreach (const QByteArray &datagram, datagrams) {
+ QCOMPARE(int(sender.writeDatagram(datagram, groupAddress, receiver.localPort())),
+ int(datagram.size()));
+ }
+
+ QVERIFY2(receiver.waitForReadyRead(),
+ qPrintable(receiver.errorString()));
+ QVERIFY(receiver.hasPendingDatagrams());
+ QList<QByteArray> receivedDatagrams;
+ while (receiver.hasPendingDatagrams()) {
+ QByteArray datagram;
+ datagram.resize(receiver.pendingDatagramSize());
+ receiver.readDatagram(datagram.data(), datagram.size(), 0, 0);
+ receivedDatagrams << datagram;
+ }
+ QCOMPARE(receivedDatagrams, datagrams);
+
+ QVERIFY2(receiver.leaveMulticastGroup(groupAddress), qPrintable(receiver.errorString()));
+}
+
QTEST_MAIN(tst_QUdpSocket)
#include "tst_qudpsocket.moc"
diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp
index 63f9721..eff4658 100644
--- a/tests/auto/qurl/tst_qurl.cpp
+++ b/tests/auto/qurl/tst_qurl.cpp
@@ -161,6 +161,8 @@ private slots:
void idna_testsuite();
void nameprep_testsuite_data();
void nameprep_testsuite();
+ void nameprep_highcodes_data();
+ void nameprep_highcodes();
void ace_testsuite_data();
void ace_testsuite();
void std3violations_data();
@@ -315,6 +317,7 @@ void tst_QUrl::constructing()
QUrl buildUNC;
+ buildUNC.setScheme(QString::fromLatin1("file"));
buildUNC.setHost(QString::fromLatin1("somehost"));
buildUNC.setPath(QString::fromLatin1("somepath"));
QCOMPARE(buildUNC.toLocalFile(), QString::fromLatin1("//somehost/somepath"));
@@ -1758,7 +1761,15 @@ void tst_QUrl::toLocalFile_data()
QTest::newRow("data7") << QString::fromLatin1("file://somehost/") << QString::fromLatin1("//somehost/");
QTest::newRow("data8") << QString::fromLatin1("file://somehost") << QString::fromLatin1("//somehost");
QTest::newRow("data9") << QString::fromLatin1("file:////somehost/somedir/somefile") << QString::fromLatin1("//somehost/somedir/somefile");
+ QTest::newRow("data10") << QString::fromLatin1("FILE:/a.txt") << QString::fromLatin1("/a.txt");
+ // and some that result in empty (i.e., not local)
+ QTest::newRow("xdata0") << QString::fromLatin1("/a.txt") << QString();
+ QTest::newRow("xdata1") << QString::fromLatin1("//a.txt") << QString();
+ QTest::newRow("xdata2") << QString::fromLatin1("///a.txt") << QString();
+ QTest::newRow("xdata3") << QString::fromLatin1("foo:/a.txt") << QString();
+ QTest::newRow("xdata4") << QString::fromLatin1("foo://a.txt") << QString();
+ QTest::newRow("xdata5") << QString::fromLatin1("foo:///a.txt") << QString();
}
void tst_QUrl::toLocalFile()
@@ -2918,7 +2929,6 @@ void tst_QUrl::nameprep_testsuite_data()
<< QString() << 0 << 0;
QTest::newRow("Case folding 8bit U+00DF (german sharp s)")
-// << QString::fromUtf8("\xC3\xDF") ### typo in the original testsuite
<< QString::fromUtf8("\xC3\x9F")
<< QString("ss")
<< QString() << 0 << 0;
@@ -2949,7 +2959,8 @@ void tst_QUrl::nameprep_testsuite_data()
<< QString() << 0 << 0;
QTest::newRow("Self-reverting case folding U+01F0 and normalization")
- << QString::fromUtf8("\xC7\xF0")
+// << QString::fromUtf8("\xC7\xF0") ### typo in the original testsuite
+ << QString::fromUtf8("\xC7\xB0")
<< QString::fromUtf8("\xC7\xB0")
<< QString() << 0 << 0;
@@ -3124,13 +3135,13 @@ void tst_QUrl::nameprep_testsuite_data()
<< QString("Nameprep") << STRINGPREP_NO_UNASSIGNED << STRINGPREP_CONTAINS_UNASSIGNED;
QTest::newRow("Larger test (shrinking)")
- << QString::fromUtf8("X\xC2\xAD\xC3\xDF\xC4\xB0\xE2\x84\xA1\x6a\xcc\x8c\xc2\xa0\xc2"
+ << QString::fromUtf8("X\xC2\xAD\xC3\x9F\xC4\xB0\xE2\x84\xA1\x6a\xcc\x8c\xc2\xa0\xc2"
"\xaa\xce\xb0\xe2\x80\x80")
<< QString::fromUtf8("xssi\xcc\x87""tel\xc7\xb0 a\xce\xb0 ")
<< QString("Nameprep") << 0 << 0;
QTest::newRow("Larger test (expanding)")
- << QString::fromUtf8("X\xC3\xDF\xe3\x8c\x96\xC4\xB0\xE2\x84\xA1\xE2\x92\x9F\xE3\x8c\x80")
+ << QString::fromUtf8("X\xC3\x9F\xe3\x8c\x96\xC4\xB0\xE2\x84\xA1\xE2\x92\x9F\xE3\x8c\x80")
<< QString::fromUtf8("xss\xe3\x82\xad\xe3\x83\xad\xe3\x83\xa1\xe3\x83\xbc\xe3\x83\x88"
"\xe3\x83\xab""i\xcc\x87""tel\x28""d\x29\xe3\x82\xa2\xe3\x83\x91"
"\xe3\x83\xbc\xe3\x83\x88")
@@ -3151,20 +3162,58 @@ void tst_QUrl::nameprep_testsuite()
QFETCH(QString, out);
QFETCH(QString, profile);
- QEXPECT_FAIL("Case folding U+2121 U+33C6 U+1D7BB",
- ">0xffff unicode points are not supported", Continue);
- QEXPECT_FAIL("Self-reverting case folding U+01F0 and normalization",
- "Investigate further", Continue);
QEXPECT_FAIL("Left-to-right mark U+200E",
"Investigate further", Continue);
QEXPECT_FAIL("Deprecated U+202A",
"Investigate further", Continue);
QEXPECT_FAIL("Language tagging character U+E0001",
"Investigate further", Continue);
- QEXPECT_FAIL("Larger test (shrinking)",
- "Investigate further", Continue);
- QEXPECT_FAIL("Larger test (expanding)",
- "Investigate further", Continue);
+ qt_nameprep(&in, 0);
+ QCOMPARE(in, out);
+#endif
+}
+
+void tst_QUrl::nameprep_highcodes_data()
+{
+ QTest::addColumn<QString>("in");
+ QTest::addColumn<QString>("out");
+ QTest::addColumn<QString>("profile");
+ QTest::addColumn<int>("flags");
+ QTest::addColumn<int>("rc");
+
+ {
+ QChar st[] = { '-', 0xd801, 0xdc1d, 'a' };
+ QChar se[] = { '-', 0xd801, 0xdc45, 'a' };
+ QTest::newRow("highcodes (U+1041D)")
+ << QString(st, sizeof(st)/sizeof(st[0]))
+ << QString(se, sizeof(se)/sizeof(se[0]))
+ << QString() << 0 << 0;
+ }
+ {
+ QChar st[] = { 0x011C, 0xd835, 0xdf6e, 0x0110 };
+ QChar se[] = { 0x011D, 0x03C9, 0x0111 };
+ QTest::newRow("highcodes (U+1D76E)")
+ << QString(st, sizeof(st)/sizeof(st[0]))
+ << QString(se, sizeof(se)/sizeof(se[0]))
+ << QString() << 0 << 0;
+ }
+ {
+ QChar st[] = { 'D', 0xdb40, 0xdc20, 'o', 0xd834, 0xdd7a, '\'', 0x2060, 'h' };
+ QChar se[] = { 'd', 'o', '\'', 'h' };
+ QTest::newRow("highcodes (D, U+E0020, o, U+1D17A, ', U+2060, h)")
+ << QString(st, sizeof(st)/sizeof(st[0]))
+ << QString(se, sizeof(se)/sizeof(se[0]))
+ << QString() << 0 << 0;
+ }
+}
+
+void tst_QUrl::nameprep_highcodes()
+{
+#ifdef QT_BUILD_INTERNAL
+ QFETCH(QString, in);
+ QFETCH(QString, out);
+ QFETCH(QString, profile);
+
qt_nameprep(&in, 0);
QCOMPARE(in, out);
#endif
diff --git a/tests/auto/quuid/test/test.pro b/tests/auto/quuid/test/test.pro
index 123aa50..06ae3bd 100644
--- a/tests/auto/quuid/test/test.pro
+++ b/tests/auto/quuid/test/test.pro
@@ -15,14 +15,14 @@ CONFIG(debug_and_release_target) {
}
wince* {
- addFile_processUniqueness.sources = $$OUT_PWD/../testProcessUniqueness/testProcessUniqueness.exe
+ addFile_processUniqueness.files = $$OUT_PWD/../testProcessUniqueness/testProcessUniqueness.exe
addFile_processUniqueness.path = testProcessUniqueness
DEPLOYMENT += addFile_processUniqueness
}
symbian {
- binDep.sources = testProcessUniqueness.exe
+ binDep.files = testProcessUniqueness.exe
binDep.path = \\sys\\bin
DEPLOYMENT += binDep
diff --git a/tests/auto/qvector/tst_qvector.cpp b/tests/auto/qvector/tst_qvector.cpp
index 2bc8d15..a04ce60 100644
--- a/tests/auto/qvector/tst_qvector.cpp
+++ b/tests/auto/qvector/tst_qvector.cpp
@@ -88,6 +88,7 @@ private slots:
void outOfMemory();
void QTBUG6416_reserve();
+ void initializeList();
};
void tst_QVector::constructors() const
@@ -834,5 +835,19 @@ void tst_QVector::QTBUG6416_reserve()
QCOMPARE(fooCtor, fooDtor);
}
+void tst_QVector::initializeList()
+{
+#ifdef Q_COMPILER_INITIALIZER_LISTS
+ QVector<int> v1{2,3,4};
+ QCOMPARE(v1, QVector<int>() << 2 << 3 << 4);
+ QCOMPARE(v1, (QVector<int>{2,3,4}));
+
+ QVector<QVector<int>> v2{ v1, {1}, QVector<int>(), {2,3,4} };
+ QVector<QVector<int>> v3;
+ v3 << v1 << (QVector<int>() << 1) << QVector<int>() << v1;
+ QCOMPARE(v3, v2);
+#endif
+}
+
QTEST_APPLESS_MAIN(tst_QVector)
#include "tst_qvector.moc"
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 2f221d2..a2b8d5b 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -466,23 +466,15 @@ void tst_QWidget::getSetCheck()
QCOMPARE(obj1.minimumWidth(), 0); // A widgets width can never be less than 0
obj1.setMinimumWidth(INT_MAX);
#ifndef Q_WS_QWS //QWS doesn't allow toplevels to be bigger than the screen
-#if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET)
- QCOMPARE((long)obj1.minimumWidth(), QWIDGETSIZE_MAX); // The largest minimum size should only be as big as the maximium
-#else
QCOMPARE(obj1.minimumWidth(), QWIDGETSIZE_MAX); // The largest minimum size should only be as big as the maximium
#endif
-#endif
child1.setMinimumWidth(0);
QCOMPARE(child1.minimumWidth(), 0);
child1.setMinimumWidth(INT_MIN);
QCOMPARE(child1.minimumWidth(), 0); // A widgets width can never be less than 0
child1.setMinimumWidth(INT_MAX);
-#if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET)
- QCOMPARE((long)child1.minimumWidth(), QWIDGETSIZE_MAX); // The largest minimum size should only be as big as the maximium
-#else
QCOMPARE(child1.minimumWidth(), QWIDGETSIZE_MAX); // The largest minimum size should only be as big as the maximium
-#endif
// int QWidget::minimumHeight()
// void QWidget::setMinimumHeight(int)
@@ -492,38 +484,24 @@ void tst_QWidget::getSetCheck()
QCOMPARE(obj1.minimumHeight(), 0); // A widgets height can never be less than 0
obj1.setMinimumHeight(INT_MAX);
#ifndef Q_WS_QWS //QWS doesn't allow toplevels to be bigger than the screen
-#if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET)
- QCOMPARE((long)obj1.minimumHeight(), QWIDGETSIZE_MAX); // The largest minimum size should only be as big as the maximium
-#else
QCOMPARE(obj1.minimumHeight(), QWIDGETSIZE_MAX); // The largest minimum size should only be as big as the maximium
#endif
-#endif
child1.setMinimumHeight(0);
QCOMPARE(child1.minimumHeight(), 0);
child1.setMinimumHeight(INT_MIN);
QCOMPARE(child1.minimumHeight(), 0); // A widgets height can never be less than 0
child1.setMinimumHeight(INT_MAX);
-#if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET)
- QCOMPARE((long)child1.minimumHeight(), QWIDGETSIZE_MAX); // The largest minimum size should only be as big as the maximium
-#else
QCOMPARE(child1.minimumHeight(), QWIDGETSIZE_MAX); // The largest minimum size should only be as big as the maximium
-#endif
-
-
-// int QWidget::maximumWidth()
+ // int QWidget::maximumWidth()
// void QWidget::setMaximumWidth(int)
obj1.setMaximumWidth(0);
QCOMPARE(obj1.maximumWidth(), 0);
obj1.setMaximumWidth(INT_MIN);
QCOMPARE(obj1.maximumWidth(), 0); // A widgets width can never be less than 0
obj1.setMaximumWidth(INT_MAX);
-#if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET)
- QCOMPARE((long)obj1.maximumWidth(), QWIDGETSIZE_MAX); // QWIDGETSIZE_MAX is the abs max, not INT_MAX
-#else
QCOMPARE(obj1.maximumWidth(), QWIDGETSIZE_MAX); // QWIDGETSIZE_MAX is the abs max, not INT_MAX
-#endif
// int QWidget::maximumHeight()
// void QWidget::setMaximumHeight(int)
@@ -532,11 +510,7 @@ void tst_QWidget::getSetCheck()
obj1.setMaximumHeight(INT_MIN);
QCOMPARE(obj1.maximumHeight(), 0); // A widgets height can never be less than 0
obj1.setMaximumHeight(INT_MAX);
-#if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET)
- QCOMPARE((long)obj1.maximumHeight(), QWIDGETSIZE_MAX); // QWIDGETSIZE_MAX is the abs max, not INT_MAX
-#else
QCOMPARE(obj1.maximumHeight(), QWIDGETSIZE_MAX); // QWIDGETSIZE_MAX is the abs max, not INT_MAX
-#endif
// back to normal
obj1.setMinimumWidth(0);
diff --git a/tests/auto/qxml/qxml.pro b/tests/auto/qxml/qxml.pro
index 5fb7fe2..c87518a 100644
--- a/tests/auto/qxml/qxml.pro
+++ b/tests/auto/qxml/qxml.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qxml.cpp
QT = core xml
wince*|symbian: {
- addFiles.sources = 0x010D.xml
+ addFiles.files = 0x010D.xml
addFiles.path = .
DEPLOYMENT += addFiles
}
diff --git a/tests/auto/qxmlformatter/qxmlformatter.pro b/tests/auto/qxmlformatter/qxmlformatter.pro
index 339fa55..bcab0b4 100644
--- a/tests/auto/qxmlformatter/qxmlformatter.pro
+++ b/tests/auto/qxmlformatter/qxmlformatter.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qxmlformatter.cpp
include (../xmlpatterns.pri)
wince*|symbian:{
- addFiles.sources = baselines input
+ addFiles.files = baselines input
addFiles.path = .
DEPLOYMENT += addFiles
}
diff --git a/tests/auto/qxmlquery/qxmlquery.pro b/tests/auto/qxmlquery/qxmlquery.pro
index 044b7ce..d5e8228 100644
--- a/tests/auto/qxmlquery/qxmlquery.pro
+++ b/tests/auto/qxmlquery/qxmlquery.pro
@@ -19,10 +19,10 @@ wince* {
include (../xmlpatterns.pri)
wince*|symbian: {
- addFiles.sources = pushBaselines input.xml
+ addFiles.files = pushBaselines input.xml
addFiles.path = .
- patternistFiles.sources = ../xmlpatterns/queries
+ patternistFiles.files = ../xmlpatterns/queries
symbian: {
#../xmlpatterns resolves to an illegal path for deployment
patternistFiles.path = xmlpatterns
diff --git a/tests/auto/qxmlsimplereader/qxmlsimplereader.pro b/tests/auto/qxmlsimplereader/qxmlsimplereader.pro
index c107470..bc3cbd2 100644
--- a/tests/auto/qxmlsimplereader/qxmlsimplereader.pro
+++ b/tests/auto/qxmlsimplereader/qxmlsimplereader.pro
@@ -13,7 +13,7 @@ QT -= gui
wince*|symbian: {
- addFiles.sources = encodings parser xmldocs
+ addFiles.files = encodings parser xmldocs
addFiles.path = .
DEPLOYMENT += addFiles
}
diff --git a/tests/auto/qxmlstream/qxmlstream.pro b/tests/auto/qxmlstream/qxmlstream.pro
index 8f076be..31d77e7 100644
--- a/tests/auto/qxmlstream/qxmlstream.pro
+++ b/tests/auto/qxmlstream/qxmlstream.pro
@@ -5,7 +5,7 @@ QT = core xml network
wince*|symbian: {
- addFiles.sources = data XML-Test-Suite
+ addFiles.files = data XML-Test-Suite
addFiles.path = .
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\"\\\"
diff --git a/tests/auto/qzip/qzip.pro b/tests/auto/qzip/qzip.pro
index 632c743..683da62 100644
--- a/tests/auto/qzip/qzip.pro
+++ b/tests/auto/qzip/qzip.pro
@@ -2,7 +2,7 @@ load(qttest_p4)
SOURCES += tst_qzip.cpp
wince*|symbian: {
- addFiles.sources = testdata
+ addFiles.files = testdata
addFiles.path = .
DEPLOYMENT += addFiles
!symbian:DEFINES += SRCDIR=\\\".\\\"
diff --git a/tests/auto/selftests/expected_cmptest.txt b/tests/auto/selftests/expected_cmptest.txt
index 7f3aa9a..0beb46b 100644
--- a/tests/auto/selftests/expected_cmptest.txt
+++ b/tests/auto/selftests/expected_cmptest.txt
@@ -1,5 +1,5 @@
********* Start testing of tst_Cmptest *********
-Config: Using QTest library 4.7.1, Qt 4.7.1
+Config: Using QTest library 4.8.0, Qt 4.8.0
PASS : tst_Cmptest::initTestCase()
PASS : tst_Cmptest::compare_boolfuncs()
PASS : tst_Cmptest::compare_pointerfuncs()
diff --git a/tests/auto/selftests/expected_crashes_3.txt b/tests/auto/selftests/expected_crashes_3.txt
index 7ded525..b7f462a 100644
--- a/tests/auto/selftests/expected_crashes_3.txt
+++ b/tests/auto/selftests/expected_crashes_3.txt
@@ -1,5 +1,5 @@
********* Start testing of tst_Crashes *********
-Config: Using QTest library 4.7.1, Qt 4.7.1
+Config: Using QTest library 4.8.0, Qt 4.8.0
PASS : tst_Crashes::initTestCase()
QFATAL : tst_Crashes::crash() Received signal 11
FAIL! : tst_Crashes::crash() Received a fatal error.
diff --git a/tests/auto/selftests/expected_longstring.txt b/tests/auto/selftests/expected_longstring.txt
index 9ad6f56..99809a8 100644
--- a/tests/auto/selftests/expected_longstring.txt
+++ b/tests/auto/selftests/expected_longstring.txt
@@ -1,5 +1,5 @@
********* Start testing of tst_LongString *********
-Config: Using QTest library 4.7.1, Qt 4.7.1
+Config: Using QTest library 4.8.0, Qt 4.8.0
PASS : tst_LongString::initTestCase()
FAIL! : tst_LongString::failWithLongString() Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui.
diff --git a/tests/auto/selftests/expected_maxwarnings.txt b/tests/auto/selftests/expected_maxwarnings.txt
index 949da13..165bdda 100644
--- a/tests/auto/selftests/expected_maxwarnings.txt
+++ b/tests/auto/selftests/expected_maxwarnings.txt
@@ -1,5 +1,5 @@
********* Start testing of MaxWarnings *********
-Config: Using QTest library 4.7.1, Qt 4.7.1
+Config: Using QTest library 4.8.0, Qt 4.8.0
PASS : MaxWarnings::initTestCase()
QWARN : MaxWarnings::warn() 0
QWARN : MaxWarnings::warn() 1
diff --git a/tests/auto/selftests/expected_skip.txt b/tests/auto/selftests/expected_skip.txt
index 1f5bf7b..4b53a43 100644
--- a/tests/auto/selftests/expected_skip.txt
+++ b/tests/auto/selftests/expected_skip.txt
@@ -1,5 +1,5 @@
********* Start testing of tst_Skip *********
-Config: Using QTest library 4.7.1, Qt 4.7.1
+Config: Using QTest library 4.8.0, Qt 4.8.0
PASS : tst_Skip::initTestCase()
SKIP : tst_Skip::test() skipping all
Loc: [/home/user/depot/qt-git/mainline/tests/auto/selftests/skip/tst_skip.cpp(68)]
diff --git a/tests/auto/uic/baseline/icontheme.ui b/tests/auto/uic/baseline/icontheme.ui
new file mode 100644
index 0000000..a214635
--- /dev/null
+++ b/tests/auto/uic/baseline/icontheme.ui
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>122</width>
+ <height>117</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QPushButton" name="fileicon">
+ <property name="text">
+ <string>fileicon</string>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>image1.png</normaloff>image1.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="fileandthemeicon">
+ <property name="text">
+ <string>PushButton</string>
+ </property>
+ <property name="icon">
+ <iconset theme="edit-copy">
+ <normaloff>image7.png</normaloff>image7.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="themeicon">
+ <property name="text">
+ <string>PushButton</string>
+ </property>
+ <property name="icon">
+ <iconset theme="edit-copy">
+ <normaloff/>
+ </iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/auto/uic/baseline/icontheme.ui.h b/tests/auto/uic/baseline/icontheme.ui.h
new file mode 100644
index 0000000..946fff9
--- /dev/null
+++ b/tests/auto/uic/baseline/icontheme.ui.h
@@ -0,0 +1,95 @@
+/********************************************************************************
+** Form generated from reading UI file 'icontheme.ui'
+**
+** Created: Thu Sep 2 10:28:19 2010
+** by: Qt User Interface Compiler version 4.8.0
+**
+** WARNING! All changes made in this file will be lost when recompiling UI file!
+********************************************************************************/
+
+#ifndef ICONTHEME_H
+#define ICONTHEME_H
+
+#include <QtCore/QVariant>
+#include <QtGui/QAction>
+#include <QtGui/QApplication>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QHeaderView>
+#include <QtGui/QPushButton>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QWidget>
+
+QT_BEGIN_NAMESPACE
+
+class Ui_Form
+{
+public:
+ QVBoxLayout *verticalLayout;
+ QPushButton *fileicon;
+ QPushButton *fileandthemeicon;
+ QPushButton *themeicon;
+
+ void setupUi(QWidget *Form)
+ {
+ if (Form->objectName().isEmpty())
+ Form->setObjectName(QString::fromUtf8("Form"));
+ Form->resize(122, 117);
+ verticalLayout = new QVBoxLayout(Form);
+ verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
+ fileicon = new QPushButton(Form);
+ fileicon->setObjectName(QString::fromUtf8("fileicon"));
+ QIcon icon;
+ icon.addFile(QString::fromUtf8("image1.png"), QSize(), QIcon::Normal, QIcon::Off);
+ fileicon->setIcon(icon);
+
+ verticalLayout->addWidget(fileicon);
+
+ fileandthemeicon = new QPushButton(Form);
+ fileandthemeicon->setObjectName(QString::fromUtf8("fileandthemeicon"));
+ QIcon icon1;
+ QString iconThemeName = QString::fromUtf8("edit-copy");
+ if (QIcon::hasThemeIcon(iconThemeName)) {
+ icon1 = QIcon::fromTheme(iconThemeName);
+ } else {
+ icon1.addFile(QString::fromUtf8("image7.png"), QSize(), QIcon::Normal, QIcon::Off);
+ }
+ fileandthemeicon->setIcon(icon1);
+
+ verticalLayout->addWidget(fileandthemeicon);
+
+ themeicon = new QPushButton(Form);
+ themeicon->setObjectName(QString::fromUtf8("themeicon"));
+ QIcon icon2;
+ iconThemeName = QString::fromUtf8("edit-copy");
+ if (QIcon::hasThemeIcon(iconThemeName)) {
+ icon2 = QIcon::fromTheme(iconThemeName);
+ } else {
+ icon2.addFile(QString::fromUtf8(""), QSize(), QIcon::Normal, QIcon::Off);
+ }
+ themeicon->setIcon(icon2);
+
+ verticalLayout->addWidget(themeicon);
+
+
+ retranslateUi(Form);
+
+ QMetaObject::connectSlotsByName(Form);
+ } // setupUi
+
+ void retranslateUi(QWidget *Form)
+ {
+ Form->setWindowTitle(QApplication::translate("Form", "Form", 0, QApplication::UnicodeUTF8));
+ fileicon->setText(QApplication::translate("Form", "fileicon", 0, QApplication::UnicodeUTF8));
+ fileandthemeicon->setText(QApplication::translate("Form", "PushButton", 0, QApplication::UnicodeUTF8));
+ themeicon->setText(QApplication::translate("Form", "PushButton", 0, QApplication::UnicodeUTF8));
+ } // retranslateUi
+
+};
+
+namespace Ui {
+ class Form: public Ui_Form {};
+} // namespace Ui
+
+QT_END_NAMESPACE
+
+#endif // ICONTHEME_H
diff --git a/tests/auto/uiloader/uiloader/uiloader.pro b/tests/auto/uiloader/uiloader/uiloader.pro
index d99df00..4e95956 100644
--- a/tests/auto/uiloader/uiloader/uiloader.pro
+++ b/tests/auto/uiloader/uiloader/uiloader.pro
@@ -17,10 +17,10 @@ QT += xml svg network
contains(QT_CONFIG, qt3support): QT += qt3support
wince*|symbian: {
- configuration.sources = ../*.ini
+ configuration.files = ../*.ini
configuration.path = .
- screenapp.sources = ../tst_screenshot/tst_screenshot.exe
+ screenapp.files = ../tst_screenshot/tst_screenshot.exe
screenapp.path = tst_screenshot
DEPLOYMENT += configuration screenapp
diff --git a/tests/auto/utf8/tst_utf8.cpp b/tests/auto/utf8/tst_utf8.cpp
index 7bbbfab..9b6b8c1 100644
--- a/tests/auto/utf8/tst_utf8.cpp
+++ b/tests/auto/utf8/tst_utf8.cpp
@@ -210,7 +210,9 @@ void tst_Utf8::invalidUtf8_data()
QTest::addColumn<QByteArray>("utf8");
QTest::newRow("1char") << QByteArray("\x80");
- QTest::newRow("2chars") << QByteArray("\xC2\xC0");
+ QTest::newRow("2chars-1") << QByteArray("\xC2\xC0");
+ QTest::newRow("2chars-2") << QByteArray("\xC3\xDF");
+ QTest::newRow("2chars-3") << QByteArray("\xC7\xF0");
QTest::newRow("3chars-1") << QByteArray("\xE0\xA0\xC0");
QTest::newRow("3chars-2") << QByteArray("\xE0\xC0\xA0");
QTest::newRow("4chars-1") << QByteArray("\xF0\x90\x80\xC0");
diff --git a/tests/auto/windowsmobile/test/test.pro b/tests/auto/windowsmobile/test/test.pro
index f3124a3..b0536a5 100644
--- a/tests/auto/windowsmobile/test/test.pro
+++ b/tests/auto/windowsmobile/test/test.pro
@@ -8,7 +8,7 @@ RESOURCES += windowsmobile.qrc
TARGET = ../tst_windowsmobile
wincewm*: {
- addFiles.sources = $$OUT_PWD/../testQMenuBar/*.exe
+ addFiles.files = $$OUT_PWD/../testQMenuBar/*.exe
addFiles.path = "\\Program Files\\tst_windowsmobile"
diff --git a/tests/auto/xmlpatterns.pri b/tests/auto/xmlpatterns.pri
index 8c8ccad..57b8517 100644
--- a/tests/auto/xmlpatterns.pri
+++ b/tests/auto/xmlpatterns.pri
@@ -4,9 +4,9 @@ contains(QT_CONFIG,xmlpatterns) {
}
wince*: {
- patternsdk.sources = $$QT_BUILD_TREE/lib/QtXmlPatternsSDK*.dll
+ patternsdk.files = $$QT_BUILD_TREE/lib/QtXmlPatternsSDK*.dll
patternsdk.path = .
- basedata.sources = xmlpaternsxqts/Baseline.xml
+ basedata.files = xmlpaternsxqts/Baseline.xml
basedata.path = .
DEPLOYMENT += patternsdk
QT += network
diff --git a/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro b/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro
index 981adab..3e252f6 100644
--- a/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro
+++ b/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro
@@ -21,7 +21,7 @@ INCLUDEPATH += $$(QTSRCDIR)/tests/auto/xmlpatternssdk \
../xmlpatternssdk
wince*|symbian {
- catalog.sources = TestSuite Baseline.xml
+ catalog.files = TestSuite Baseline.xml
catalog.path = .
DEPLOYMENT += catalog
}
diff --git a/tests/auto/xmlpatternsview/xmlpatternsview.pro b/tests/auto/xmlpatternsview/xmlpatternsview.pro
index d93cba3..5ab0f0e 100644
--- a/tests/auto/xmlpatternsview/xmlpatternsview.pro
+++ b/tests/auto/xmlpatternsview/xmlpatternsview.pro
@@ -6,7 +6,7 @@ include (../xmlpatterns.pri)
TARGET = tst_xmlpatternsview
wince*: {
- viewexe.sources = $$QT_BUILD_TREE/xmlpatternsview.exe
+ viewexe.files = $$QT_BUILD_TREE/xmlpatternsview.exe
viewexe.path = .
DEPLOYMENT += viewexe
}
diff --git a/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro b/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro
index 940cc31..44c4754 100644
--- a/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro
+++ b/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro
@@ -18,7 +18,7 @@ INCLUDEPATH += $$(QTSRCDIR)/tests/auto/xmlpatternssdk \
../xmlpatternssdk
wince*: {
- testdata.sources = XSLTS Baseline.xml
+ testdata.files = XSLTS Baseline.xml
testdata.path = .
DEPLOYMENT += testdata
}
diff --git a/tests/benchmarks/corelib/codecs/qtextcodec/qtextcodec.pro b/tests/benchmarks/corelib/codecs/qtextcodec/qtextcodec.pro
index 23f0e00..f26d623 100644
--- a/tests/benchmarks/corelib/codecs/qtextcodec/qtextcodec.pro
+++ b/tests/benchmarks/corelib/codecs/qtextcodec/qtextcodec.pro
@@ -6,7 +6,7 @@ SOURCES += main.cpp
wince*:{
DEFINES += SRCDIR=\\\"\\\"
} else:symbian* {
- addFiles.sources = utf-8.txt
+ addFiles.files = utf-8.txt
addFiles.path = .
DEPLOYMENT += addFiles
TARGET.EPOCHEAPSIZE="0x100 0x1000000"
diff --git a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
index 320746c..17d164d 100755
--- a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
+++ b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
@@ -16,7 +16,7 @@ SOURCES += qfilesystemiterator.cpp
HEADERS += qfilesystemiterator.h
wince*|symbian: {
- corelibdir.sources = $$QT_SOURCE_TREE/src/corelib
+ corelibdir.files = $$QT_SOURCE_TREE/src/corelib
corelibdir.path = ./depot/src
DEPLOYMENT += corelibdir
}
diff --git a/tests/benchmarks/corelib/io/qfileinfo/main.cpp b/tests/benchmarks/corelib/io/qfileinfo/main.cpp
index 025787f..b272bda 100644
--- a/tests/benchmarks/corelib/io/qfileinfo/main.cpp
+++ b/tests/benchmarks/corelib/io/qfileinfo/main.cpp
@@ -43,15 +43,20 @@
#include <QtTest/QtTest>
#include <QtCore/QCoreApplication>
#include <QtCore/QFileInfo>
+#include <QtCore/QFile>
#include "private/qfsfileengine_p.h"
+#include "../../../../shared/filesystem.h"
class qfileinfo : public QObject
{
Q_OBJECT
private slots:
void canonicalFileNamePerformance();
-
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+ void symLinkTargetPerformanceLNK();
+ void symLinkTargetPerformanceMounpoint();
+#endif
void initTestCase();
void cleanupTestCase();
public:
@@ -78,6 +83,43 @@ void qfileinfo::canonicalFileNamePerformance()
}
}
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+void qfileinfo::symLinkTargetPerformanceLNK()
+{
+ QVERIFY(QFile::link("file","link.lnk"));
+ QFileInfo info("link.lnk");
+ info.setCaching(false);
+ QVERIFY(info.isSymLink());
+ QString linkTarget;
+ QBENCHMARK {
+ for(int i=0; i<100; i++)
+ linkTarget = info.readLink();
+ }
+ QVERIFY(QFile::remove("link.lnk"));
+}
+
+void qfileinfo::symLinkTargetPerformanceMounpoint()
+{
+ wchar_t buffer[MAX_PATH];
+ QString rootPath = QDir::toNativeSeparators(QDir::rootPath());
+ QVERIFY(GetVolumeNameForVolumeMountPointW(rootPath.utf16(), buffer, MAX_PATH));
+ QString rootVolume = QString::fromWCharArray(buffer);
+ QString mountpoint = "mountpoint";
+ rootVolume.replace("\\\\?\\","\\??\\");
+ FileSystem::createNtfsJunction(rootVolume, mountpoint);
+
+ QFileInfo info(mountpoint);
+ info.setCaching(false);
+ QVERIFY(info.isSymLink());
+ QString linkTarget;
+ QBENCHMARK {
+ for(int i=0; i<100; i++)
+ linkTarget = info.readLink();
+ }
+ QVERIFY(QDir().rmdir(mountpoint));
+}
+#endif
+
QTEST_MAIN(qfileinfo)
#include "main.moc"
diff --git a/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp
index 36399af..ebeea84 100644
--- a/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -71,6 +71,11 @@ private slots:
void isRegisteredBuiltin();
void isRegisteredCustom();
void isRegisteredNotRegistered();
+
+ void constructCoreType_data();
+ void constructCoreType();
+ void constructCoreTypeCopy_data();
+ void constructCoreTypeCopy();
};
tst_QMetaType::tst_QMetaType()
@@ -229,5 +234,52 @@ void tst_QMetaType::isRegisteredNotRegistered()
}
}
+void tst_QMetaType::constructCoreType_data()
+{
+ QTest::addColumn<int>("typeId");
+ for (int i = 0; i <= QMetaType::LastCoreType; ++i)
+ QTest::newRow(QMetaType::typeName(i)) << i;
+ for (int i = QMetaType::FirstCoreExtType; i <= QMetaType::LastCoreExtType; ++i)
+ QTest::newRow(QMetaType::typeName(i)) << i;
+ // GUI types are tested in tst_QGuiMetaType.
+}
+
+// Tests how fast QMetaType can default-construct and destroy a Qt
+// core type. The purpose of this benchmark is to measure the overhead
+// of using type id-based creation compared to creating the type
+// directly (i.e. "T *t = new T(); delete t;").
+void tst_QMetaType::constructCoreType()
+{
+ QFETCH(int, typeId);
+ QBENCHMARK {
+ for (int i = 0; i < 100000; ++i) {
+ void *data = QMetaType::construct(typeId, (void *)0);
+ QMetaType::destroy(typeId, data);
+ }
+ }
+}
+
+void tst_QMetaType::constructCoreTypeCopy_data()
+{
+ constructCoreType_data();
+}
+
+// Tests how fast QMetaType can copy-construct and destroy a Qt core
+// type. The purpose of this benchmark is to measure the overhead of
+// using type id-based creation compared to creating the type directly
+// (i.e. "T *t = new T(other); delete t;").
+void tst_QMetaType::constructCoreTypeCopy()
+{
+ QFETCH(int, typeId);
+ QVariant other(typeId, (void *)0);
+ const void *copy = other.constData();
+ QBENCHMARK {
+ for (int i = 0; i < 100000; ++i) {
+ void *data = QMetaType::construct(typeId, copy);
+ QMetaType::destroy(typeId, data);
+ }
+ }
+}
+
QTEST_MAIN(tst_QMetaType)
#include "tst_qmetatype.moc"
diff --git a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp
index 58cec4f..5e19c1b 100644
--- a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -71,6 +71,11 @@ private slots:
void floatVariantValue();
void rectVariantValue();
void stringVariantValue();
+
+ void createCoreType_data();
+ void createCoreType();
+ void createCoreTypeCopy_data();
+ void createCoreTypeCopy();
};
void tst_qvariant::testBound()
@@ -220,6 +225,48 @@ void tst_qvariant::stringVariantValue()
}
}
+void tst_qvariant::createCoreType_data()
+{
+ QTest::addColumn<int>("typeId");
+ for (int i = 0; i <= QMetaType::LastCoreType; ++i)
+ QTest::newRow(QMetaType::typeName(i)) << i;
+ for (int i = QMetaType::FirstCoreExtType; i <= QMetaType::LastCoreExtType; ++i)
+ QTest::newRow(QMetaType::typeName(i)) << i;
+}
+
+// Tests how fast a Qt core type can be default-constructed by a
+// QVariant. The purpose of this benchmark is to measure the overhead
+// of creating (and destroying) a QVariant compared to creating the
+// type directly.
+void tst_qvariant::createCoreType()
+{
+ QFETCH(int, typeId);
+ QBENCHMARK {
+ for (int i = 0; i < ITERATION_COUNT; ++i)
+ QVariant(typeId, (void *)0);
+ }
+}
+
+void tst_qvariant::createCoreTypeCopy_data()
+{
+ createCoreType_data();
+}
+
+// Tests how fast a Qt core type can be copy-constructed by a
+// QVariant. The purpose of this benchmark is to measure the overhead
+// of creating (and destroying) a QVariant compared to creating the
+// type directly.
+void tst_qvariant::createCoreTypeCopy()
+{
+ QFETCH(int, typeId);
+ QVariant other(typeId, (void *)0);
+ const void *copy = other.constData();
+ QBENCHMARK {
+ for (int i = 0; i < ITERATION_COUNT; ++i)
+ QVariant(typeId, copy);
+ }
+}
+
QTEST_MAIN(tst_qvariant)
#include "tst_qvariant.moc"
diff --git a/tests/benchmarks/corelib/thread/qmutex/qmutex.pro b/tests/benchmarks/corelib/thread/qmutex/qmutex.pro
new file mode 100644
index 0000000..eda2f11
--- /dev/null
+++ b/tests/benchmarks/corelib/thread/qmutex/qmutex.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_bench_qmutex
+
+SOURCES += tst_qmutex.cpp
+
diff --git a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp
new file mode 100644
index 0000000..fded508
--- /dev/null
+++ b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtCore>
+
+#include <math.h>
+
+//TESTED_FILES=
+
+
+class tst_QMutex : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QMutex();
+ virtual ~tst_QMutex();
+
+private slots:
+ void noThread_data();
+ void noThread();
+};
+
+tst_QMutex::tst_QMutex()
+{
+}
+
+tst_QMutex::~tst_QMutex()
+{
+}
+
+void tst_QMutex::noThread_data()
+{
+ QTest::addColumn<int>("t");
+
+ QTest::newRow("noLock") << 1;
+ QTest::newRow("QMutexInline") << 2;
+ QTest::newRow("QMutex") << 3;
+ QTest::newRow("QMutexLocker") << 4;
+}
+
+void tst_QMutex::noThread()
+{
+ volatile int count = 0;
+ const int N = 5000000;
+ QMutex mtx;
+
+ QFETCH(int, t);
+ switch(t) {
+ case 1:
+ QBENCHMARK {
+ count = 0;
+ for (int i = 0; i < N; i++) {
+ count++;
+ }
+ }
+ break;
+ case 2:
+ QBENCHMARK {
+ count = 0;
+ for (int i = 0; i < N; i++) {
+ mtx.lockInline();
+ count++;
+ mtx.unlockInline();
+ }
+ }
+ break;
+ case 3:
+ QBENCHMARK {
+ count = 0;
+ for (int i = 0; i < N; i++) {
+ mtx.lock();
+ count++;
+ mtx.unlock();
+ }
+ }
+ break;
+ case 4:
+ QBENCHMARK {
+ count = 0;
+ for (int i = 0; i < N; i++) {
+ QMutexLocker locker(&mtx);
+ count++;
+ }
+ }
+ break;
+ }
+ QCOMPARE(int(count), N);
+}
+
+QTEST_MAIN(tst_QMutex)
+#include "tst_qmutex.moc"
diff --git a/tests/benchmarks/corelib/tools/qstring/qstring.pro b/tests/benchmarks/corelib/tools/qstring/qstring.pro
index e8720e1..e43e400 100644
--- a/tests/benchmarks/corelib/tools/qstring/qstring.pro
+++ b/tests/benchmarks/corelib/tools/qstring/qstring.pro
@@ -6,7 +6,7 @@ SOURCES += main.cpp data.cpp
wince*:{
DEFINES += SRCDIR=\\\"\\\"
} else:symbian* {
- addFiles.sources = utf-8.txt
+ addFiles.files = utf-8.txt
addFiles.path = .
DEPLOYMENT += addFiles
TARGET.EPOCHEAPSIZE="0x100 0x1000000"
diff --git a/tests/benchmarks/declarative/binding/binding.pro b/tests/benchmarks/declarative/binding/binding.pro
index c1a8223..ceaabeb 100644
--- a/tests/benchmarks/declarative/binding/binding.pro
+++ b/tests/benchmarks/declarative/binding/binding.pro
@@ -8,7 +8,7 @@ SOURCES += tst_binding.cpp testtypes.cpp
HEADERS += testtypes.h
symbian {
- data.sources = data
+ data.files = data
data.path = .
DEPLOYMENT = data
} else {
diff --git a/tests/benchmarks/declarative/compilation/compilation.pro b/tests/benchmarks/declarative/compilation/compilation.pro
index 9277187..9ab2a25 100644
--- a/tests/benchmarks/declarative/compilation/compilation.pro
+++ b/tests/benchmarks/declarative/compilation/compilation.pro
@@ -9,7 +9,7 @@ CONFIG += release
SOURCES += tst_compilation.cpp
symbian {
- data.sources += data
+ data.files += data
data.path = .
DEPLOYMENT += data
} else {
diff --git a/tests/benchmarks/declarative/creation/creation.pro b/tests/benchmarks/declarative/creation/creation.pro
index 6540fa2..74cb47f 100644
--- a/tests/benchmarks/declarative/creation/creation.pro
+++ b/tests/benchmarks/declarative/creation/creation.pro
@@ -7,7 +7,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_creation.cpp
symbian {
- data.sources = data
+ data.files = data
data.path = .
DEPLOYMENT += data
} else {
diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro b/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro
index b2f39c1..4693a82 100644
--- a/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro
+++ b/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro
@@ -8,7 +8,7 @@ SOURCES += tst_qdeclarativecomponent.cpp testtypes.cpp
HEADERS += testtypes.h
symbian {
- data.sources = data
+ data.files = data
data.path = .
DEPLOYMENT += data
} else {
diff --git a/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro b/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro
index a68792b..c4d5609 100644
--- a/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro
+++ b/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro
@@ -8,7 +8,7 @@ CONFIG += release
SOURCES += tst_qdeclarativeimage.cpp
symbian {
- importFiles.sources = image.png
+ importFiles.files = image.png
importFiles.path =
DEPLOYMENT = importFiles
} else {
diff --git a/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro b/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro
index 65ee7e0..765e37a 100644
--- a/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro
+++ b/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro
@@ -7,7 +7,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativemetaproperty.cpp
symbian {
- data.sources += data
+ data.files += data
data.path = .
DEPLOYMENT += data
} else {
diff --git a/tests/benchmarks/declarative/qmltime/qmltime.pro b/tests/benchmarks/declarative/qmltime/qmltime.pro
index 6f5ad5e..273a60a 100644
--- a/tests/benchmarks/declarative/qmltime/qmltime.pro
+++ b/tests/benchmarks/declarative/qmltime/qmltime.pro
@@ -8,7 +8,7 @@ SOURCES += qmltime.cpp
symbian {
TARGET.CAPABILITY = "All -TCB"
- example.sources = example.qml tests
+ example.files = example.qml tests
example.path = .
DEPLOYMENT += example
}
diff --git a/tests/benchmarks/declarative/script/script.pro b/tests/benchmarks/declarative/script/script.pro
index 685ba03..d6cb708 100644
--- a/tests/benchmarks/declarative/script/script.pro
+++ b/tests/benchmarks/declarative/script/script.pro
@@ -8,7 +8,7 @@ CONFIG += release
SOURCES += tst_script.cpp
symbian {
- importFiles.sources = data
+ importFiles.files = data
importFiles.path =
DEPLOYMENT = importFiles
} else {
diff --git a/tests/benchmarks/declarative/typeimports/typeimports.pro b/tests/benchmarks/declarative/typeimports/typeimports.pro
index a5df3f0..56834e6 100644
--- a/tests/benchmarks/declarative/typeimports/typeimports.pro
+++ b/tests/benchmarks/declarative/typeimports/typeimports.pro
@@ -7,7 +7,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_typeimports.cpp
symbian {
- data.sources = data
+ data.files = data
data.path = .
DEPLOYMENT += data
} else {
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro b/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro
index 6e044f9..bfa374c 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro
@@ -9,7 +9,7 @@ include(chiptester/chiptester.pri)
symbian {
qt_not_deployed {
- plugins.sources = qjpeg.dll
+ plugins.files = qjpeg.dll
plugins.path = imageformats
DEPLOYMENT += plugins
}
diff --git a/tests/benchmarks/gui/image/qimagereader/qimagereader.pro b/tests/benchmarks/gui/image/qimagereader/qimagereader.pro
index d67f4be..db5ffcd 100644
--- a/tests/benchmarks/gui/image/qimagereader/qimagereader.pro
+++ b/tests/benchmarks/gui/image/qimagereader/qimagereader.pro
@@ -11,15 +11,15 @@ SOURCES += tst_qimagereader.cpp
QT += network
wince*: {
- addFiles.sources = images
+ addFiles.files = images
addFiles.path = .
CONFIG(debug, debug|release):{
- imageFormatsPlugins.sources = $$(QTDIR)/plugins/imageformats/*d4.dll
+ imageFormatsPlugins.files = $$(QTDIR)/plugins/imageformats/*d4.dll
}
CONFIG(release, debug|release):{
- imageFormatsPlugins.sources = $$(QTDIR)/plugins/imageformats/*[^d]4.dll
+ imageFormatsPlugins.files = $$(QTDIR)/plugins/imageformats/*[^d]4.dll
}
imageFormatsPlugins.path = imageformats
DEPLOYMENT += addFiles imageFormatsPlugins
diff --git a/tests/benchmarks/gui/kernel/qguimetatype/qguimetatype.pro b/tests/benchmarks/gui/kernel/qguimetatype/qguimetatype.pro
new file mode 100644
index 0000000..7ef99e4
--- /dev/null
+++ b/tests/benchmarks/gui/kernel/qguimetatype/qguimetatype.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_bench_qguimetatype
+
+SOURCES += tst_qguimetatype.cpp
+
diff --git a/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp
new file mode 100644
index 0000000..f94767b
--- /dev/null
+++ b/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtCore/qmetatype.h>
+
+class tst_QGuiMetaType : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QGuiMetaType();
+ virtual ~tst_QGuiMetaType();
+
+private slots:
+ void constructGuiType_data();
+ void constructGuiType();
+ void constructGuiTypeCopy_data();
+ void constructGuiTypeCopy();
+};
+
+tst_QGuiMetaType::tst_QGuiMetaType()
+{
+}
+
+tst_QGuiMetaType::~tst_QGuiMetaType()
+{
+}
+
+void tst_QGuiMetaType::constructGuiType_data()
+{
+ QTest::addColumn<int>("typeId");
+ for (int i = QMetaType::FirstGuiType; i <= QMetaType::LastGuiType; ++i)
+ QTest::newRow(QMetaType::typeName(i)) << i;
+}
+
+// Tests how fast QMetaType can default-construct and destroy a Qt GUI
+// type. The purpose of this benchmark is to measure the overhead of
+// using type id-based creation compared to creating the type directly
+// (i.e. "T *t = new T(); delete t;").
+void tst_QGuiMetaType::constructGuiType()
+{
+ QFETCH(int, typeId);
+ QBENCHMARK {
+ for (int i = 0; i < 100000; ++i) {
+ void *data = QMetaType::construct(typeId, (void *)0);
+ QMetaType::destroy(typeId, data);
+ }
+ }
+}
+
+void tst_QGuiMetaType::constructGuiTypeCopy_data()
+{
+ constructGuiType_data();
+}
+
+// Tests how fast QMetaType can copy-construct and destroy a Qt GUI
+// type. The purpose of this benchmark is to measure the overhead of
+// using type id-based creation compared to creating the type directly
+// (i.e. "T *t = new T(other); delete t;").
+void tst_QGuiMetaType::constructGuiTypeCopy()
+{
+ QFETCH(int, typeId);
+ QVariant other(typeId, (void *)0);
+ const void *copy = other.constData();
+ QBENCHMARK {
+ for (int i = 0; i < 100000; ++i) {
+ void *data = QMetaType::construct(typeId, copy);
+ QMetaType::destroy(typeId, data);
+ }
+ }
+}
+
+QTEST_MAIN(tst_QGuiMetaType)
+#include "tst_qguimetatype.moc"
diff --git a/tests/benchmarks/gui/kernel/qguivariant/qguivariant.pro b/tests/benchmarks/gui/kernel/qguivariant/qguivariant.pro
new file mode 100644
index 0000000..4e05dd7
--- /dev/null
+++ b/tests/benchmarks/gui/kernel/qguivariant/qguivariant.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_bench_qguivariant
+
+SOURCES += tst_qguivariant.cpp
+
diff --git a/tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp b/tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp
new file mode 100644
index 0000000..4016be1
--- /dev/null
+++ b/tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtCore/qvariant.h>
+
+#define ITERATION_COUNT 1e5
+
+class tst_QGuiVariant : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QGuiVariant();
+ virtual ~tst_QGuiVariant();
+
+private slots:
+ void createGuiType_data();
+ void createGuiType();
+ void createGuiTypeCopy_data();
+ void createGuiTypeCopy();
+};
+
+tst_QGuiVariant::tst_QGuiVariant()
+{
+}
+
+tst_QGuiVariant::~tst_QGuiVariant()
+{
+}
+
+void tst_QGuiVariant::createGuiType_data()
+{
+ QTest::addColumn<int>("typeId");
+ for (int i = QMetaType::FirstGuiType; i <= QMetaType::LastGuiType; ++i)
+ QTest::newRow(QMetaType::typeName(i)) << i;
+}
+
+// Tests how fast a Qt GUI type can be default-constructed by a
+// QVariant. The purpose of this benchmark is to measure the overhead
+// of creating (and destroying) a QVariant compared to creating the
+// type directly.
+void tst_QGuiVariant::createGuiType()
+{
+ QFETCH(int, typeId);
+ QBENCHMARK {
+ for (int i = 0; i < ITERATION_COUNT; ++i)
+ QVariant(typeId, (void *)0);
+ }
+}
+
+void tst_QGuiVariant::createGuiTypeCopy_data()
+{
+ createGuiType_data();
+}
+
+// Tests how fast a Qt GUI type can be copy-constructed by a
+// QVariant. The purpose of this benchmark is to measure the overhead
+// of creating (and destroying) a QVariant compared to creating the
+// type directly.
+void tst_QGuiVariant::createGuiTypeCopy()
+{
+ QFETCH(int, typeId);
+ QVariant other(typeId, (void *)0);
+ const void *copy = other.constData();
+ QBENCHMARK {
+ for (int i = 0; i < ITERATION_COUNT; ++i)
+ QVariant(typeId, copy);
+ }
+}
+
+QTEST_MAIN(tst_QGuiVariant)
+#include "tst_qguivariant.moc"
diff --git a/tests/benchmarks/gui/text/qtext/qtext.pro b/tests/benchmarks/gui/text/qtext/qtext.pro
index a1b6a22..1c18302 100644
--- a/tests/benchmarks/gui/text/qtext/qtext.pro
+++ b/tests/benchmarks/gui/text/qtext/qtext.pro
@@ -6,7 +6,7 @@ SOURCES += main.cpp
symbian* {
TARGET.CAPABILITY = ALL -TCB
- addFiles.sources = bidi.txt
+ addFiles.files = bidi.txt
addFiles.path = .
DEPLOYMENT += addFiles
} else {
diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 90ae153..6b94f3c 100644
--- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -51,6 +51,8 @@
#include "../../../../auto/network-settings.h"
+Q_DECLARE_METATYPE(QSharedPointer<char>)
+
class TimedSender: public QThread
{
Q_OBJECT
@@ -465,7 +467,8 @@ private slots:
void httpUploadPerformance();
void httpDownloadPerformance_data();
void httpDownloadPerformance();
-
+ void httpDownloadPerformanceDownloadBuffer_data();
+ void httpDownloadPerformanceDownloadBuffer();
};
void tst_qnetworkreply::httpLatency()
@@ -649,6 +652,91 @@ void tst_qnetworkreply::httpDownloadPerformance()
qint64 elapsed = time.elapsed();
qDebug() << "tst_QNetworkReply::httpDownloadPerformance" << elapsed << "msec, "
<< ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec";
+};
+
+enum HttpDownloadPerformanceDownloadBufferTestType {
+ JustDownloadBuffer,
+ DownloadBufferButUseRead,
+ NoDownloadBuffer
+};
+Q_DECLARE_METATYPE(HttpDownloadPerformanceDownloadBufferTestType)
+
+class HttpDownloadPerformanceClientDownloadBuffer : QObject {
+ Q_OBJECT
+private:
+ HttpDownloadPerformanceDownloadBufferTestType testType;
+ QNetworkReply *reply;
+ qint64 uploadSize;
+ QList<qint64> bytesAvailableList;
+public:
+ HttpDownloadPerformanceClientDownloadBuffer (QNetworkReply *reply, HttpDownloadPerformanceDownloadBufferTestType testType, qint64 uploadSize)
+ : testType(testType), reply(reply), uploadSize(uploadSize)
+ {
+ connect(reply, SIGNAL(finished()), this, SLOT(finishedSlot()));
+ }
+
+ public slots:
+ void finishedSlot() {
+ if (testType == JustDownloadBuffer) {
+ // We have a download buffer and use it. This should be the fastest benchmark result.
+ QVariant downloadBufferAttribute = reply->attribute(QNetworkRequest::DownloadBufferAttribute);
+ QSharedPointer<char> data = downloadBufferAttribute.value<QSharedPointer<char> >();
+ } else if (testType == DownloadBufferButUseRead) {
+ // We had a download buffer but we benchmark here the "legacy" read() way to access it
+ char* replyData = (char*) qMalloc(uploadSize);
+ QVERIFY(reply->read(replyData, uploadSize) == uploadSize);
+ qFree(replyData);
+ } else if (testType == NoDownloadBuffer) {
+ // We did not have a download buffer but we still need to benchmark having the data, e.g. reading it all.
+ // This should be the slowest benchmark result.
+ char* replyData = (char*) qMalloc(uploadSize);
+ QVERIFY(reply->read(replyData, uploadSize) == uploadSize);
+ qFree(replyData);
+ }
+
+ QMetaObject::invokeMethod(&QTestEventLoop::instance(), "exitLoop", Qt::QueuedConnection);
+ }
+};
+
+void tst_qnetworkreply::httpDownloadPerformanceDownloadBuffer_data()
+{
+ QTest::addColumn<HttpDownloadPerformanceDownloadBufferTestType>("testType");
+
+ QTest::newRow("use-download-buffer") << JustDownloadBuffer;
+ QTest::newRow("use-download-buffer-but-use-read") << DownloadBufferButUseRead;
+ QTest::newRow("do-not-use-download-buffer") << NoDownloadBuffer;
+}
+
+// Please note that the whole "zero copy" download buffer API is private right now. Do not use it.
+void tst_qnetworkreply::httpDownloadPerformanceDownloadBuffer()
+{
+ QFETCH(HttpDownloadPerformanceDownloadBufferTestType, testType);
+
+ // On my Linux Desktop the results are already visible with 128 kB, however we use this to have good results.
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_WINCE_WM)
+ // Show some mercy to non-desktop platform/s
+ enum {UploadSize = 4*1024*1024}; // 4 MB
+#else
+ enum {UploadSize = 32*1024*1024}; // 32 MB
+#endif
+
+ HttpDownloadPerformanceServer server(UploadSize, true, false);
+
+ QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/?bare=1"));
+ if (testType == JustDownloadBuffer || testType == DownloadBufferButUseRead)
+ request.setAttribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute, 1024*1024*128); // 128 MB is max allowed
+
+ QNetworkAccessManager manager;
+ QNetworkReplyPtr reply = manager.get(request);
+
+ HttpDownloadPerformanceClientDownloadBuffer client(reply, testType, UploadSize);
+
+ QBENCHMARK_ONCE {
+ QTestEventLoop::instance().enterLoop(40);
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+ QVERIFY(reply->isFinished());
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ }
}
QTEST_MAIN(tst_qnetworkreply)
diff --git a/tests/benchmarks/script/qscriptqobject/qscriptqobject.pro b/tests/benchmarks/script/qscriptqobject/qscriptqobject.pro
new file mode 100644
index 0000000..30bc447
--- /dev/null
+++ b/tests/benchmarks/script/qscriptqobject/qscriptqobject.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_bench_qscriptqobject
+
+SOURCES += tst_qscriptqobject.cpp
+
+QT += script
diff --git a/tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp b/tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp
new file mode 100644
index 0000000..e68db06
--- /dev/null
+++ b/tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp
@@ -0,0 +1,1237 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtGui>
+#include <QtScript>
+
+#define ITERATION_COUNT 1e4
+
+struct CustomType
+{
+ int a;
+};
+Q_DECLARE_METATYPE(CustomType)
+
+class PropertyTestObject : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(EnumType)
+ Q_FLAGS(FlagsType)
+ Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty)
+ Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty)
+ Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty)
+ Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty)
+ Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty)
+ Q_PROPERTY(QObject* qobjectProperty READ qobjectProperty WRITE setQObjectProperty)
+ Q_PROPERTY(CustomType customProperty READ customProperty WRITE setCustomProperty)
+ Q_PROPERTY(EnumType enumProperty READ enumProperty WRITE setEnumProperty)
+ Q_PROPERTY(FlagsType flagsProperty READ flagsProperty WRITE setFlagsProperty)
+public:
+ enum EnumType {
+ NoEnumValue = 0,
+ FirstEnumValue = 1,
+ SecondEnumValue = 2,
+ ThirdEnumValue = 4
+ };
+ Q_DECLARE_FLAGS(FlagsType, EnumType)
+
+ PropertyTestObject(QObject *parent = 0)
+ : QObject(parent),
+ m_boolProperty(false),
+ m_intProperty(123),
+ m_doubleProperty(123),
+ m_stringProperty("hello"),
+ m_variantProperty(double(123)),
+ m_qobjectProperty(this),
+ m_enumProperty(SecondEnumValue),
+ m_flagsProperty(FirstEnumValue | ThirdEnumValue)
+ { }
+
+ bool boolProperty() const
+ { return m_boolProperty; }
+ void setBoolProperty(bool value)
+ { m_boolProperty = value; }
+
+ int intProperty() const
+ { return m_intProperty; }
+ void setIntProperty(int value)
+ { m_intProperty = value; }
+
+ int doubleProperty() const
+ { return m_doubleProperty; }
+ void setDoubleProperty(double value)
+ { m_doubleProperty = value; }
+
+ QString stringProperty() const
+ { return m_stringProperty; }
+ void setStringProperty(const QString &value)
+ { m_stringProperty = value; }
+
+ QVariant variantProperty() const
+ { return m_variantProperty; }
+ void setVariantProperty(const QVariant &value)
+ { m_variantProperty = value; }
+
+ QObject *qobjectProperty() const
+ { return m_qobjectProperty; }
+ void setQObjectProperty(QObject *qobject)
+ { m_qobjectProperty = qobject; }
+
+ CustomType customProperty() const
+ { return m_customProperty; }
+ void setCustomProperty(const CustomType &value)
+ { m_customProperty = value; }
+
+ EnumType enumProperty() const
+ { return m_enumProperty; }
+ void setEnumProperty(EnumType value)
+ { m_enumProperty = value; }
+
+ FlagsType flagsProperty() const
+ { return m_flagsProperty; }
+ void setFlagsProperty(FlagsType value)
+ { m_flagsProperty = value; }
+
+private:
+ bool m_boolProperty;
+ int m_intProperty;
+ double m_doubleProperty;
+ QString m_stringProperty;
+ QVariant m_variantProperty;
+ QObject *m_qobjectProperty;
+ CustomType m_customProperty;
+ EnumType m_enumProperty;
+ FlagsType m_flagsProperty;
+};
+
+class SlotTestObject : public QObject
+{
+ Q_OBJECT
+public:
+ SlotTestObject(QObject *parent = 0)
+ : QObject(parent),
+ m_string(QString::fromLatin1("hello")),
+ m_variant(123)
+ { }
+
+public Q_SLOTS:
+ void voidSlot() { }
+ void boolSlot(bool) { }
+ void intSlot(int) { }
+ void doubleSlot(double) { }
+ void stringSlot(const QString &) { }
+ void variantSlot(const QVariant &) { }
+ void qobjectSlot(QObject *) { }
+ void customTypeSlot(const CustomType &) { }
+
+ bool returnBoolSlot() { return true; }
+ int returnIntSlot() { return 123; }
+ double returnDoubleSlot() { return 123.0; }
+ QString returnStringSlot() { return m_string; }
+ QVariant returnVariantSlot() { return m_variant; }
+ QObject *returnQObjectSlot() { return this; }
+ CustomType returnCustomTypeSlot() { return m_custom; }
+
+ void fourDoubleSlot(double, double, double, double) { }
+ void sixDoubleSlot(double, double, double, double, double, double) { }
+ void eightDoubleSlot(double, double, double, double, double, double, double, double) { }
+
+ void fourStringSlot(const QString &, const QString &, const QString &, const QString &) { }
+ void sixStringSlot(const QString &, const QString &, const QString &, const QString &,
+ const QString &, const QString &) { }
+ void eightStringSlot(const QString &, const QString &, const QString &, const QString &,
+ const QString &, const QString &, const QString &, const QString &) { }
+
+private:
+ QString m_string;
+ QVariant m_variant;
+ CustomType m_custom;
+};
+
+class SignalTestObject : public QObject
+{
+ Q_OBJECT
+public:
+ SignalTestObject(QObject *parent = 0)
+ : QObject(parent)
+ { }
+
+ void emitVoidSignal()
+ { emit voidSignal(); }
+ void emitBoolSignal(bool value)
+ { emit boolSignal(value); }
+ void emitIntSignal(int value)
+ { emit intSignal(value); }
+ void emitDoubleSignal(double value)
+ { emit doubleSignal(value); }
+ void emitStringSignal(const QString &value)
+ { emit stringSignal(value); }
+ void emitVariantSignal(const QVariant &value)
+ { emit variantSignal(value); }
+ void emitQObjectSignal(QObject *object)
+ { emit qobjectSignal(object); }
+ void emitCustomTypeSignal(const CustomType &value)
+ { emit customTypeSignal(value); }
+
+Q_SIGNALS:
+ void voidSignal();
+ void boolSignal(bool);
+ void intSignal(int);
+ void doubleSignal(double);
+ void stringSignal(const QString &);
+ void variantSignal(const QVariant &);
+ void qobjectSignal(QObject *);
+ void customTypeSignal(const CustomType &);
+};
+
+class OverloadedSlotTestObject : public QObject
+{
+ Q_OBJECT
+public:
+ OverloadedSlotTestObject(QObject *parent = 0)
+ : QObject(parent)
+ { }
+
+public Q_SLOTS:
+ void overloadedSlot() { }
+ void overloadedSlot(bool) { }
+ void overloadedSlot(double) { }
+ void overloadedSlot(const QString &) { }
+};
+
+class QtScriptablePropertyTestObject
+ : public PropertyTestObject, public QScriptable
+{
+};
+
+class QtScriptableSlotTestObject
+ : public SlotTestObject, public QScriptable
+{
+};
+
+class tst_QScriptQObject : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QScriptQObject();
+ virtual ~tst_QScriptQObject();
+
+private slots:
+ void initTestCase();
+
+ void readMetaProperty_data();
+ void readMetaProperty();
+
+ void writeMetaProperty_data();
+ void writeMetaProperty();
+
+ void readDynamicProperty_data();
+ void readDynamicProperty();
+
+ void writeDynamicProperty_data();
+ void writeDynamicProperty();
+
+ void readMethodByName_data();
+ void readMethodByName();
+
+ void readMethodBySignature_data();
+ void readMethodBySignature();
+
+ void readChild_data();
+ void readChild();
+
+ void readOneOfManyChildren_data();
+ void readOneOfManyChildren();
+
+ void readPrototypeProperty_data();
+ void readPrototypeProperty();
+
+ void readScriptProperty_data();
+ void readScriptProperty();
+
+ void readNoSuchProperty_data();
+ void readNoSuchProperty();
+
+ void readAllMetaProperties();
+
+ void callSlot_data();
+ void callSlot();
+
+ void callOverloadedSlot_data();
+ void callOverloadedSlot();
+
+ void voidSignalHandler();
+ void boolSignalHandler();
+ void intSignalHandler();
+ void doubleSignalHandler();
+ void stringSignalHandler();
+ void variantSignalHandler();
+ void qobjectSignalHandler();
+ void customTypeSignalHandler();
+
+ void readButtonMetaProperty_data();
+ void readButtonMetaProperty();
+
+ void writeButtonMetaProperty_data();
+ void writeButtonMetaProperty();
+
+ void readDynamicButtonProperty_data();
+ void readDynamicButtonProperty();
+
+ void writeDynamicButtonProperty_data();
+ void writeDynamicButtonProperty();
+
+ void readButtonMethodByName_data();
+ void readButtonMethodByName();
+
+ void readButtonMethodBySignature_data();
+ void readButtonMethodBySignature();
+
+ void readButtonChild_data();
+ void readButtonChild();
+
+ void readButtonPrototypeProperty_data();
+ void readButtonPrototypeProperty();
+
+ void readButtonScriptProperty_data();
+ void readButtonScriptProperty();
+
+ void readNoSuchButtonProperty_data();
+ void readNoSuchButtonProperty();
+
+ void callButtonMethod_data();
+ void callButtonMethod();
+
+ void readAllButtonMetaProperties();
+
+ void readQScriptableMetaProperty_data();
+ void readQScriptableMetaProperty();
+
+ void writeQScriptableMetaProperty_data();
+ void writeQScriptableMetaProperty();
+
+ void callQScriptableSlot_data();
+ void callQScriptableSlot();
+
+private:
+ void readMetaProperty_dataHelper(const QMetaObject *mo);
+ void readMethodByName_dataHelper(const QMetaObject *mo);
+ void readMethodBySignature_dataHelper(const QMetaObject *mo);
+ void readAllMetaPropertiesHelper(QObject *o);
+
+ void readPropertyHelper(QScriptEngine &engine, const QScriptValue &object,
+ const QString &propertyName, const QString &argTemplate = ".%0");
+ void writePropertyHelper(QScriptEngine &engine, const QScriptValue &object,
+ const QString &propertyName, const QScriptValue &value,
+ const QString &argTemplate = ".%0");
+
+ void callMethodHelper(QScriptEngine &engine, QObject *object,
+ const QString &propertyName, const QString &arguments);
+ void signalHandlerHelper(QScriptEngine &engine, QObject *object, const char *signal);
+};
+
+tst_QScriptQObject::tst_QScriptQObject()
+{
+}
+
+tst_QScriptQObject::~tst_QScriptQObject()
+{
+}
+
+void tst_QScriptQObject::initTestCase()
+{
+ qMetaTypeId<CustomType>();
+}
+
+void tst_QScriptQObject::readMetaProperty_dataHelper(const QMetaObject *mo)
+{
+ QTest::addColumn<QString>("propertyName");
+
+ for (int i = 0; i < mo->propertyCount(); ++i) {
+ QMetaProperty prop = mo->property(i);
+ if (!qstrcmp(prop.name(), "default"))
+ continue; // skip reserved word
+ QTest::newRow(prop.name()) << prop.name();
+ }
+}
+
+void tst_QScriptQObject::readMethodByName_dataHelper(const QMetaObject *mo)
+{
+ QTest::addColumn<QString>("propertyName");
+
+ QSet<QByteArray> uniqueNames;
+ for (int i = 0; i < mo->methodCount(); ++i) {
+ QMetaMethod method = mo->method(i);
+ if (method.access() == QMetaMethod::Private)
+ continue;
+ QByteArray signature = method.signature();
+ QByteArray name = signature.left(signature.indexOf('('));
+ if (uniqueNames.contains(name))
+ continue;
+ QTest::newRow(name) << QString::fromLatin1(name);
+ uniqueNames.insert(name);
+ }
+}
+
+void tst_QScriptQObject::readMethodBySignature_dataHelper(const QMetaObject *mo)
+{
+ QTest::addColumn<QString>("propertyName");
+
+ for (int i = 0; i < mo->methodCount(); ++i) {
+ QMetaMethod method = mo->method(i);
+ if (method.access() == QMetaMethod::Private)
+ continue;
+ QTest::newRow(method.signature()) << QString::fromLatin1(method.signature());
+ }
+}
+
+void tst_QScriptQObject::readAllMetaPropertiesHelper(QObject *o)
+{
+ QString code = QString::fromLatin1(
+ "(function() {\n"
+ " for (var i = 0; i < 100; ++i) {\n");
+ const QMetaObject *mo = o->metaObject();
+ for (int i = 0; i < mo->propertyCount(); ++i) {
+ QMetaProperty prop = mo->property(i);
+ if (!qstrcmp(prop.name(), "default"))
+ continue; // skip reserved word
+ code.append(QString::fromLatin1(" this.%0;\n").arg(prop.name()));
+ }
+ code.append(
+ " }\n"
+ "})");
+
+ QScriptEngine engine;
+ QScriptValue fun = engine.evaluate(code);
+ QVERIFY(fun.isFunction());
+
+ QScriptValue wrapper = engine.newQObject(o);
+ QBENCHMARK {
+ fun.call(wrapper);
+ }
+ QVERIFY(!engine.hasUncaughtException());
+}
+
+void tst_QScriptQObject::readPropertyHelper(
+ QScriptEngine &engine, const QScriptValue &object,
+ const QString &propertyName, const QString &argTemplate)
+{
+ QString code = QString::fromLatin1(
+ "(function() {\n"
+ " for (var i = 0; i < %0; ++i)\n"
+ " this%1;\n"
+ "})").arg(ITERATION_COUNT).arg(argTemplate.arg(propertyName));
+ QScriptValue fun = engine.evaluate(code);
+ QVERIFY(fun.isFunction());
+
+ QBENCHMARK {
+ fun.call(object);
+ }
+ QVERIFY(!engine.hasUncaughtException());
+}
+
+void tst_QScriptQObject::writePropertyHelper(
+ QScriptEngine &engine, const QScriptValue &object,
+ const QString &propertyName, const QScriptValue &value,
+ const QString &argTemplate)
+{
+ QVERIFY(value.isValid());
+ QString code = QString::fromLatin1(
+ "(function(v) {\n"
+ " for (var i = 0; i < %0; ++i)\n"
+ " this%1 = v;\n"
+ "})").arg(ITERATION_COUNT).arg(argTemplate.arg(propertyName));
+ QScriptValue fun = engine.evaluate(code);
+ QVERIFY(fun.isFunction());
+
+ QScriptValueList args;
+ args << value;
+ QBENCHMARK {
+ fun.call(object, args);
+ }
+ QVERIFY(!engine.hasUncaughtException());
+}
+
+void tst_QScriptQObject::callMethodHelper(
+ QScriptEngine &engine, QObject *object,
+ const QString &propertyName, const QString &arguments)
+{
+ QScriptValue wrapper = engine.newQObject(object);
+ QScriptValue method = wrapper.property(propertyName);
+ QVERIFY(method.isFunction());
+
+ // Generate code that calls the function directly; in this way
+ // only function call performance is measured, not function lookup
+ // as well.
+ QString code = QString::fromLatin1(
+ "(function(f) {\n"
+ " for (var i = 0; i < %0; ++i)\n"
+ " f(%1);\n"
+ "})").arg(ITERATION_COUNT).arg(arguments);
+ QScriptValue fun = engine.evaluate(code);
+ QVERIFY(fun.isFunction());
+
+ QScriptValueList args;
+ args << method;
+ QBENCHMARK {
+ fun.call(wrapper, args);
+ }
+ QVERIFY(!engine.hasUncaughtException());
+}
+
+void tst_QScriptQObject::signalHandlerHelper(
+ QScriptEngine &engine, QObject *object, const char *signal)
+{
+ QScriptValue handler = engine.evaluate("(function(a) { return a; })");
+ QVERIFY(handler.isFunction());
+ QVERIFY(qScriptConnect(object, signal, QScriptValue(), handler));
+}
+
+void tst_QScriptQObject::readMetaProperty_data()
+{
+ readMetaProperty_dataHelper(&PropertyTestObject::staticMetaObject);
+}
+
+// Reads a meta-object-defined property from JS. The purpose of this
+// benchmark is to measure the overhead of reading a property from JS
+// compared to calling the property getter directly from C++ without
+// introspection or value conversion (that's the fastest we could
+// possibly hope to get).
+void tst_QScriptQObject::readMetaProperty()
+{
+ QFETCH(QString, propertyName);
+
+ QScriptEngine engine;
+ PropertyTestObject testObject;
+ readPropertyHelper(engine, engine.newQObject(&testObject), propertyName);
+}
+
+void tst_QScriptQObject::writeMetaProperty_data()
+{
+ readMetaProperty_data();
+}
+
+// Writes a meta-object-defined property from JS. The purpose of this
+// benchmark is to measure the overhead of writing a property from JS
+// compared to calling the property setter directly from C++ without
+// introspection or value conversion (that's the fastest we could
+// possibly hope to get).
+void tst_QScriptQObject::writeMetaProperty()
+{
+ QFETCH(QString, propertyName);
+
+ QScriptEngine engine;
+ PropertyTestObject testObject;
+ QScriptValue wrapper = engine.newQObject(&testObject);
+ QScriptValue value = wrapper.property(propertyName);
+ writePropertyHelper(engine, wrapper, propertyName, value);
+}
+
+void tst_QScriptQObject::readDynamicProperty_data()
+{
+ QTest::addColumn<QVariant>("value");
+
+ QTest::newRow("bool") << QVariant(false);
+ QTest::newRow("int") << QVariant(123);
+ QTest::newRow("double") << QVariant(double(123.0));
+ QTest::newRow("string") << QVariant(QString::fromLatin1("hello"));
+ QTest::newRow("QObject*") << qVariantFromValue((QObject*)this);
+ QTest::newRow("CustomType") << qVariantFromValue(CustomType());
+}
+
+// Reads a dynamic property from JS. The purpose of this benchmark is
+// to measure the overhead of reading a dynamic property from JS
+// versus calling QObject::property(aDynamicProperty) directly from
+// C++.
+void tst_QScriptQObject::readDynamicProperty()
+{
+ QFETCH(QVariant, value);
+
+ QObject testObject;
+ const char *propertyName = "dynamicProperty";
+ testObject.setProperty(propertyName, value);
+ QVERIFY(testObject.dynamicPropertyNames().contains(propertyName));
+
+ QScriptEngine engine;
+ readPropertyHelper(engine, engine.newQObject(&testObject), propertyName);
+}
+
+void tst_QScriptQObject::writeDynamicProperty_data()
+{
+ readDynamicProperty_data();
+}
+
+// Writes an existing dynamic property from JS. The purpose of this
+// benchmark is to measure the overhead of writing a dynamic property
+// from JS versus calling QObject::setProperty(aDynamicProperty,
+// aVariant) directly from C++.
+void tst_QScriptQObject::writeDynamicProperty()
+{
+ QFETCH(QVariant, value);
+
+ QObject testObject;
+ const char *propertyName = "dynamicProperty";
+ testObject.setProperty(propertyName, value);
+ QVERIFY(testObject.dynamicPropertyNames().contains(propertyName));
+
+ QScriptEngine engine;
+ writePropertyHelper(engine, engine.newQObject(&testObject), propertyName,
+ qScriptValueFromValue(&engine, value));
+}
+
+void tst_QScriptQObject::readMethodByName_data()
+{
+ readMethodByName_dataHelper(&SlotTestObject::staticMetaObject);
+}
+
+// Reads a meta-object-defined method from JS by name. The purpose of
+// this benchmark is to measure the overhead of resolving a method
+// from JS (effectively, creating and returning a JS wrapper function
+// object for a C++ method).
+void tst_QScriptQObject::readMethodByName()
+{
+ readMetaProperty();
+}
+
+void tst_QScriptQObject::readMethodBySignature_data()
+{
+ readMethodBySignature_dataHelper(&SlotTestObject::staticMetaObject);
+}
+
+// Reads a meta-object-defined method from JS by signature. The
+// purpose of this benchmark is to measure the overhead of resolving a
+// method from JS (effectively, creating and returning a JS wrapper
+// function object for a C++ method).
+void tst_QScriptQObject::readMethodBySignature()
+{
+ QFETCH(QString, propertyName);
+
+ QScriptEngine engine;
+ SlotTestObject testObject;
+ readPropertyHelper(engine, engine.newQObject(&testObject), propertyName, "['%0']");
+}
+
+void tst_QScriptQObject::readChild_data()
+{
+ QTest::addColumn<QString>("propertyName");
+
+ QTest::newRow("child") << "child";
+}
+
+// Reads a child object from JS. The purpose of this benchmark is to
+// measure the overhead of reading a child object from JS compared to
+// calling e.g. qFindChild() directly from C++, when the test object
+// is a plain QObject with only one child.
+void tst_QScriptQObject::readChild()
+{
+ QFETCH(QString, propertyName);
+
+ QScriptEngine engine;
+ QObject testObject;
+ QObject *child = new QObject(&testObject);
+ child->setObjectName(propertyName);
+ readPropertyHelper(engine, engine.newQObject(&testObject), propertyName);
+}
+
+void tst_QScriptQObject::readOneOfManyChildren_data()
+{
+ QTest::addColumn<QString>("propertyName");
+
+ QTest::newRow("child0") << "child0";
+ QTest::newRow("child50") << "child50";
+ QTest::newRow("child99") << "child99";
+}
+
+// Reads a child object from JS for an object that has many
+// children. The purpose of this benchmark is to measure the overhead
+// of reading a child object from JS compared to calling
+// e.g. qFindChild() directly from C++.
+void tst_QScriptQObject::readOneOfManyChildren()
+{
+ QFETCH(QString, propertyName);
+
+ QScriptEngine engine;
+ QObject testObject;
+ for (int i = 0; i < 100; ++i) {
+ QObject *child = new QObject(&testObject);
+ child->setObjectName(QString::fromLatin1("child%0").arg(i));
+ }
+ readPropertyHelper(engine, engine.newQObject(&testObject), propertyName);
+}
+
+void tst_QScriptQObject::readPrototypeProperty_data()
+{
+ QTest::addColumn<QString>("propertyName");
+
+ // Inherited from Object.prototype.
+ QTest::newRow("hasOwnProperty") << "hasOwnProperty";
+ QTest::newRow("isPrototypeOf") << "isPrototypeOf";
+ QTest::newRow("propertyIsEnumerable") << "propertyIsEnumerable";
+ QTest::newRow("valueOf") << "valueOf";
+}
+
+// Reads a property that's inherited from a prototype object. The
+// purpose of this benchmark is to measure the overhead of resolving a
+// prototype property (i.e., how long it takes the binding to
+// determine that the QObject doesn't have the property itself).
+void tst_QScriptQObject::readPrototypeProperty()
+{
+ QFETCH(QString, propertyName);
+
+ QScriptEngine engine;
+ PropertyTestObject testObject;
+ readPropertyHelper(engine, engine.newQObject(&testObject), propertyName);
+}
+
+void tst_QScriptQObject::readScriptProperty_data()
+{
+ QTest::addColumn<QString>("propertyName");
+
+ QTest::newRow("scriptProperty") << "scriptProperty";
+}
+
+// Reads a JS (non-Qt) property of a wrapper object. The purpose of
+// this benchmark is to measure the overhead of reading a property
+// that only exists on the wrapper object, not on the underlying
+// QObject.
+void tst_QScriptQObject::readScriptProperty()
+{
+ QFETCH(QString, propertyName);
+
+ QScriptEngine engine;
+ PropertyTestObject testObject;
+ QScriptValue wrapper = engine.newQObject(&testObject);
+ wrapper.setProperty(propertyName, 123);
+ QVERIFY(wrapper.property(propertyName).isValid());
+ QVERIFY(!testObject.property(propertyName.toLatin1()).isValid());
+
+ readPropertyHelper(engine, wrapper, propertyName);
+}
+
+void tst_QScriptQObject::readNoSuchProperty_data()
+{
+ QTest::addColumn<QString>("propertyName");
+
+ QTest::newRow("noSuchProperty") << "noSuchProperty";
+}
+
+// Reads a non-existing (undefined) property of a wrapper object. The
+// purpose of this benchmark is to measure the overhead of reading a
+// property that doesn't exist (i.e., how long it takes the binding to
+// determine this).
+void tst_QScriptQObject::readNoSuchProperty()
+{
+ readMetaProperty();
+}
+
+// Reads all meta-object-defined properties from JS. The purpose of
+// this benchmark is to measure the overhead of reading different
+// properties in sequence, not just the same one repeatedly (like
+// readMetaProperty() does).
+void tst_QScriptQObject::readAllMetaProperties()
+{
+ PropertyTestObject testObject;
+ readAllMetaPropertiesHelper(&testObject);
+}
+
+void tst_QScriptQObject::callSlot_data()
+{
+ QTest::addColumn<QString>("propertyName");
+ QTest::addColumn<QString>("arguments");
+
+ QTest::newRow("voidSlot()") << "voidSlot" << "";
+
+ QTest::newRow("boolSlot(true)") << "boolSlot" << "true";
+ QTest::newRow("intSlot(123)") << "intSlot" << "123";
+ QTest::newRow("doubleSlot(123)") << "doubleSlot" << "123";
+ QTest::newRow("stringSlot('hello')") << "stringSlot" << "'hello'";
+ QTest::newRow("variantSlot(123)") << "variantSlot" << "123";
+ QTest::newRow("qobjectSlot(this)") << "qobjectSlot" << "this"; // assumes 'this' is a QObject
+
+ QTest::newRow("returnBoolSlot()") << "returnBoolSlot" << "";
+ QTest::newRow("returnIntSlot()") << "returnIntSlot" << "";
+ QTest::newRow("returnDoubleSlot()") << "returnDoubleSlot" << "";
+ QTest::newRow("returnStringSlot()") << "returnStringSlot" << "";
+ QTest::newRow("returnVariantSlot()") << "returnVariantSlot" << "";
+ QTest::newRow("returnQObjectSlot()") << "returnQObjectSlot" << "";
+ QTest::newRow("returnCustomTypeSlot()") << "returnCustomTypeSlot" << "";
+
+ // Implicit conversion.
+ QTest::newRow("boolSlot(0)") << "boolSlot" << "0";
+ QTest::newRow("intSlot('123')") << "intSlot" << "'123'";
+ QTest::newRow("doubleSlot('123')") << "doubleSlot" << "'123'";
+ QTest::newRow("stringSlot(123)") << "stringSlot" << "123";
+
+ // Many arguments.
+ QTest::newRow("fourDoubleSlot(1,2,3,4)") << "fourDoubleSlot" << "1,2,3,4";
+ QTest::newRow("sixDoubleSlot(1,2,3,4,5,6)") << "sixDoubleSlot" << "1,2,3,4,5,6";
+ QTest::newRow("eightDoubleSlot(1,2,3,4,5,6,7,8)") << "eightDoubleSlot" << "1,2,3,4,5,6,7,8";
+
+ QTest::newRow("fourStringSlot('a','b','c','d')") << "fourStringSlot" << "'a','b','c','d'";
+ QTest::newRow("sixStringSlot('a','b','c','d','e','f')") << "sixStringSlot" << "'a','b','c','d','e','f'";
+ QTest::newRow("eightStringSlot('a','b','c','d','e','f','g','h')") << "eightStringSlot" << "'a','b','c','d','e','f','g','h'";
+}
+
+// Calls a slot from JS. The purpose of this benchmark is to measure
+// the overhead of calling a slot from JS compared to calling the slot
+// directly from C++ without introspection or value conversion (that's
+// the fastest we could possibly hope to get). The slots themselves
+// don't do any work.
+void tst_QScriptQObject::callSlot()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(QString, arguments);
+
+ QScriptEngine engine;
+ SlotTestObject testObject;
+ callMethodHelper(engine, &testObject, propertyName, arguments);
+}
+
+void tst_QScriptQObject::callOverloadedSlot_data()
+{
+ QTest::addColumn<QString>("propertyName");
+ QTest::addColumn<QString>("arguments");
+
+ QTest::newRow("overloadedSlot()") << "overloadedSlot" << "";
+ QTest::newRow("overloadedSlot(true)") << "overloadedSlot" << "true";
+ QTest::newRow("overloadedSlot(123)") << "overloadedSlot" << "123";
+ QTest::newRow("overloadedSlot('hello')") << "overloadedSlot" << "'hello'";
+}
+
+// Calls an overloaded slot from JS. The purpose of this benchmark is
+// to measure the overhead of calling an overloaded slot from JS
+// compared to calling the overloaded slot directly from C++ without
+// introspection or value conversion (that's the fastest we could
+// possibly hope to get).
+void tst_QScriptQObject::callOverloadedSlot()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(QString, arguments);
+
+ QScriptEngine engine;
+ OverloadedSlotTestObject testObject;
+ callMethodHelper(engine, &testObject, propertyName, arguments);
+}
+
+// Benchmarks for JS signal handling. The purpose of these benchmarks
+// is to measure the overhead of dispatching a Qt signal to JS code
+// compared to a normal C++ signal-to-slot dispatch.
+
+void tst_QScriptQObject::voidSignalHandler()
+{
+ SignalTestObject testObject;
+ QScriptEngine engine;
+ signalHandlerHelper(engine, &testObject, SIGNAL(voidSignal()));
+ QBENCHMARK {
+ for (int i = 0; i < ITERATION_COUNT; ++i)
+ testObject.emitVoidSignal();
+ }
+}
+
+void tst_QScriptQObject::boolSignalHandler()
+{
+ SignalTestObject testObject;
+ QScriptEngine engine;
+ signalHandlerHelper(engine, &testObject, SIGNAL(boolSignal(bool)));
+ QBENCHMARK {
+ for (int i = 0; i < ITERATION_COUNT; ++i)
+ testObject.emitBoolSignal(true);
+ }
+}
+
+void tst_QScriptQObject::intSignalHandler()
+{
+ SignalTestObject testObject;
+ QScriptEngine engine;
+ signalHandlerHelper(engine, &testObject, SIGNAL(intSignal(int)));
+ QBENCHMARK {
+ for (int i = 0; i < ITERATION_COUNT; ++i)
+ testObject.emitIntSignal(123);
+ }
+}
+
+void tst_QScriptQObject::doubleSignalHandler()
+{
+ SignalTestObject testObject;
+ QScriptEngine engine;
+ signalHandlerHelper(engine, &testObject, SIGNAL(doubleSignal(double)));
+ QBENCHMARK {
+ for (int i = 0; i < ITERATION_COUNT; ++i)
+ testObject.emitDoubleSignal(123.0);
+ }
+}
+
+void tst_QScriptQObject::stringSignalHandler()
+{
+ SignalTestObject testObject;
+ QScriptEngine engine;
+ signalHandlerHelper(engine, &testObject, SIGNAL(stringSignal(QString)));
+ QString value = QString::fromLatin1("hello");
+ QBENCHMARK {
+ for (int i = 0; i < ITERATION_COUNT; ++i)
+ testObject.emitStringSignal(value);
+ }
+}
+
+void tst_QScriptQObject::variantSignalHandler()
+{
+ SignalTestObject testObject;
+ QScriptEngine engine;
+ signalHandlerHelper(engine, &testObject, SIGNAL(variantSignal(QVariant)));
+ QVariant value = 123;
+ QBENCHMARK {
+ for (int i = 0; i < ITERATION_COUNT; ++i)
+ testObject.emitVariantSignal(value);
+ }
+}
+
+void tst_QScriptQObject::qobjectSignalHandler()
+{
+ SignalTestObject testObject;
+ QScriptEngine engine;
+ signalHandlerHelper(engine, &testObject, SIGNAL(qobjectSignal(QObject*)));
+ QBENCHMARK {
+ for (int i = 0; i < ITERATION_COUNT; ++i)
+ testObject.emitQObjectSignal(this);
+ }
+}
+
+void tst_QScriptQObject::customTypeSignalHandler()
+{
+ SignalTestObject testObject;
+ QScriptEngine engine;
+ signalHandlerHelper(engine, &testObject, SIGNAL(customTypeSignal(CustomType)));
+ CustomType value;
+ QBENCHMARK {
+ for (int i = 0; i < ITERATION_COUNT; ++i)
+ testObject.emitCustomTypeSignal(value);
+ }
+}
+
+void tst_QScriptQObject::readButtonMetaProperty_data()
+{
+ readMetaProperty_dataHelper(&QPushButton::staticMetaObject);
+}
+
+// Reads a meta-object-defined property from JS. The purpose of this
+// benchmark is to measure the overhead of reading a property from JS
+// compared to calling the property getter directly from C++ without
+// introspection or value conversion (that's the fastest we could
+// possibly hope to get).
+void tst_QScriptQObject::readButtonMetaProperty()
+{
+ QFETCH(QString, propertyName);
+
+ QScriptEngine engine;
+ QPushButton pb;
+ readPropertyHelper(engine, engine.newQObject(&pb), propertyName);
+}
+
+void tst_QScriptQObject::writeButtonMetaProperty_data()
+{
+ readButtonMetaProperty_data();
+}
+
+// Writes a meta-object-defined property from JS. The purpose of this
+// benchmark is to measure the overhead of writing a property from JS
+// compared to calling the property setter directly from C++ without
+// introspection or value conversion (that's the fastest we could
+// possibly hope to get).
+void tst_QScriptQObject::writeButtonMetaProperty()
+{
+ QFETCH(QString, propertyName);
+
+ QScriptEngine engine;
+ QPushButton pb;
+ QVariant value = pb.property(propertyName.toLatin1());
+ writePropertyHelper(engine, engine.newQObject(&pb), propertyName,
+ qScriptValueFromValue(&engine, value));
+}
+
+void tst_QScriptQObject::readDynamicButtonProperty_data()
+{
+ readDynamicProperty_data();
+}
+
+// Reads a dynamic property from JS. The purpose of this benchmark is
+// to measure the overhead of reading a dynamic property from JS
+// versus calling QObject::property(aDynamicProperty) directly from
+// C++.
+void tst_QScriptQObject::readDynamicButtonProperty()
+{
+ QFETCH(QVariant, value);
+
+ QPushButton pb;
+ const char *propertyName = "dynamicProperty";
+ pb.setProperty(propertyName, value);
+ QVERIFY(pb.dynamicPropertyNames().contains(propertyName));
+
+ QScriptEngine engine;
+ readPropertyHelper(engine, engine.newQObject(&pb), propertyName);
+}
+
+void tst_QScriptQObject::writeDynamicButtonProperty_data()
+{
+ readDynamicButtonProperty_data();
+}
+
+// Writes an existing dynamic property from JS. The purpose of this
+// benchmark is to measure the overhead of writing a dynamic property
+// from JS versus calling QObject::setProperty(aDynamicProperty,
+// aVariant) directly from C++.
+void tst_QScriptQObject::writeDynamicButtonProperty()
+{
+ QFETCH(QVariant, value);
+
+ QPushButton pb;
+ const char *propertyName = "dynamicProperty";
+ pb.setProperty(propertyName, value);
+ QVERIFY(pb.dynamicPropertyNames().contains(propertyName));
+
+ QScriptEngine engine;
+ writePropertyHelper(engine, engine.newQObject(&pb), propertyName,
+ qScriptValueFromValue(&engine, value));
+}
+
+void tst_QScriptQObject::readButtonMethodByName_data()
+{
+ readMethodByName_dataHelper(&QPushButton::staticMetaObject);
+}
+
+// Reads a meta-object-defined method from JS by name. The purpose of
+// this benchmark is to measure the overhead of resolving a method
+// from JS (effectively, creating and returning a JS wrapper function
+// object for a C++ method).
+void tst_QScriptQObject::readButtonMethodByName()
+{
+ readButtonMetaProperty();
+}
+
+void tst_QScriptQObject::readButtonMethodBySignature_data()
+{
+ readMethodBySignature_dataHelper(&QPushButton::staticMetaObject);
+}
+
+// Reads a meta-object-defined method from JS by signature. The
+// purpose of this benchmark is to measure the overhead of resolving a
+// method from JS (effectively, creating and returning a JS wrapper
+// function object for a C++ method).
+void tst_QScriptQObject::readButtonMethodBySignature()
+{
+ QFETCH(QString, propertyName);
+
+ QScriptEngine engine;
+ QPushButton pb;
+ readPropertyHelper(engine, engine.newQObject(&pb), propertyName, "['%0']");
+}
+
+void tst_QScriptQObject::readButtonChild_data()
+{
+ QTest::addColumn<QString>("propertyName");
+
+ QTest::newRow("child") << "child";
+}
+
+// Reads a child object from JS. The purpose of this benchmark is to
+// measure the overhead of reading a child object from JS compared to
+// calling e.g. qFindChild() directly from C++.
+void tst_QScriptQObject::readButtonChild()
+{
+ QFETCH(QString, propertyName);
+
+ QScriptEngine engine;
+ QPushButton pb;
+ QObject *child = new QObject(&pb);
+ child->setObjectName(propertyName);
+ readPropertyHelper(engine, engine.newQObject(&pb), propertyName);
+}
+
+void tst_QScriptQObject::readButtonPrototypeProperty_data()
+{
+ readPrototypeProperty_data();
+}
+
+// Reads a property that's inherited from a prototype object. The
+// purpose of this benchmark is to measure the overhead of resolving a
+// prototype property (i.e., how long does it take the binding to
+// determine that the QObject doesn't have the property itself).
+void tst_QScriptQObject::readButtonPrototypeProperty()
+{
+ QFETCH(QString, propertyName);
+
+ QScriptEngine engine;
+ QPushButton pb;
+ readPropertyHelper(engine, engine.newQObject(&pb), propertyName);
+}
+
+void tst_QScriptQObject::readButtonScriptProperty_data()
+{
+ readScriptProperty_data();
+}
+
+// Reads a JS (non-Qt) property of a wrapper object. The purpose of
+// this benchmark is to measure the overhead of reading a property
+// that only exists on the wrapper object, not on the underlying
+// QObject.
+void tst_QScriptQObject::readButtonScriptProperty()
+{
+ QFETCH(QString, propertyName);
+
+ QScriptEngine engine;
+ QPushButton pb;
+ QScriptValue wrapper = engine.newQObject(&pb);
+ wrapper.setProperty(propertyName, 123);
+ QVERIFY(wrapper.property(propertyName).isValid());
+ QVERIFY(!pb.property(propertyName.toLatin1()).isValid());
+
+ readPropertyHelper(engine, wrapper, propertyName);
+}
+
+void tst_QScriptQObject::readNoSuchButtonProperty_data()
+{
+ readNoSuchProperty_data();
+}
+
+// Reads a non-existing (undefined) property of a wrapper object. The
+// purpose of this benchmark is to measure the overhead of reading a
+// property that doesn't exist (i.e., how long does it take the
+// binding to determine that it doesn't exist).
+void tst_QScriptQObject::readNoSuchButtonProperty()
+{
+ readButtonMetaProperty();
+}
+
+void tst_QScriptQObject::callButtonMethod_data()
+{
+ QTest::addColumn<QString>("propertyName");
+ QTest::addColumn<QString>("arguments");
+
+ QTest::newRow("click()") << "click" << "";
+ QTest::newRow("animateClick(50)") << "animateClick" << "10";
+ QTest::newRow("setChecked(true)") << "setChecked" << "true";
+ QTest::newRow("close()") << "close" << "";
+ QTest::newRow("setWindowTitle('foo')") << "setWindowTitle" << "'foo'";
+}
+
+// Calls a slot from JS. The purpose of this benchmark is to measure
+// the overhead of calling a slot from JS compared to calling the slot
+// directly from C++ without introspection or value conversion (that's
+// the fastest we could possibly hope to get).
+void tst_QScriptQObject::callButtonMethod()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(QString, arguments);
+
+ QScriptEngine engine;
+ QPushButton pb;
+ callMethodHelper(engine, &pb, propertyName, arguments);
+}
+
+// Reads all meta-object-defined properties from JS. The purpose of
+// this benchmark is to measure the overhead of reading different
+// properties in sequence, not just the same one repeatedly (like
+// readButtonMetaProperty() does).
+void tst_QScriptQObject::readAllButtonMetaProperties()
+{
+ QPushButton pb;
+ readAllMetaPropertiesHelper(&pb);
+}
+
+void tst_QScriptQObject::readQScriptableMetaProperty_data()
+{
+ readMetaProperty_dataHelper(&QtScriptablePropertyTestObject::staticMetaObject);
+}
+
+// Reads a meta-object-defined property from JS for an object that
+// subclasses QScriptable. The purpose of this benchmark is to measure
+// the overhead compared to reading a property of a non-QScriptable
+// (see readMetaProperty()).
+void tst_QScriptQObject::readQScriptableMetaProperty()
+{
+ QFETCH(QString, propertyName);
+
+ QScriptEngine engine;
+ QtScriptablePropertyTestObject testObject;
+ readPropertyHelper(engine, engine.newQObject(&testObject), propertyName);
+}
+
+void tst_QScriptQObject::writeQScriptableMetaProperty_data()
+{
+ readMetaProperty_data();
+}
+
+// Writes a meta-object-defined property from JS for an object that
+// subclasses QScriptable. The purpose of this benchmark is to measure
+// the overhead compared to writing a property of a non-QScriptable
+// object (see writeMetaProperty()).
+void tst_QScriptQObject::writeQScriptableMetaProperty()
+{
+ QFETCH(QString, propertyName);
+
+ QScriptEngine engine;
+ QtScriptablePropertyTestObject testObject;
+ QVariant value = testObject.property(propertyName.toLatin1());
+ writePropertyHelper(engine, engine.newQObject(&testObject), propertyName,
+ qScriptValueFromValue(&engine, value));
+}
+
+void tst_QScriptQObject::callQScriptableSlot_data()
+{
+ callSlot_data();
+}
+
+// Calls a slot from JS for an object that subclasses QScriptable. The
+// purpose of this benchmark is to measure the overhead compared to
+// calling a slot of a non-QScriptable object (see callSlot()).
+void tst_QScriptQObject::callQScriptableSlot()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(QString, arguments);
+
+ QScriptEngine engine;
+ QtScriptableSlotTestObject testObject;
+ callMethodHelper(engine, &testObject, propertyName, arguments);
+}
+
+QTEST_MAIN(tst_QScriptQObject)
+#include "tst_qscriptqobject.moc"
diff --git a/tests/manual/textrendering/glyphshaping/glyphshaping.pro b/tests/manual/textrendering/glyphshaping/glyphshaping.pro
index caa9028..1d78aa3 100644
--- a/tests/manual/textrendering/glyphshaping/glyphshaping.pro
+++ b/tests/manual/textrendering/glyphshaping/glyphshaping.pro
@@ -1,5 +1,5 @@
SOURCES = main.cpp
OTHER_FILES = glyphshaping_data.xml
glyphshaping_data.path = .
-glyphshaping_data.sources = $$PWD/glyphshaping_data.xml
+glyphshaping_data.files = $$PWD/glyphshaping_data.xml
DEPLOYMENT += glyphshaping_data
diff --git a/tests/shared/filesystem.h b/tests/shared/filesystem.h
index 2d46c0d..079a6dc 100644
--- a/tests/shared/filesystem.h
+++ b/tests/shared/filesystem.h
@@ -48,6 +48,15 @@
#include <QDir>
#include <QFile>
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#include <windows.h>
+#include <winioctl.h>
+#ifndef IO_REPARSE_TAG_MOUNT_POINT
+#define IO_REPARSE_TAG_MOUNT_POINT (0xA0000003L)
+#endif
+#define REPARSE_MOUNTPOINT_HEADER_SIZE 8
+#endif
+
struct FileSystem
{
~FileSystem()
@@ -86,6 +95,59 @@ struct FileSystem
}
return false;
}
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+ static void createNtfsJunction(QString target, QString linkName)
+ {
+ typedef struct {
+ DWORD ReparseTag;
+ DWORD ReparseDataLength;
+ WORD Reserved;
+ WORD ReparseTargetLength;
+ WORD ReparseTargetMaximumLength;
+ WORD Reserved1;
+ WCHAR ReparseTarget[1];
+ } REPARSE_MOUNTPOINT_DATA_BUFFER, *PREPARSE_MOUNTPOINT_DATA_BUFFER;
+
+ char reparseBuffer[MAX_PATH*3];
+ HANDLE hFile;
+ DWORD returnedLength;
+ wchar_t fileSystem[MAX_PATH] = L"";
+ PREPARSE_MOUNTPOINT_DATA_BUFFER reparseInfo = (PREPARSE_MOUNTPOINT_DATA_BUFFER) reparseBuffer;
+
+ QFileInfo junctionInfo(linkName);
+ linkName = QDir::toNativeSeparators(junctionInfo.absoluteFilePath());
+
+ GetVolumeInformationW( (wchar_t*)linkName.left(3).utf16(), NULL, 0, NULL, NULL, NULL,
+ fileSystem, sizeof(fileSystem)/sizeof(WCHAR));
+ if(QString().fromWCharArray(fileSystem) != "NTFS")
+ QSKIP("This seems not to be an NTFS volume. Junctions are not allowed.",SkipSingle);
+
+ if (!target.startsWith("\\??\\") && !target.startsWith("\\\\?\\")) {
+ QFileInfo targetInfo(target);
+ target = QDir::toNativeSeparators(targetInfo.absoluteFilePath());
+ target.prepend("\\??\\");
+ if(target.endsWith('\\') && target.at(target.length()-2) != ':')
+ target.chop(1);
+ }
+ QDir().mkdir(linkName);
+ hFile = CreateFileW( (wchar_t*)linkName.utf16(), GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
+ FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL );
+ QVERIFY(hFile != INVALID_HANDLE_VALUE );
+
+ memset( reparseInfo, 0, sizeof( *reparseInfo ));
+ reparseInfo->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
+ reparseInfo->ReparseTargetLength = target.size() * sizeof(wchar_t);
+ reparseInfo->ReparseTargetMaximumLength = reparseInfo->ReparseTargetLength + sizeof(wchar_t);
+ target.toWCharArray(reparseInfo->ReparseTarget);
+ reparseInfo->ReparseDataLength = reparseInfo->ReparseTargetLength + 12;
+
+ bool ioc = DeviceIoControl(hFile, FSCTL_SET_REPARSE_POINT, reparseInfo,
+ reparseInfo->ReparseDataLength + REPARSE_MOUNTPOINT_HEADER_SIZE,
+ NULL, 0, &returnedLength, NULL);
+ CloseHandle( hFile );
+ QVERIFY(ioc);
+ }
+#endif
private:
QDir currentDir;