summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/auto.pro3
-rw-r--r--tests/auto/checkxmlfiles/checkxmlfiles.pro2
-rw-r--r--tests/auto/collections/collections.pro4
-rw-r--r--tests/auto/collections/tst_collections.cpp14
-rw-r--r--tests/auto/compilerwarnings/compilerwarnings.pro1
-rw-r--r--tests/auto/exceptionsafety/exceptionsafety.pro2
-rw-r--r--tests/auto/exceptionsafety/tst_exceptionsafety.cpp640
-rw-r--r--tests/auto/exceptionsafety_objects/3rdparty/memcheck.h319
-rw-r--r--tests/auto/exceptionsafety_objects/3rdparty/valgrind.h3924
-rw-r--r--tests/auto/exceptionsafety_objects/exceptionsafety_objects.pro3
-rw-r--r--tests/auto/exceptionsafety_objects/oomsimulator.h286
-rw-r--r--tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp651
-rw-r--r--tests/auto/headers/headers.pro2
-rw-r--r--tests/auto/languagechange/tst_languagechange.cpp25
-rw-r--r--tests/auto/network-settings.h257
-rw-r--r--tests/auto/networkselftest/networkselftest.pro1
-rw-r--r--tests/auto/networkselftest/tst_networkselftest.cpp22
-rw-r--r--tests/auto/patternistexamplefiletree/patternistexamplefiletree.pro1
-rw-r--r--tests/auto/patternistexamples/patternistexamples.pro2
-rw-r--r--tests/auto/patternistheaders/patternistheaders.pro1
-rw-r--r--tests/auto/q3urloperator/copy.res/.gitattributes1
-rw-r--r--tests/auto/q_func_info/q_func_info.pro2
-rw-r--r--tests/auto/q_func_info/tst_q_func_info.cpp2
-rw-r--r--tests/auto/qabstractitemmodel/qabstractitemmodel.pro5
-rw-r--r--tests/auto/qabstractitemview/tst_qabstractitemview.cpp9
-rw-r--r--tests/auto/qabstractmessagehandler/qabstractmessagehandler.pro1
-rw-r--r--tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro2
-rw-r--r--tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp8
-rw-r--r--tests/auto/qabstracturiresolver/qabstracturiresolver.pro1
-rw-r--r--tests/auto/qabstractxmlforwarditerator/qabstractxmlforwarditerator.pro1
-rw-r--r--tests/auto/qabstractxmlreceiver/qabstractxmlreceiver.pro1
-rw-r--r--tests/auto/qaction/tst_qaction.cpp2
-rw-r--r--tests/auto/qanimationgroup/qanimationgroup.pro2
-rw-r--r--tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro9
-rw-r--r--tests/auto/qapplication/test/test.pro8
-rw-r--r--tests/auto/qapplication/tst_qapplication.cpp56
-rw-r--r--tests/auto/qatomicint/qatomicint.pro3
-rw-r--r--tests/auto/qatomicpointer/qatomicpointer.pro2
-rw-r--r--tests/auto/qautoptr/qautoptr.pro2
-rw-r--r--tests/auto/qbitarray/qbitarray.pro4
-rw-r--r--tests/auto/qbitarray/tst_qbitarray.cpp28
-rw-r--r--tests/auto/qbuffer/qbuffer.pro4
-rw-r--r--tests/auto/qbytearray/.gitattributes1
-rw-r--r--tests/auto/qbytearray/qbytearray.pro7
-rw-r--r--tests/auto/qbytearray/tst_qbytearray.cpp20
-rw-r--r--tests/auto/qcache/qcache.pro4
-rw-r--r--tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp2
-rw-r--r--tests/auto/qchar/qchar.pro2
-rw-r--r--tests/auto/qclipboard/test/test.pro2
-rw-r--r--tests/auto/qclipboard/tst_qclipboard.cpp8
-rw-r--r--tests/auto/qcolumnview/tst_qcolumnview.cpp2
-rw-r--r--tests/auto/qcombobox/qcombobox.pro2
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp23
-rw-r--r--tests/auto/qcompleter/tst_qcompleter.cpp3
-rw-r--r--tests/auto/qcoreapplication/qcoreapplication.pro3
-rw-r--r--tests/auto/qcryptographichash/qcryptographichash.pro6
-rw-r--r--tests/auto/qcssparser/qcssparser.pro7
-rw-r--r--tests/auto/qcssparser/tst_qcssparser.cpp4
-rw-r--r--tests/auto/qdatastream/qdatastream.pro12
-rw-r--r--tests/auto/qdatastream/tst_qdatastream.cpp39
-rw-r--r--tests/auto/qdate/qdate.pro4
-rw-r--r--tests/auto/qdatetime/tst_qdatetime.cpp14
-rw-r--r--tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp23
-rw-r--r--tests/auto/qdebug/qdebug.pro4
-rw-r--r--tests/auto/qdesktopservices/qdesktopservices.pro25
-rw-r--r--tests/auto/qdesktopservices/tst_qdesktopservices.cpp205
-rw-r--r--tests/auto/qdir/qdir.pro10
-rw-r--r--tests/auto/qdir/tst_qdir.cpp187
-rw-r--r--tests/auto/qdiriterator/qdiriterator.pro2
-rw-r--r--tests/auto/qdiriterator/tst_qdiriterator.cpp23
-rw-r--r--tests/auto/qdirmodel/qdirmodel.pro12
-rw-r--r--tests/auto/qdirmodel/tst_qdirmodel.cpp28
-rw-r--r--tests/auto/qdom/qdom.pro6
-rw-r--r--tests/auto/qdom/tst_qdom.cpp4
-rw-r--r--tests/auto/qevent/qevent.pro3
-rw-r--r--tests/auto/qeventloop/tst_qeventloop.cpp398
-rw-r--r--tests/auto/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro2
-rw-r--r--tests/auto/qfile/test/test.pro42
-rw-r--r--tests/auto/qfile/tst_qfile.cpp78
-rw-r--r--tests/auto/qfiledialog/qfiledialog.pro5
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp27
-rw-r--r--tests/auto/qfileinfo/qfileinfo.pro6
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp110
-rw-r--r--tests/auto/qfilesystemmodel/qfilesystemmodel.pro9
-rw-r--r--tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp47
-rw-r--r--tests/auto/qfilesystemwatcher/qfilesystemwatcher.pro2
-rw-r--r--tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp36
-rw-r--r--tests/auto/qflags/qflags.pro3
-rw-r--r--tests/auto/qfontdatabase/qfontdatabase.pro4
-rw-r--r--tests/auto/qfontdatabase/tst_qfontdatabase.cpp10
-rw-r--r--tests/auto/qfontdialog/tst_qfontdialog.cpp2
-rw-r--r--tests/auto/qftp/.gitattributes2
-rw-r--r--tests/auto/qftp/qftp.pro5
-rw-r--r--tests/auto/qftp/tst_qftp.cpp24
-rw-r--r--tests/auto/qgetputenv/qgetputenv.pro4
-rw-r--r--tests/auto/qglobal/qglobal.pro3
-rw-r--r--tests/auto/qglobal/tst_qglobal.cpp72
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp30
-rw-r--r--tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp60
-rw-r--r--tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp2
-rw-r--r--tests/auto/qgraphicsscene/qgraphicsscene.pro9
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp10
-rw-r--r--tests/auto/qgraphicsview/qgraphicsview.pro2
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp18
-rw-r--r--tests/auto/qgroupbox/tst_qgroupbox.cpp86
-rw-r--r--tests/auto/qhash/qhash.pro7
-rw-r--r--tests/auto/qhash/tst_qhash.cpp8
-rw-r--r--tests/auto/qhostinfo/tst_qhostinfo.cpp19
-rw-r--r--tests/auto/qhttp/qhttp.pro8
-rw-r--r--tests/auto/qhttp/tst_qhttp.cpp273
-rw-r--r--tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro2
-rw-r--r--tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp26
-rw-r--r--tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp19
-rw-r--r--tests/auto/qicoimageformat/qicoimageformat.pro8
-rw-r--r--tests/auto/qicoimageformat/tst_qicoimageformat.cpp6
-rw-r--r--tests/auto/qicon/qicon.pro7
-rw-r--r--tests/auto/qicon/tst_qicon.cpp7
-rw-r--r--tests/auto/qimage/qimage.pro7
-rw-r--r--tests/auto/qimage/tst_qimage.cpp20
-rw-r--r--tests/auto/qimagereader/qimagereader.pro11
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp8
-rw-r--r--tests/auto/qimagewriter/qimagewriter.pro8
-rw-r--r--tests/auto/qimagewriter/tst_qimagewriter.cpp13
-rw-r--r--tests/auto/qinputcontext/qinputcontext.pro2
-rw-r--r--tests/auto/qinputcontext/tst_qinputcontext.cpp249
-rw-r--r--tests/auto/qiodevice/qiodevice.pro5
-rw-r--r--tests/auto/qiodevice/tst_qiodevice.cpp7
-rw-r--r--tests/auto/qitemdelegate/tst_qitemdelegate.cpp38
-rw-r--r--tests/auto/qitemmodel/qitemmodel.pro9
-rw-r--r--tests/auto/qitemview/tst_qitemview.cpp7
-rw-r--r--tests/auto/qkeyevent/.gitignore1
-rw-r--r--tests/auto/qkeyevent/qkeyevent.pro5
-rw-r--r--tests/auto/qkeyevent/tst_qkeyevent.cpp228
-rw-r--r--tests/auto/qkeysequence/tst_qkeysequence.cpp27
-rw-r--r--tests/auto/qlabel/qlabel.pro7
-rw-r--r--tests/auto/qlabel/tst_qlabel.cpp3
-rw-r--r--tests/auto/qlayout/qlayout.pro2
-rw-r--r--tests/auto/qlibrary/lib/lib.pro3
-rw-r--r--tests/auto/qlibrary/lib/mylib.c4
-rw-r--r--tests/auto/qlibrary/lib2/lib2.pro20
-rw-r--r--tests/auto/qlibrary/lib2/mylib.c4
-rw-r--r--tests/auto/qlibrary/qlibrary.pro14
-rw-r--r--tests/auto/qlibrary/tst/tst.pro12
-rw-r--r--tests/auto/qlibrary/tst_qlibrary.cpp69
-rw-r--r--tests/auto/qline/qline.pro2
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp6
-rw-r--r--tests/auto/qlistview/tst_qlistview.cpp2
-rw-r--r--tests/auto/qlistwidget/tst_qlistwidget.cpp4
-rw-r--r--tests/auto/qlocale/test/test.pro8
-rw-r--r--tests/auto/qlocale/tst_qlocale.cpp56
-rw-r--r--tests/auto/qlocalsocket/lackey/lackey.pro4
-rw-r--r--tests/auto/qlocalsocket/lackey/main.cpp2
-rw-r--r--tests/auto/qlocalsocket/qlocalsocket.pro2
-rw-r--r--tests/auto/qlocalsocket/test/test.pro19
-rw-r--r--tests/auto/qlocalsocket/tst_qlocalsocket.cpp197
-rw-r--r--tests/auto/qmainwindow/qmainwindow.pro3
-rw-r--r--tests/auto/qmap/qmap.pro4
-rw-r--r--tests/auto/qmenu/tst_qmenu.cpp21
-rw-r--r--tests/auto/qmenubar/qmenubar.pro2
-rw-r--r--tests/auto/qmenubar/tst_qmenubar.cpp4
-rw-r--r--tests/auto/qmetatype/qmetatype.pro3
-rw-r--r--tests/auto/qmouseevent/tst_qmouseevent.cpp6
-rw-r--r--tests/auto/qmovie/qmovie.pro10
-rw-r--r--tests/auto/qmultiscreen/qmultiscreen.pro1
-rw-r--r--tests/auto/qmutex/qmutex.pro2
-rw-r--r--tests/auto/qmutexlocker/qmutexlocker.pro2
-rw-r--r--tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp23
-rw-r--r--tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp9
-rw-r--r--tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp9
-rw-r--r--tests/auto/qnetworkreply/.gitattributes5
-rw-r--r--tests/auto/qnetworkreply/echo/echo.pro2
-rw-r--r--tests/auto/qnetworkreply/test/test.pro14
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp92
-rw-r--r--tests/auto/qnumeric/qnumeric.pro3
-rw-r--r--tests/auto/qobject/qobject.pro2
-rw-r--r--tests/auto/qobject/tst_qobject.cpp16
-rw-r--r--tests/auto/qobject/tst_qobject.pro5
-rw-r--r--tests/auto/qobjectrace/qobjectrace.pro3
-rw-r--r--tests/auto/qobjectrace/tst_qobjectrace.cpp32
-rw-r--r--tests/auto/qpainter/qpainter.pro9
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp13
-rw-r--r--tests/auto/qpathclipper/qpathclipper.pro2
-rw-r--r--tests/auto/qpen/tst_qpen.cpp12
-rw-r--r--tests/auto/qpixmap/qpixmap.pro8
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp126
-rw-r--r--tests/auto/qplaintextedit/tst_qplaintextedit.cpp29
-rw-r--r--tests/auto/qplugin/debugplugin/debugplugin.pro4
-rw-r--r--tests/auto/qplugin/qplugin.pro1
-rw-r--r--tests/auto/qplugin/releaseplugin/releaseplugin.pro4
-rw-r--r--tests/auto/qplugin/tst_qplugin.pro8
-rw-r--r--tests/auto/qpluginloader/lib/lib.pro3
-rw-r--r--tests/auto/qpluginloader/qpluginloader.pro3
-rw-r--r--tests/auto/qpluginloader/theplugin/theplugin.pro4
-rw-r--r--tests/auto/qpluginloader/tst/tst.pro9
-rw-r--r--tests/auto/qpluginloader/tst_qpluginloader.cpp66
-rw-r--r--tests/auto/qpoint/qpoint.pro5
-rw-r--r--tests/auto/qpolygon/qpolygon.pro2
-rw-r--r--tests/auto/qprocess/qprocess.pro9
-rw-r--r--tests/auto/qprocess/test/test.pro21
-rw-r--r--tests/auto/qprocess/testDetached/testDetached.pro3
-rw-r--r--tests/auto/qprocess/testProcessOutput/main.cpp18
-rw-r--r--tests/auto/qprocess/testProcessSpacesArgs/main.cpp12
-rw-r--r--tests/auto/qprocess/tst_qprocess.cpp290
-rw-r--r--tests/auto/qqueue/qqueue.pro3
-rw-r--r--tests/auto/qrand/qrand.pro2
-rw-r--r--tests/auto/qreadlocker/qreadlocker.pro2
-rw-r--r--tests/auto/qreadwritelock/qreadwritelock.pro2
-rw-r--r--tests/auto/qrect/qrect.pro2
-rw-r--r--tests/auto/qrect/tst_qrect.cpp320
-rw-r--r--tests/auto/qregexp/qregexp.pro3
-rw-r--r--tests/auto/qregexp/tst_qregexp.cpp4
-rw-r--r--tests/auto/qregion/tst_qregion.cpp4
-rw-r--r--tests/auto/qresourceengine/qresourceengine.pro22
-rw-r--r--tests/auto/qresourceengine/tst_qresourceengine.cpp4
-rw-r--r--tests/auto/qscopedpointer/.gitignore1
-rw-r--r--tests/auto/qscopedpointer/qscopedpointer.pro3
-rw-r--r--tests/auto/qscopedpointer/tst_qscopedpointer.cpp343
-rw-r--r--tests/auto/qscriptengine/qscriptengine.pro9
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp5
-rw-r--r--tests/auto/qscriptextqobject/qscriptextqobject.pro4
-rw-r--r--tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp4
-rw-r--r--tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro9
-rw-r--r--tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp6
-rw-r--r--tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro6
-rw-r--r--tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp8
-rw-r--r--tests/auto/qsequentialanimationgroup/qsequentialanimationgroup.pro2
-rw-r--r--tests/auto/qset/qset.pro7
-rw-r--r--tests/auto/qsettings/.gitattributes5
-rw-r--r--tests/auto/qsettings/tst_qsettings.cpp22
-rw-r--r--tests/auto/qsharedmemory/lackey/scripts/producer.js8
-rw-r--r--tests/auto/qsharedmemory/src/qsystemlock_p.h1
-rw-r--r--tests/auto/qsharedmemory/src/qsystemlock_unix.cpp24
-rw-r--r--tests/auto/qsharedmemory/test/test.pro10
-rw-r--r--tests/auto/qsharedmemory/tst_qsharedmemory.cpp39
-rw-r--r--tests/auto/qsharedpointer/externaltests.cpp4
-rw-r--r--tests/auto/qsharedpointer/externaltests.pri3
-rw-r--r--tests/auto/qsharedpointer/qsharedpointer.pro2
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp4
-rw-r--r--tests/auto/qsidebar/qsidebar.pro2
-rw-r--r--tests/auto/qsignalspy/qsignalspy.pro3
-rw-r--r--tests/auto/qsize/qsize.pro4
-rw-r--r--tests/auto/qsizef/qsizef.pro3
-rw-r--r--tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp90
-rw-r--r--tests/auto/qsocks5socketengine/qsocks5socketengine.pro2
-rw-r--r--tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp26
-rw-r--r--tests/auto/qsound/qsound.pro2
-rw-r--r--tests/auto/qsplitter/qsplitter.pro4
-rw-r--r--tests/auto/qsplitter/tst_qsplitter.cpp4
-rw-r--r--tests/auto/qsql/qsql.pro10
-rw-r--r--tests/auto/qsqldatabase/qsqldatabase.pro11
-rw-r--r--tests/auto/qsqlerror/qsqlerror.pro8
-rw-r--r--tests/auto/qsqlfield/qsqlfield.pro8
-rw-r--r--tests/auto/qsqlquery/qsqlquery.pro8
-rw-r--r--tests/auto/qsqlquerymodel/qsqlquerymodel.pro8
-rw-r--r--tests/auto/qsqlrecord/qsqlrecord.pro10
-rw-r--r--tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro8
-rw-r--r--tests/auto/qsqltablemodel/qsqltablemodel.pro8
-rw-r--r--tests/auto/qsqlthread/qsqlthread.pro8
-rw-r--r--tests/auto/qsslcertificate/qsslcertificate.pro11
-rw-r--r--tests/auto/qsslcertificate/tst_qsslcertificate.cpp6
-rw-r--r--tests/auto/qsslcipher/qsslcipher.pro2
-rw-r--r--tests/auto/qsslerror/qsslerror.pro2
-rw-r--r--tests/auto/qsslkey/qsslkey.pro9
-rw-r--r--tests/auto/qsslkey/tst_qsslkey.cpp8
-rw-r--r--tests/auto/qsslsocket/certs/aspiriniks.ca.crt22
-rw-r--r--tests/auto/qsslsocket/qsslsocket.pro26
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp83
-rw-r--r--tests/auto/qstandarditem/tst_qstandarditem.cpp4
-rw-r--r--tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp4
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp198
-rw-r--r--tests/auto/qstl/qstl.pro4
-rw-r--r--tests/auto/qstring/qstring.pro5
-rw-r--r--tests/auto/qstring/tst_qstring.cpp312
-rw-r--r--tests/auto/qstringlist/qstringlist.pro4
-rw-r--r--tests/auto/qstringlistmodel/tst_qstringlistmodel.cpp1
-rw-r--r--tests/auto/qstyle/qstyle.pro7
-rw-r--r--tests/auto/qstyle/tst_qstyle.cpp109
-rw-r--r--tests/auto/qstylesheetstyle/qstylesheetstyle.pro12
-rw-r--r--tests/auto/qsvggenerator/qsvggenerator.pro7
-rw-r--r--tests/auto/qsvggenerator/tst_qsvggenerator.cpp4
-rw-r--r--tests/auto/qsvgrenderer/qsvgrenderer.pro2
-rw-r--r--tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp2
-rw-r--r--tests/auto/qsysinfo/qsysinfo.pro1
-rw-r--r--tests/auto/qsystemsemaphore/test/test.pro11
-rw-r--r--tests/auto/qsystemsemaphore/tst_qsystemsemaphore.cpp14
-rw-r--r--tests/auto/qtableview/qtableview.pro2
-rw-r--r--tests/auto/qtablewidget/qtablewidget.pro12
-rw-r--r--tests/auto/qtconcurrentfilter/tst_qtconcurrentfilter.cpp2
-rw-r--r--tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp2
-rw-r--r--tests/auto/qtcpserver/crashingServer/main.cpp8
-rw-r--r--tests/auto/qtcpserver/test/test.pro6
-rw-r--r--tests/auto/qtcpserver/tst_qtcpserver.cpp38
-rw-r--r--tests/auto/qtcpsocket/qtcpsocket.pro3
-rw-r--r--tests/auto/qtcpsocket/test/test.pro4
-rw-r--r--tests/auto/qtcpsocket/tst_qtcpsocket.cpp85
-rw-r--r--tests/auto/qtemporaryfile/qtemporaryfile.pro9
-rw-r--r--tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp8
-rw-r--r--tests/auto/qtextblock/tst_qtextblock.cpp2
-rw-r--r--tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro5
-rw-r--r--tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp3
-rw-r--r--tests/auto/qtextbrowser/qtextbrowser.pro4
-rw-r--r--tests/auto/qtextbrowser/tst_qtextbrowser.cpp13
-rw-r--r--tests/auto/qtextcodec/test/test.pro7
-rw-r--r--tests/auto/qtextcodec/tst_qtextcodec.cpp10
-rw-r--r--tests/auto/qtextedit/qtextedit.pro9
-rw-r--r--tests/auto/qtextedit/tst_qtextedit.cpp39
-rw-r--r--tests/auto/qtextlayout/qtextlayout.pro3
-rw-r--r--tests/auto/qtextlayout/tst_qtextlayout.cpp6
-rw-r--r--tests/auto/qtextodfwriter/qtextodfwriter.pro4
-rw-r--r--tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp4
-rw-r--r--tests/auto/qtextstream/test/test.pro17
-rw-r--r--tests/auto/qtextstream/tst_qtextstream.cpp28
-rw-r--r--tests/auto/qthread/qthread.pro3
-rw-r--r--tests/auto/qthread/tst_qthread.cpp2
-rw-r--r--tests/auto/qthreadstorage/qthreadstorage.pro3
-rw-r--r--tests/auto/qtime/qtime.pro3
-rw-r--r--tests/auto/qtimeline/qtimeline.pro3
-rw-r--r--tests/auto/qtimer/qtimer.pro3
-rw-r--r--tests/auto/qtimer/tst_qtimer.cpp87
-rw-r--r--tests/auto/qtransform/qtransform.pro2
-rw-r--r--tests/auto/qtransformedscreen/qtransformedscreen.pro1
-rw-r--r--tests/auto/qtranslator/qtranslator.pro2
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp12
-rw-r--r--tests/auto/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp10
-rw-r--r--tests/auto/qtwidgets/qtwidgets.pro1
-rw-r--r--tests/auto/qtwidgets/tst_qtwidgets.cpp13
-rw-r--r--tests/auto/qudpsocket/test/test.pro2
-rw-r--r--tests/auto/qudpsocket/tst_qudpsocket.cpp127
-rw-r--r--tests/auto/qudpsocket/udpServer/udpServer.pro1
-rw-r--r--tests/auto/qurl/qurl.pro5
-rw-r--r--tests/auto/quuid/quuid.pro3
-rw-r--r--tests/auto/qvariant/qvariant.pro1
-rw-r--r--tests/auto/qvariant/tst_qvariant.cpp26
-rw-r--r--tests/auto/qvarlengtharray/qvarlengtharray.pro3
-rw-r--r--tests/auto/qvector/qvector.pro4
-rw-r--r--tests/auto/qwaitcondition/tst_qwaitcondition.cpp859
-rw-r--r--tests/auto/qwidget/qwidget.pro6
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp135
-rw-r--r--tests/auto/qwindowsurface/tst_qwindowsurface.cpp2
-rw-r--r--tests/auto/qwineventnotifier/qwineventnotifier.pro3
-rw-r--r--tests/auto/qwizard/qwizard.pro1
-rw-r--r--tests/auto/qwmatrix/qwmatrix.pro2
-rw-r--r--tests/auto/qwritelocker/qwritelocker.pro2
-rw-r--r--tests/auto/qwsembedwidget/qwsembedwidget.pro4
-rw-r--r--tests/auto/qwsinputmethod/qwsinputmethod.pro4
-rw-r--r--tests/auto/qwswindowsystem/qwswindowsystem.pro4
-rw-r--r--tests/auto/qxml/qxml.pro2
-rw-r--r--tests/auto/qxmlformatter/qxmlformatter.pro2
-rw-r--r--tests/auto/qxmlquery/qxmlquery.pro10
-rw-r--r--tests/auto/qxmlquery/tst_qxmlquery.cpp5
-rw-r--r--tests/auto/qxmlsimplereader/qxmlsimplereader.pro4
-rw-r--r--tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp8
-rw-r--r--tests/auto/qxmlstream/qxmlstream.pro2
-rw-r--r--tests/auto/qzip/qzip.pro4
-rw-r--r--tests/auto/qzip/tst_qzip.cpp4
-rw-r--r--tests/auto/symbian/orientationchange/orientationchange.pro7
-rw-r--r--tests/auto/symbian/orientationchange/tst_orientationchange.cpp165
-rw-r--r--tests/auto/symbian/qmainexceptions/qmainexceptions.pro3
-rw-r--r--tests/auto/symbian/qmainexceptions/tst_qmainexceptions.cpp468
-rw-r--r--tests/auto/symbian/qsymbiantests.pro2
-rw-r--r--tests/auto/uiloader/uiloader/tst_uiloader.cpp3
-rw-r--r--tests/auto/uiloader/uiloader/uiloader.pro4
-rw-r--r--tests/auto/xmlpatterns/tst_xmlpatterns.cpp2
363 files changed, 12373 insertions, 2515 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 411e7eb..76dca51 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -1,3 +1,4 @@
+QT = core
TEMPLATE = subdirs
# Directories
@@ -178,7 +179,6 @@ SUBDIRS += \
qitemmodel \
qitemselectionmodel \
qitemview \
- qkeyevent \
qkeysequence \
qlabel \
qlayout \
@@ -252,6 +252,7 @@ SUBDIRS += \
qregion \
qresourceengine \
qringbuffer \
+ qscopedpointer \
qscrollarea \
qsemaphore \
qsharedpointer \
diff --git a/tests/auto/checkxmlfiles/checkxmlfiles.pro b/tests/auto/checkxmlfiles/checkxmlfiles.pro
index 96985c9..c368c02 100644
--- a/tests/auto/checkxmlfiles/checkxmlfiles.pro
+++ b/tests/auto/checkxmlfiles/checkxmlfiles.pro
@@ -6,7 +6,7 @@ QT -= gui
include (../xmlpatterns.pri)
-wince*: {
+wince*|symbian*: {
QT += network
addFiles.sources = \
$$QT_SOURCE_TREE/examples/sql/masterdetail/albumdetails.xml \
diff --git a/tests/auto/collections/collections.pro b/tests/auto/collections/collections.pro
index f47c2eb..876e903 100644
--- a/tests/auto/collections/collections.pro
+++ b/tests/auto/collections/collections.pro
@@ -1,7 +1,3 @@
load(qttest_p4)
SOURCES += tst_collections.cpp
-
-
QT = core
-
-
diff --git a/tests/auto/collections/tst_collections.cpp b/tests/auto/collections/tst_collections.cpp
index ebe7d94..675eabb 100644
--- a/tests/auto/collections/tst_collections.cpp
+++ b/tests/auto/collections/tst_collections.cpp
@@ -992,7 +992,7 @@ void tst_Collections::linkedList()
QVERIFY(*(list.begin() + 2) == "alpha");
QVERIFY(*(list.begin() + 3) == "beta");
}
-
+
{
QLinkedList<int> a;
QCOMPARE(a.startsWith(1), false);
@@ -1364,6 +1364,9 @@ void tst_Collections::byteArray()
ba1 = "FooFoo";
ba1.replace(char('F'), ba1);
QCOMPARE(ba1, QByteArray("FooFooooFooFoooo"));
+ ba1 = "FooFoo";
+ ba1.replace(char('o'), ba1);
+ QCOMPARE(ba1, QByteArray("FFooFooFooFooFFooFooFooFoo"));
ba1.replace(ba1, "xxx");
QCOMPARE(ba1, QByteArray("xxx"));
@@ -2354,6 +2357,9 @@ void tst_Collections::qstring()
str1 = "FooFoo";
str1.replace(char('F'), str1);
QCOMPARE(str1, QString("FooFooooFooFoooo"));
+ str1 = "FooFoo";
+ str1.replace(char('o'), str1);
+ QCOMPARE(str1, QString("FFooFooFooFooFFooFooFooFoo"));
str1 = "Foo";
str1.replace("Foo", str1);
@@ -3447,7 +3453,7 @@ class Key1
class T1
{};
class T2
-};
+{};
#else
class Key1;
class T1;
@@ -3462,7 +3468,11 @@ void tst_Collections::forwardDeclared()
{ 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.
{ typedef QPair<T1, T2> C; C *x = 0; Q_UNUSED(x) }
+#endif
{ typedef QList<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
{ typedef QLinkedList<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
{ typedef QVector<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) Q_UNUSED(i) Q_UNUSED(j) }
diff --git a/tests/auto/compilerwarnings/compilerwarnings.pro b/tests/auto/compilerwarnings/compilerwarnings.pro
index 9e16c5e..beb0279 100644
--- a/tests/auto/compilerwarnings/compilerwarnings.pro
+++ b/tests/auto/compilerwarnings/compilerwarnings.pro
@@ -1,5 +1,4 @@
load(qttest_p4)
SOURCES += tst_compilerwarnings.cpp
QT = core
-
RESOURCES = compilerwarnings.qrc
diff --git a/tests/auto/exceptionsafety/exceptionsafety.pro b/tests/auto/exceptionsafety/exceptionsafety.pro
index 23b8f73..d162219 100644
--- a/tests/auto/exceptionsafety/exceptionsafety.pro
+++ b/tests/auto/exceptionsafety/exceptionsafety.pro
@@ -1,3 +1,3 @@
load(qttest_p4)
-QT -= gui
SOURCES += tst_exceptionsafety.cpp
+QT = core
diff --git a/tests/auto/exceptionsafety/tst_exceptionsafety.cpp b/tests/auto/exceptionsafety/tst_exceptionsafety.cpp
index a598146..37fdf84 100644
--- a/tests/auto/exceptionsafety/tst_exceptionsafety.cpp
+++ b/tests/auto/exceptionsafety/tst_exceptionsafety.cpp
@@ -52,9 +52,16 @@ class tst_ExceptionSafety: public QObject
Q_OBJECT
private slots:
void exceptionInSlot();
+ void exceptionVector();
+ void exceptionHash();
+ void exceptionMap();
+ void exceptionList();
+ void exceptionLinkedList();
+// void exceptionEventLoop();
+// void exceptionSignalSlot();
};
-class Emitter: public QObject
+class Emitter : public QObject
{
Q_OBJECT
public:
@@ -63,13 +70,111 @@ signals:
void testSignal();
};
-class ExceptionThrower: public QObject
+class ExceptionThrower : public QObject
{
Q_OBJECT
public slots:
void thrower() { throw 5; }
};
+class Receiver : public QObject
+{
+ Q_OBJECT
+public:
+ Receiver()
+ : received(0) {}
+ int received;
+
+public slots:
+ void receiver() { ++received; }
+};
+
+enum ThrowType { ThrowNot = 0, ThrowAtCreate = 1, ThrowAtCopy = 2, ThrowLater = 3, ThrowAtComparison = 4 };
+
+ThrowType throwType = ThrowNot; // global flag to indicate when an exception should be throw. Will be reset when the exception has been generated.
+
+int objCounter = 0;
+
+/*! Class that does not throw any exceptions. Used as baseclass for all the other ones.
+ */
+template <int T>
+class FlexibleThrower
+{
+ public:
+ FlexibleThrower() : _value(-1) {
+ if( throwType == ThrowAtCreate ) {
+ throwType = ThrowNot;
+ throw ThrowAtCreate;
+ }
+ objCounter++;
+ }
+
+ FlexibleThrower( short value ) : _value(value) {
+ if( throwType == ThrowAtCreate ) {
+ throwType = ThrowNot;
+ throw ThrowAtCreate;
+ }
+ objCounter++;
+ }
+
+ FlexibleThrower(FlexibleThrower const& other ) {
+ // qDebug("cc");
+
+ if( throwType == ThrowAtCopy ) {
+ throwType = ThrowNot;
+ throw ThrowAtCopy;
+
+ } else if( throwType == ThrowLater ) {
+ throwType = ThrowAtCopy;
+ }
+
+ objCounter++;
+ _value = other.value();
+ }
+
+ ~FlexibleThrower() { objCounter--; }
+
+ bool operator==(const FlexibleThrower<T> &t) const
+ {
+ // qDebug("vv == %d %d", value(), t.value());
+ if( throwType == ThrowAtComparison ) {
+ throwType = ThrowNot;
+ throw ThrowAtComparison;
+ }
+ return value()==t.value();
+ }
+
+ bool operator<(const FlexibleThrower<T> &t) const
+ {
+ // qDebug("vv < %d %d", value(), t.value());
+ if( throwType == ThrowAtComparison ) {
+ throwType = ThrowNot;
+ throw ThrowAtComparison;
+ }
+ return value()<t.value();
+ }
+
+ int value() const
+ { return (int)_value; }
+
+ short _value;
+ char dummy[T];
+};
+
+uint qHash(const FlexibleThrower<2>& t)
+{
+ // qDebug("ha");
+ if( throwType == ThrowAtComparison ) {
+ throwType = ThrowNot;
+ throw ThrowAtComparison;
+ }
+ return (uint)t.value();
+}
+
+typedef FlexibleThrower<2> FlexibleThrowerSmall;
+typedef QMap<FlexibleThrowerSmall,FlexibleThrowerSmall> MyMap;
+typedef QHash<FlexibleThrowerSmall,FlexibleThrowerSmall> MyHash;
+
// connect a signal to a slot that throws an exception
// run this through valgrind to make sure it doesn't corrupt
void tst_ExceptionSafety::exceptionInSlot()
@@ -86,6 +191,537 @@ void tst_ExceptionSafety::exceptionInSlot()
}
}
+void tst_ExceptionSafety::exceptionList() {
+
+ {
+ QList<FlexibleThrowerSmall> list;
+ QList<FlexibleThrowerSmall> list2;
+ QList<FlexibleThrowerSmall> list3;
+
+ for( int i = 0; i<10; i++ )
+ list.append( FlexibleThrowerSmall(i) );
+
+ try {
+ throwType = ThrowAtCopy;
+ list.append( FlexibleThrowerSmall(10));
+ } catch (...) {
+ }
+ QCOMPARE( list.size(), 10 );
+
+ try {
+ throwType = ThrowAtCopy;
+ list.prepend( FlexibleThrowerSmall(10));
+ } catch (...) {
+ }
+ QCOMPARE( list.at(0).value(), 0 );
+ QCOMPARE( list.size(), 10 );
+
+ try {
+ throwType = ThrowAtCopy;
+ list.insert( 8, FlexibleThrowerSmall(10));
+ } catch (...) {
+ }
+ QCOMPARE( list.at(7).value(), 7 );
+ QCOMPARE( list.at(8).value(), 8 );
+ QCOMPARE( list.size(), 10 );
+
+ try {
+ throwType = ThrowAtCopy;
+ FlexibleThrowerSmall t = list.takeAt( 6 );
+ } catch (...) {
+ }
+ QCOMPARE( list.at(6).value(), 6 );
+ QCOMPARE( list.at(7).value(), 7 );
+ QCOMPARE( list.size(), 10 );
+
+ try {
+ throwType = ThrowAtCopy;
+ list3 = list;
+ } catch (...) {
+ }
+ QCOMPARE( list.at(0).value(), 0 );
+ QCOMPARE( list.at(7).value(), 7 );
+ QCOMPARE( list.size(), 10 );
+ QCOMPARE( list3.at(0).value(), 0 );
+ QCOMPARE( list3.at(7).value(), 7 );
+ QCOMPARE( list3.size(), 10 );
+
+ try {
+ throwType = ThrowAtCopy;
+ list3.append( FlexibleThrowerSmall(11) );
+ } catch (...) {
+ }
+ QCOMPARE( list.at(0).value(), 0 );
+ QCOMPARE( list.at(7).value(), 7 );
+ QCOMPARE( list.size(), 10 );
+ QCOMPARE( list3.at(0).value(), 0 );
+ QCOMPARE( list3.at(7).value(), 7 );
+ QCOMPARE( list3.size(), 10 );
+
+ try {
+ list2.clear();
+ list2.append( FlexibleThrowerSmall(11));
+ throwType = ThrowAtCopy;
+ list3 = list+list2;
+ } catch (...) {
+ }
+ QCOMPARE( list.at(0).value(), 0 );
+ QCOMPARE( list.at(7).value(), 7 );
+ QCOMPARE( list.size(), 10 );
+
+ // check that copy on write works atomar
+ list2.clear();
+ list2.append( FlexibleThrowerSmall(11));
+ list3 = list+list2;
+ try {
+ throwType = ThrowAtCreate;
+ list3[7]=FlexibleThrowerSmall(12);
+ } catch (...) {
+ }
+ QCOMPARE( list.at(7).value(), 7 );
+ QCOMPARE( list.size(), 10 );
+ QCOMPARE( list3.at(7).value(), 7 );
+ QCOMPARE( list3.size(), 11 );
+
+ }
+ QCOMPARE(objCounter, 0 ); // check that every object has been freed
+}
+
+void tst_ExceptionSafety::exceptionLinkedList() {
+
+ {
+ QLinkedList<FlexibleThrowerSmall> list;
+ QLinkedList<FlexibleThrowerSmall> list2;
+ QLinkedList<FlexibleThrowerSmall> list3;
+
+ for( int i = 0; i<10; i++ )
+ list.append( FlexibleThrowerSmall(i) );
+
+ try {
+ throwType = ThrowAtCopy;
+ list.append( FlexibleThrowerSmall(10));
+ } catch (...) {
+ }
+ QCOMPARE( list.size(), 10 );
+
+ try {
+ throwType = ThrowAtCopy;
+ list.prepend( FlexibleThrowerSmall(10));
+ } catch (...) {
+ }
+ QCOMPARE( list.first().value(), 0 );
+ QCOMPARE( list.size(), 10 );
+
+ try {
+ throwType = ThrowAtCopy;
+ list3 = list;
+ list3.append( FlexibleThrowerSmall(11) );
+ } catch (...) {
+ }
+ QCOMPARE( list.first().value(), 0 );
+ QCOMPARE( list.size(), 10 );
+ QCOMPARE( list3.size(), 10 );
+ }
+ QCOMPARE(objCounter, 0 ); // check that every object has been freed
+}
+
+void tst_ExceptionSafety::exceptionVector() {
+
+ {
+ QVector<FlexibleThrowerSmall> vector;
+ QVector<FlexibleThrowerSmall> vector2;
+ QVector<FlexibleThrowerSmall> vector3;
+
+ for (int i = 0; i<10; i++)
+ vector.append( FlexibleThrowerSmall(i) );
+
+ try {
+ throwType = ThrowAtCopy;
+ vector.append( FlexibleThrowerSmall(10));
+ } catch (...) {
+ }
+ QCOMPARE( vector.size(), 10 );
+
+ try {
+ throwType = ThrowAtCopy;
+ vector.prepend( FlexibleThrowerSmall(10));
+ } catch (...) {
+ }
+ QCOMPARE( vector.at(0).value(), 0 );
+ QCOMPARE( vector.size(), 10 );
+
+ try {
+ throwType = ThrowAtCopy;
+ vector.insert( 8, FlexibleThrowerSmall(10));
+ } catch (...) {
+ }
+ QCOMPARE( vector.at(7).value(), 7 );
+ QCOMPARE( vector.at(8).value(), 8 );
+ QCOMPARE( vector.size(), 10 );
+
+ try {
+ throwType = ThrowAtCopy;
+ vector3 = vector;
+ } catch (...) {
+ }
+ QCOMPARE( vector.at(0).value(), 0 );
+ QCOMPARE( vector.at(7).value(), 7 );
+ QCOMPARE( vector.size(), 10 );
+ QCOMPARE( vector3.at(0).value(), 0 );
+ QCOMPARE( vector3.at(7).value(), 7 );
+ QCOMPARE( vector3.size(), 10 );
+
+ try {
+ throwType = ThrowAtCopy;
+ vector3.append( FlexibleThrowerSmall(11) );
+ } catch (...) {
+ }
+ QCOMPARE( vector.at(0).value(), 0 );
+ QCOMPARE( vector.at(7).value(), 7 );
+ QCOMPARE( vector.size(), 10 );
+ QCOMPARE( vector3.at(0).value(), 0 );
+ QCOMPARE( vector3.at(7).value(), 7 );
+
+ try {
+ vector2.clear();
+ vector2.append( FlexibleThrowerSmall(11));
+ throwType = ThrowAtCopy;
+ vector3 = vector+vector2;
+ } catch (...) {
+ }
+ QCOMPARE( vector.at(0).value(), 0 );
+ QCOMPARE( vector.at(7).value(), 7 );
+ QCOMPARE( vector.size(), 10 );
+
+ // check that copy on write works atomar
+ vector2.clear();
+ vector2.append( FlexibleThrowerSmall(11));
+ vector3 = vector+vector2;
+ try {
+ throwType = ThrowAtCreate;
+ vector3[7]=FlexibleThrowerSmall(12);
+ } catch (...) {
+ }
+ QCOMPARE( vector.at(7).value(), 7 );
+ QCOMPARE( vector.size(), 10 );
+ QCOMPARE( vector3.at(7).value(), 7 );
+ QCOMPARE( vector3.size(), 11 );
+
+ try {
+ throwType = ThrowAtCreate;
+ vector.resize(15);
+ } catch (...) {
+ }
+ QCOMPARE( vector.at(7).value(), 7 );
+ QCOMPARE( vector.size(), 10 );
+
+ try {
+ throwType = ThrowAtCreate;
+ vector.resize(15);
+ } catch (...) {
+ }
+ QCOMPARE( vector.at(7).value(), 7 );
+ QCOMPARE( vector.size(), 10 );
+
+ try {
+ throwType = ThrowLater;
+ vector.fill(FlexibleThrowerSmall(1), 15);
+ } catch (...) {
+ }
+ QCOMPARE( vector.at(0).value(), 0 );
+ QCOMPARE( vector.size(), 10 );
+
+
+ }
+ QCOMPARE(objCounter, 0 ); // check that every object has been freed
+}
+
+
+void tst_ExceptionSafety::exceptionMap() {
+
+ {
+ MyMap map;
+ MyMap map2;
+ MyMap map3;
+
+ throwType = ThrowNot;
+ for (int i = 0; i<10; i++)
+ map[ FlexibleThrowerSmall(i) ] = FlexibleThrowerSmall(i);
+
+ return; // further test are deactivated until Map is fixed.
+
+ for( int i = ThrowAtCopy; i<=ThrowAtComparison; i++ ) {
+ try {
+ throwType = (ThrowType)i;
+ map[ FlexibleThrowerSmall(10) ] = FlexibleThrowerSmall(10);
+ } catch(...) {
+ }
+ QCOMPARE( map.size(), 10 );
+ QCOMPARE( map[ FlexibleThrowerSmall(1) ], FlexibleThrowerSmall(1) );
+ }
+
+ map2 = map;
+ try {
+ throwType = ThrowLater;
+ map2[ FlexibleThrowerSmall(10) ] = FlexibleThrowerSmall(10);
+ } catch(...) {
+ }
+ /* qDebug("%d %d", map.size(), map2.size() );
+ for( int i=0; i<map.size(); i++ )
+ qDebug( "Value at %d: %d",i, map.value(FlexibleThrowerSmall(i), FlexibleThrowerSmall()).value() );
+ QCOMPARE( map.value(FlexibleThrowerSmall(1), FlexibleThrowerSmall()), FlexibleThrowerSmall(1) );
+ qDebug( "Value at %d: %d",1, map[FlexibleThrowerSmall(1)].value() );
+ qDebug("%d %d", map.size(), map2.size() );
+ */
+ QCOMPARE( map[ FlexibleThrowerSmall(1) ], FlexibleThrowerSmall(1) );
+ QCOMPARE( map.size(), 10 );
+ QCOMPARE( map2[ FlexibleThrowerSmall(1) ], FlexibleThrowerSmall(1) );
+ QCOMPARE( map2.size(), 10 );
+
+ }
+ QCOMPARE(objCounter, 0 ); // check that every object has been freed
+}
+
+void tst_ExceptionSafety::exceptionHash() {
+
+ {
+ MyHash hash;
+ MyHash hash2;
+ MyHash hash3;
+
+ for( int i = 0; i<10; i++ )
+ hash[ FlexibleThrowerSmall(i) ] = FlexibleThrowerSmall(i);
+
+ for( int i = ThrowAtCopy; i<=ThrowAtComparison; i++ ) {
+ try {
+ throwType = (ThrowType)i;
+ hash[ FlexibleThrowerSmall(10) ] = FlexibleThrowerSmall(10);
+ } catch(...) {
+ }
+ QCOMPARE( hash.size(), 10 );
+ }
+
+ hash2 = hash;
+ try {
+ throwType = ThrowLater;
+ hash2[ FlexibleThrowerSmall(10) ] = FlexibleThrowerSmall(10);
+ } catch(...) {
+ }
+ QCOMPARE( hash[ FlexibleThrowerSmall(1) ], FlexibleThrowerSmall(1) );
+ QCOMPARE( hash.size(), 10 );
+ QCOMPARE( hash2[ FlexibleThrowerSmall(1) ], FlexibleThrowerSmall(1) );
+ QCOMPARE( hash2.size(), 10 );
+
+ hash2.clear();
+ try {
+ throwType = ThrowLater;
+ hash2.reserve(30);
+ } catch(...) {
+ }
+ QCOMPARE( hash2.size(), 0 );
+
+ /*
+ try {
+ throwType = ThrowAtCopy;
+ hash.prepend( FlexibleThrowerSmall(10));
+ } catch (...) {
+ }
+ QCOMPARE( hash.at(0).value(), 0 );
+ QCOMPARE( hash.size(), 10 );
+
+ try {
+ throwType = ThrowAtCopy;
+ hash.insert( 8, FlexibleThrowerSmall(10));
+ } catch (...) {
+ }
+ QCOMPARE( hash.at(7).value(), 7 );
+ QCOMPARE( hash.at(8).value(), 8 );
+ QCOMPARE( hash.size(), 10 );
+
+ qDebug("val");
+ try {
+ throwType = ThrowAtCopy;
+ hash3 = hash;
+ } catch (...) {
+ }
+ QCOMPARE( hash.at(0).value(), 0 );
+ QCOMPARE( hash.at(7).value(), 7 );
+ QCOMPARE( hash.size(), 10 );
+ QCOMPARE( hash3.at(0).value(), 0 );
+ QCOMPARE( hash3.at(7).value(), 7 );
+ QCOMPARE( hash3.size(), 10 );
+
+ try {
+ throwType = ThrowAtCopy;
+ hash3.append( FlexibleThrowerSmall(11) );
+ } catch (...) {
+ }
+ QCOMPARE( hash.at(0).value(), 0 );
+ QCOMPARE( hash.at(7).value(), 7 );
+ QCOMPARE( hash.size(), 10 );
+ QCOMPARE( hash3.at(0).value(), 0 );
+ QCOMPARE( hash3.at(7).value(), 7 );
+ QCOMPARE( hash3.at(11).value(), 11 );
+
+ try {
+ hash2.clear();
+ hash2.append( FlexibleThrowerSmall(11));
+ throwType = ThrowAtCopy;
+ hash3 = hash+hash2;
+ } catch (...) {
+ }
+ QCOMPARE( hash.at(0).value(), 0 );
+ QCOMPARE( hash.at(7).value(), 7 );
+ QCOMPARE( hash.size(), 10 );
+
+ // check that copy on write works atomar
+ hash2.clear();
+ hash2.append( FlexibleThrowerSmall(11));
+ hash3 = hash+hash2;
+ try {
+ throwType = ThrowAtCopy;
+ hash3[7]=FlexibleThrowerSmall(12);
+ } catch (...) {
+ }
+ QCOMPARE( hash.at(7).value(), 7 );
+ QCOMPARE( hash.size(), 10 );
+ QCOMPARE( hash3.at(7).value(), 7 );
+ QCOMPARE( hash3.size(), 11 );
+ */
+
+
+ }
+ QCOMPARE(objCounter, 0 ); // check that every object has been freed
+}
+
+// Disable these tests until the level of exception safety in event loops is clear
+#if 0
+enum
+{
+ ThrowEventId = QEvent::User + 42,
+ NoThrowEventId = QEvent::User + 43
+};
+
+class ThrowEvent : public QEvent
+{
+public:
+ ThrowEvent()
+ : QEvent(static_cast<QEvent::Type>(ThrowEventId))
+ {
+ }
+};
+
+class NoThrowEvent : public QEvent
+{
+public:
+ NoThrowEvent()
+ : QEvent(static_cast<QEvent::Type>(NoThrowEventId))
+ {}
+};
+
+struct IntEx : public std::exception
+{
+ IntEx(int aEx) : ex(aEx) {}
+ int ex;
+};
+
+class TestObject : public QObject
+{
+public:
+ TestObject()
+ : throwEventCount(0), noThrowEventCount(0) {}
+
+ int throwEventCount;
+ int noThrowEventCount;
+
+protected:
+ bool event(QEvent *event)
+ {
+ if (int(event->type()) == ThrowEventId) {
+ throw IntEx(++throwEventCount);
+ } else if (int(event->type()) == NoThrowEventId) {
+ ++noThrowEventCount;
+ }
+ return QObject::event(event);
+ }
+};
+
+void tst_ExceptionSafety::exceptionEventLoop()
+{
+ // send an event that throws
+ TestObject obj;
+ ThrowEvent throwEvent;
+ try {
+ qApp->sendEvent(&obj, &throwEvent);
+ } catch (IntEx code) {
+ QCOMPARE(code.ex, 1);
+ }
+ QCOMPARE(obj.throwEventCount, 1);
+
+ // post an event that throws
+ qApp->postEvent(&obj, new ThrowEvent);
+
+ try {
+ qApp->processEvents();
+ } catch (IntEx code) {
+ QCOMPARE(code.ex, 2);
+ }
+ QCOMPARE(obj.throwEventCount, 2);
+
+ // post a normal event, then a throwing event, then a normal event
+ // run this in valgrind to ensure that it doesn't leak.
+
+ qApp->postEvent(&obj, new NoThrowEvent);
+ qApp->postEvent(&obj, new ThrowEvent);
+ qApp->postEvent(&obj, new NoThrowEvent);
+
+ try {
+ qApp->processEvents();
+ } catch (IntEx code) {
+ QCOMPARE(code.ex, 3);
+ }
+ // here, we should have received on non-throwing event and one throwing one
+ QCOMPARE(obj.throwEventCount, 3);
+#ifndef __SYMBIAN32__
+ // symbian event loops will have absorbed the exceptions
+ QCOMPARE(obj.noThrowEventCount, 1);
+#endif
+
+ // spin the event loop again
+ qApp->processEvents();
+
+ // now, we should have received the second non-throwing event
+ QCOMPARE(obj.noThrowEventCount, 2);
+}
+
+void tst_ExceptionSafety::exceptionSignalSlot()
+{
+ Emitter e;
+ ExceptionThrower thrower;
+ Receiver r1;
+ Receiver r2;
+
+ // connect a signal to a normal object, a thrower and a normal object again
+ connect(&e, SIGNAL(testSignal()), &r1, SLOT(receiver()));
+ connect(&e, SIGNAL(testSignal()), &thrower, SLOT(thrower()));
+ connect(&e, SIGNAL(testSignal()), &r2, SLOT(receiver()));
+
+ int code = 0;
+ try {
+ e.emitTestSignal();
+ } catch (int c) {
+ code = c;
+ }
+
+ // 5 is the magic number that's thrown by thrower
+ QCOMPARE(code, 5);
+
+ // assumption: slots are called in the connection order
+ QCOMPARE(r1.received, 1);
+ QCOMPARE(r2.received, 0);
+}
+#endif
+
QTEST_MAIN(tst_ExceptionSafety)
#include "tst_exceptionsafety.moc"
#endif // QT_NO_EXCEPTIONS
diff --git a/tests/auto/exceptionsafety_objects/3rdparty/memcheck.h b/tests/auto/exceptionsafety_objects/3rdparty/memcheck.h
new file mode 100644
index 0000000..72a02ca
--- /dev/null
+++ b/tests/auto/exceptionsafety_objects/3rdparty/memcheck.h
@@ -0,0 +1,319 @@
+
+/*
+ ----------------------------------------------------------------
+
+ Notice that the following BSD-style license applies to this one
+ file (memcheck.h) only. The rest of Valgrind is licensed under the
+ terms of the GNU General Public License, version 2, unless
+ otherwise indicated. See the COPYING file in the source
+ distribution for details.
+
+ ----------------------------------------------------------------
+
+ This file is part of MemCheck, a heavyweight Valgrind tool for
+ detecting memory errors.
+
+ Copyright (C) 2000-2008 Julian Seward. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. The origin of this software must not be misrepresented; you must
+ not claim that you wrote the original software. If you use this
+ software in a product, an acknowledgment in the product
+ documentation would be appreciated but is not required.
+
+ 3. Altered source versions must be plainly marked as such, and must
+ not be misrepresented as being the original software.
+
+ 4. The name of the author may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ----------------------------------------------------------------
+
+ Notice that the above BSD-style license applies to this one file
+ (memcheck.h) only. The entire rest of Valgrind is licensed under
+ the terms of the GNU General Public License, version 2. See the
+ COPYING file in the source distribution for details.
+
+ ----------------------------------------------------------------
+*/
+
+
+#ifndef __MEMCHECK_H
+#define __MEMCHECK_H
+
+
+/* This file is for inclusion into client (your!) code.
+
+ You can use these macros to manipulate and query memory permissions
+ inside your own programs.
+
+ See comment near the top of valgrind.h on how to use them.
+*/
+
+#include "valgrind.h"
+
+/* !! ABIWARNING !! ABIWARNING !! ABIWARNING !! ABIWARNING !!
+ This enum comprises an ABI exported by Valgrind to programs
+ which use client requests. DO NOT CHANGE THE ORDER OF THESE
+ ENTRIES, NOR DELETE ANY -- add new ones at the end. */
+typedef
+ enum {
+ VG_USERREQ__MAKE_MEM_NOACCESS = VG_USERREQ_TOOL_BASE('M','C'),
+ VG_USERREQ__MAKE_MEM_UNDEFINED,
+ VG_USERREQ__MAKE_MEM_DEFINED,
+ VG_USERREQ__DISCARD,
+ VG_USERREQ__CHECK_MEM_IS_ADDRESSABLE,
+ VG_USERREQ__CHECK_MEM_IS_DEFINED,
+ VG_USERREQ__DO_LEAK_CHECK,
+ VG_USERREQ__COUNT_LEAKS,
+
+ VG_USERREQ__GET_VBITS,
+ VG_USERREQ__SET_VBITS,
+
+ VG_USERREQ__CREATE_BLOCK,
+
+ VG_USERREQ__MAKE_MEM_DEFINED_IF_ADDRESSABLE,
+
+ VG_USERREQ__ENABLE_OOM,
+ VG_USERREQ__GET_ALLOC_INDEX,
+
+ /* This is just for memcheck's internal use - don't use it */
+ _VG_USERREQ__MEMCHECK_RECORD_OVERLAP_ERROR
+ = VG_USERREQ_TOOL_BASE('M','C') + 256,
+
+ /* This is just for memcheck's internal use - don't use it */
+ _VG_USERREQ__EXCEPTION
+ = VG_USERREQ_TOOL_BASE('M','C') + 512,
+ } Vg_MemCheckClientRequest;
+
+
+
+/* Client-code macros to manipulate the state of memory. */
+
+/* Mark memory at _qzz_addr as unaddressable for _qzz_len bytes. */
+#define VALGRIND_MAKE_MEM_NOACCESS(_qzz_addr,_qzz_len) \
+ (__extension__({unsigned long _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+ VG_USERREQ__MAKE_MEM_NOACCESS, \
+ _qzz_addr, _qzz_len, 0, 0, 0); \
+ _qzz_res; \
+ }))
+
+/* Similarly, mark memory at _qzz_addr as addressable but undefined
+ for _qzz_len bytes. */
+#define VALGRIND_MAKE_MEM_UNDEFINED(_qzz_addr,_qzz_len) \
+ (__extension__({unsigned long _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+ VG_USERREQ__MAKE_MEM_UNDEFINED, \
+ _qzz_addr, _qzz_len, 0, 0, 0); \
+ _qzz_res; \
+ }))
+
+/* Similarly, mark memory at _qzz_addr as addressable and defined
+ for _qzz_len bytes. */
+#define VALGRIND_MAKE_MEM_DEFINED(_qzz_addr,_qzz_len) \
+ (__extension__({unsigned long _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+ VG_USERREQ__MAKE_MEM_DEFINED, \
+ _qzz_addr, _qzz_len, 0, 0, 0); \
+ _qzz_res; \
+ }))
+
+/* Similar to VALGRIND_MAKE_MEM_DEFINED except that addressability is
+ not altered: bytes which are addressable are marked as defined,
+ but those which are not addressable are left unchanged. */
+#define VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(_qzz_addr,_qzz_len) \
+ (__extension__({unsigned long _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+ VG_USERREQ__MAKE_MEM_DEFINED_IF_ADDRESSABLE, \
+ _qzz_addr, _qzz_len, 0, 0, 0); \
+ _qzz_res; \
+ }))
+
+/* Create a block-description handle. The description is an ascii
+ string which is included in any messages pertaining to addresses
+ within the specified memory range. Has no other effect on the
+ properties of the memory range. */
+#define VALGRIND_CREATE_BLOCK(_qzz_addr,_qzz_len, _qzz_desc) \
+ (__extension__({unsigned long _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+ VG_USERREQ__CREATE_BLOCK, \
+ _qzz_addr, _qzz_len, _qzz_desc, \
+ 0, 0); \
+ _qzz_res; \
+ }))
+
+/* Discard a block-description-handle. Returns 1 for an
+ invalid handle, 0 for a valid handle. */
+#define VALGRIND_DISCARD(_qzz_blkindex) \
+ (__extension__ ({unsigned long _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+ VG_USERREQ__DISCARD, \
+ 0, _qzz_blkindex, 0, 0, 0); \
+ _qzz_res; \
+ }))
+
+
+/* Client-code macros to check the state of memory. */
+
+/* Check that memory at _qzz_addr is addressable for _qzz_len bytes.
+ If suitable addressibility is not established, Valgrind prints an
+ error message and returns the address of the first offending byte.
+ Otherwise it returns zero. */
+#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(_qzz_addr,_qzz_len) \
+ (__extension__({unsigned long _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__CHECK_MEM_IS_ADDRESSABLE,\
+ _qzz_addr, _qzz_len, 0, 0, 0); \
+ _qzz_res; \
+ }))
+
+/* Check that memory at _qzz_addr is addressable and defined for
+ _qzz_len bytes. If suitable addressibility and definedness are not
+ established, Valgrind prints an error message and returns the
+ address of the first offending byte. Otherwise it returns zero. */
+#define VALGRIND_CHECK_MEM_IS_DEFINED(_qzz_addr,_qzz_len) \
+ (__extension__({unsigned long _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__CHECK_MEM_IS_DEFINED, \
+ _qzz_addr, _qzz_len, 0, 0, 0); \
+ _qzz_res; \
+ }))
+
+/* Use this macro to force the definedness and addressibility of an
+ lvalue to be checked. If suitable addressibility and definedness
+ are not established, Valgrind prints an error message and returns
+ the address of the first offending byte. Otherwise it returns
+ zero. */
+#define VALGRIND_CHECK_VALUE_IS_DEFINED(__lvalue) \
+ VALGRIND_CHECK_MEM_IS_DEFINED( \
+ (volatile unsigned char *)&(__lvalue), \
+ (unsigned long)(sizeof (__lvalue)))
+
+
+/* Do a memory leak check mid-execution. */
+#define VALGRIND_DO_LEAK_CHECK \
+ {unsigned long _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__DO_LEAK_CHECK, \
+ 0, 0, 0, 0, 0); \
+ }
+
+/* Just display summaries of leaked memory, rather than all the
+ details */
+#define VALGRIND_DO_QUICK_LEAK_CHECK \
+ {unsigned long _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__DO_LEAK_CHECK, \
+ 1, 0, 0, 0, 0); \
+ }
+
+/* Return number of leaked, dubious, reachable and suppressed bytes found by
+ all previous leak checks. They must be lvalues. */
+#define VALGRIND_COUNT_LEAKS(leaked, dubious, reachable, suppressed) \
+ /* For safety on 64-bit platforms we assign the results to private
+ unsigned long variables, then assign these to the lvalues the user
+ specified, which works no matter what type 'leaked', 'dubious', etc
+ are. We also initialise '_qzz_leaked', etc because
+ VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as
+ initialised. */ \
+ {unsigned long _qzz_res; \
+ unsigned long _qzz_leaked = 0, _qzz_dubious = 0; \
+ unsigned long _qzz_reachable = 0, _qzz_suppressed = 0; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__COUNT_LEAKS, \
+ &_qzz_leaked, &_qzz_dubious, \
+ &_qzz_reachable, &_qzz_suppressed, 0); \
+ leaked = _qzz_leaked; \
+ dubious = _qzz_dubious; \
+ reachable = _qzz_reachable; \
+ suppressed = _qzz_suppressed; \
+ }
+
+
+/* Get the validity data for addresses [zza..zza+zznbytes-1] and copy it
+ into the provided zzvbits array. Return values:
+ 0 if not running on valgrind
+ 1 success
+ 2 [previously indicated unaligned arrays; these are now allowed]
+ 3 if any parts of zzsrc/zzvbits are not addressable.
+ The metadata is not copied in cases 0, 2 or 3 so it should be
+ impossible to segfault your system by using this call.
+*/
+#define VALGRIND_GET_VBITS(zza,zzvbits,zznbytes) \
+ (__extension__({unsigned long _qzz_res; \
+ char* czza = (char*)zza; \
+ char* czzvbits = (char*)zzvbits; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__GET_VBITS, \
+ czza, czzvbits, zznbytes, 0, 0 ); \
+ _qzz_res; \
+ }))
+
+/* Set the validity data for addresses [zza..zza+zznbytes-1], copying it
+ from the provided zzvbits array. Return values:
+ 0 if not running on valgrind
+ 1 success
+ 2 [previously indicated unaligned arrays; these are now allowed]
+ 3 if any parts of zza/zzvbits are not addressable.
+ The metadata is not copied in cases 0, 2 or 3 so it should be
+ impossible to segfault your system by using this call.
+*/
+#define VALGRIND_SET_VBITS(zza,zzvbits,zznbytes) \
+ (__extension__({unsigned int _qzz_res; \
+ char* czza = (char*)zza; \
+ char* czzvbits = (char*)zzvbits; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__SET_VBITS, \
+ czza, czzvbits, zznbytes, 0, 0 ); \
+ _qzz_res; \
+ }))
+
+/* Enable or disable OOM simulation. */
+#define VALGRIND_ENABLE_OOM_AT_ALLOC_INDEX(index) \
+ (__extension__ ({unsigned long _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+ VG_USERREQ__ENABLE_OOM, \
+ 1, index, 0, 0, 0); \
+ _qzz_res; \
+ }))
+
+#define VALGRIND_DISABLE_OOM_AT_ALLOC_INDEX(index) \
+ (__extension__ ({unsigned long _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+ VG_USERREQ__ENABLE_OOM, \
+ 0, index, 0, 0, 0); \
+ _qzz_res; \
+ }))
+
+/* Get the current allocation index. */
+#define VALGRIND_GET_ALLOC_INDEX \
+ (__extension__ ({unsigned long _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, -1 /* default return */, \
+ VG_USERREQ__GET_ALLOC_INDEX, \
+ 0, 0, 0, 0, 0); \
+ _qzz_res; \
+ }))
+
+
+#endif
+
diff --git a/tests/auto/exceptionsafety_objects/3rdparty/valgrind.h b/tests/auto/exceptionsafety_objects/3rdparty/valgrind.h
new file mode 100644
index 0000000..577c59a
--- /dev/null
+++ b/tests/auto/exceptionsafety_objects/3rdparty/valgrind.h
@@ -0,0 +1,3924 @@
+/* -*- c -*-
+ ----------------------------------------------------------------
+
+ Notice that the following BSD-style license applies to this one
+ file (valgrind.h) only. The rest of Valgrind is licensed under the
+ terms of the GNU General Public License, version 2, unless
+ otherwise indicated. See the COPYING file in the source
+ distribution for details.
+
+ ----------------------------------------------------------------
+
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2000-2008 Julian Seward. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. The origin of this software must not be misrepresented; you must
+ not claim that you wrote the original software. If you use this
+ software in a product, an acknowledgment in the product
+ documentation would be appreciated but is not required.
+
+ 3. Altered source versions must be plainly marked as such, and must
+ not be misrepresented as being the original software.
+
+ 4. The name of the author may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ----------------------------------------------------------------
+
+ Notice that the above BSD-style license applies to this one file
+ (valgrind.h) only. The entire rest of Valgrind is licensed under
+ the terms of the GNU General Public License, version 2. See the
+ COPYING file in the source distribution for details.
+
+ ----------------------------------------------------------------
+*/
+
+
+/* This file is for inclusion into client (your!) code.
+
+ You can use these macros to manipulate and query Valgrind's
+ execution inside your own programs.
+
+ The resulting executables will still run without Valgrind, just a
+ little bit more slowly than they otherwise would, but otherwise
+ unchanged. When not running on valgrind, each client request
+ consumes very few (eg. 7) instructions, so the resulting performance
+ loss is negligible unless you plan to execute client requests
+ millions of times per second. Nevertheless, if that is still a
+ problem, you can compile with the NVALGRIND symbol defined (gcc
+ -DNVALGRIND) so that client requests are not even compiled in. */
+
+#ifndef __VALGRIND_H
+#define __VALGRIND_H
+
+#include <stdarg.h>
+
+/* Nb: this file might be included in a file compiled with -ansi. So
+ we can't use C++ style "//" comments nor the "asm" keyword (instead
+ use "__asm__"). */
+
+/* Derive some tags indicating what the target platform is. Note
+ that in this file we're using the compiler's CPP symbols for
+ identifying architectures, which are different to the ones we use
+ within the rest of Valgrind. Note, __powerpc__ is active for both
+ 32 and 64-bit PPC, whereas __powerpc64__ is only active for the
+ latter (on Linux, that is). */
+#undef PLAT_x86_linux
+#undef PLAT_amd64_linux
+#undef PLAT_ppc32_linux
+#undef PLAT_ppc64_linux
+#undef PLAT_ppc32_aix5
+#undef PLAT_ppc64_aix5
+
+#if !defined(_AIX) && defined(__i386__)
+# define PLAT_x86_linux 1
+#elif !defined(_AIX) && defined(__x86_64__)
+# define PLAT_amd64_linux 1
+#elif !defined(_AIX) && defined(__powerpc__) && !defined(__powerpc64__)
+# define PLAT_ppc32_linux 1
+#elif !defined(_AIX) && defined(__powerpc__) && defined(__powerpc64__)
+# define PLAT_ppc64_linux 1
+#elif defined(_AIX) && defined(__64BIT__)
+# define PLAT_ppc64_aix5 1
+#elif defined(_AIX) && !defined(__64BIT__)
+# define PLAT_ppc32_aix5 1
+#endif
+
+
+/* If we're not compiling for our target platform, don't generate
+ any inline asms. */
+#if !defined(PLAT_x86_linux) && !defined(PLAT_amd64_linux) \
+ && !defined(PLAT_ppc32_linux) && !defined(PLAT_ppc64_linux) \
+ && !defined(PLAT_ppc32_aix5) && !defined(PLAT_ppc64_aix5)
+# if !defined(NVALGRIND)
+# define NVALGRIND 1
+# endif
+#endif
+
+
+/* ------------------------------------------------------------------ */
+/* ARCHITECTURE SPECIFICS for SPECIAL INSTRUCTIONS. There is nothing */
+/* in here of use to end-users -- skip to the next section. */
+/* ------------------------------------------------------------------ */
+
+#if defined(NVALGRIND)
+
+/* Define NVALGRIND to completely remove the Valgrind magic sequence
+ from the compiled code (analogous to NDEBUG's effects on
+ assert()) */
+#define VALGRIND_DO_CLIENT_REQUEST( \
+ _zzq_rlval, _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
+ { \
+ (_zzq_rlval) = (_zzq_default); \
+ }
+
+#else /* ! NVALGRIND */
+
+/* The following defines the magic code sequences which the JITter
+ spots and handles magically. Don't look too closely at them as
+ they will rot your brain.
+
+ The assembly code sequences for all architectures is in this one
+ file. This is because this file must be stand-alone, and we don't
+ want to have multiple files.
+
+ For VALGRIND_DO_CLIENT_REQUEST, we must ensure that the default
+ value gets put in the return slot, so that everything works when
+ this is executed not under Valgrind. Args are passed in a memory
+ block, and so there's no intrinsic limit to the number that could
+ be passed, but it's currently five.
+
+ The macro args are:
+ _zzq_rlval result lvalue
+ _zzq_default default value (result returned when running on real CPU)
+ _zzq_request request code
+ _zzq_arg1..5 request params
+
+ The other two macros are used to support function wrapping, and are
+ a lot simpler. VALGRIND_GET_NR_CONTEXT returns the value of the
+ guest's NRADDR pseudo-register and whatever other information is
+ needed to safely run the call original from the wrapper: on
+ ppc64-linux, the R2 value at the divert point is also needed. This
+ information is abstracted into a user-visible type, OrigFn.
+
+ VALGRIND_CALL_NOREDIR_* behaves the same as the following on the
+ guest, but guarantees that the branch instruction will not be
+ redirected: x86: call *%eax, amd64: call *%rax, ppc32/ppc64:
+ branch-and-link-to-r11. VALGRIND_CALL_NOREDIR is just text, not a
+ complete inline asm, since it needs to be combined with more magic
+ inline asm stuff to be useful.
+*/
+
+/* ------------------------- x86-linux ------------------------- */
+
+#if defined(PLAT_x86_linux)
+
+typedef
+ struct {
+ unsigned int nraddr; /* where's the code? */
+ }
+ OrigFn;
+
+#define __SPECIAL_INSTRUCTION_PREAMBLE \
+ "roll $3, %%edi ; roll $13, %%edi\n\t" \
+ "roll $29, %%edi ; roll $19, %%edi\n\t"
+
+#define VALGRIND_DO_CLIENT_REQUEST( \
+ _zzq_rlval, _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
+ { volatile unsigned int _zzq_args[6]; \
+ volatile unsigned int _zzq_result; \
+ _zzq_args[0] = (unsigned int)(_zzq_request); \
+ _zzq_args[1] = (unsigned int)(_zzq_arg1); \
+ _zzq_args[2] = (unsigned int)(_zzq_arg2); \
+ _zzq_args[3] = (unsigned int)(_zzq_arg3); \
+ _zzq_args[4] = (unsigned int)(_zzq_arg4); \
+ _zzq_args[5] = (unsigned int)(_zzq_arg5); \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %EDX = client_request ( %EAX ) */ \
+ "xchgl %%ebx,%%ebx" \
+ : "=d" (_zzq_result) \
+ : "a" (&_zzq_args[0]), "0" (_zzq_default) \
+ : "cc", "memory" \
+ ); \
+ _zzq_rlval = _zzq_result; \
+ }
+
+#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
+ { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
+ volatile unsigned int __addr; \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %EAX = guest_NRADDR */ \
+ "xchgl %%ecx,%%ecx" \
+ : "=a" (__addr) \
+ : \
+ : "cc", "memory" \
+ ); \
+ _zzq_orig->nraddr = __addr; \
+ }
+
+#define VALGRIND_CALL_NOREDIR_EAX \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
+ /* call-noredir *%EAX */ \
+ "xchgl %%edx,%%edx\n\t"
+#endif /* PLAT_x86_linux */
+
+/* ------------------------ amd64-linux ------------------------ */
+
+#if defined(PLAT_amd64_linux)
+
+typedef
+ struct {
+ unsigned long long int nraddr; /* where's the code? */
+ }
+ OrigFn;
+
+#define __SPECIAL_INSTRUCTION_PREAMBLE \
+ "rolq $3, %%rdi ; rolq $13, %%rdi\n\t" \
+ "rolq $61, %%rdi ; rolq $51, %%rdi\n\t"
+
+#define VALGRIND_DO_CLIENT_REQUEST( \
+ _zzq_rlval, _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
+ { volatile unsigned long long int _zzq_args[6]; \
+ volatile unsigned long long int _zzq_result; \
+ _zzq_args[0] = (unsigned long long int)(_zzq_request); \
+ _zzq_args[1] = (unsigned long long int)(_zzq_arg1); \
+ _zzq_args[2] = (unsigned long long int)(_zzq_arg2); \
+ _zzq_args[3] = (unsigned long long int)(_zzq_arg3); \
+ _zzq_args[4] = (unsigned long long int)(_zzq_arg4); \
+ _zzq_args[5] = (unsigned long long int)(_zzq_arg5); \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %RDX = client_request ( %RAX ) */ \
+ "xchgq %%rbx,%%rbx" \
+ : "=d" (_zzq_result) \
+ : "a" (&_zzq_args[0]), "0" (_zzq_default) \
+ : "cc", "memory" \
+ ); \
+ _zzq_rlval = _zzq_result; \
+ }
+
+#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
+ { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
+ volatile unsigned long long int __addr; \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %RAX = guest_NRADDR */ \
+ "xchgq %%rcx,%%rcx" \
+ : "=a" (__addr) \
+ : \
+ : "cc", "memory" \
+ ); \
+ _zzq_orig->nraddr = __addr; \
+ }
+
+#define VALGRIND_CALL_NOREDIR_RAX \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
+ /* call-noredir *%RAX */ \
+ "xchgq %%rdx,%%rdx\n\t"
+#endif /* PLAT_amd64_linux */
+
+/* ------------------------ ppc32-linux ------------------------ */
+
+#if defined(PLAT_ppc32_linux)
+
+typedef
+ struct {
+ unsigned int nraddr; /* where's the code? */
+ }
+ OrigFn;
+
+#define __SPECIAL_INSTRUCTION_PREAMBLE \
+ "rlwinm 0,0,3,0,0 ; rlwinm 0,0,13,0,0\n\t" \
+ "rlwinm 0,0,29,0,0 ; rlwinm 0,0,19,0,0\n\t"
+
+#define VALGRIND_DO_CLIENT_REQUEST( \
+ _zzq_rlval, _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
+ \
+ { unsigned int _zzq_args[6]; \
+ unsigned int _zzq_result; \
+ unsigned int* _zzq_ptr; \
+ _zzq_args[0] = (unsigned int)(_zzq_request); \
+ _zzq_args[1] = (unsigned int)(_zzq_arg1); \
+ _zzq_args[2] = (unsigned int)(_zzq_arg2); \
+ _zzq_args[3] = (unsigned int)(_zzq_arg3); \
+ _zzq_args[4] = (unsigned int)(_zzq_arg4); \
+ _zzq_args[5] = (unsigned int)(_zzq_arg5); \
+ _zzq_ptr = _zzq_args; \
+ __asm__ volatile("mr 3,%1\n\t" /*default*/ \
+ "mr 4,%2\n\t" /*ptr*/ \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 = client_request ( %R4 ) */ \
+ "or 1,1,1\n\t" \
+ "mr %0,3" /*result*/ \
+ : "=b" (_zzq_result) \
+ : "b" (_zzq_default), "b" (_zzq_ptr) \
+ : "cc", "memory", "r3", "r4"); \
+ _zzq_rlval = _zzq_result; \
+ }
+
+#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
+ { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
+ unsigned int __addr; \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 = guest_NRADDR */ \
+ "or 2,2,2\n\t" \
+ "mr %0,3" \
+ : "=b" (__addr) \
+ : \
+ : "cc", "memory", "r3" \
+ ); \
+ _zzq_orig->nraddr = __addr; \
+ }
+
+#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
+ /* branch-and-link-to-noredir *%R11 */ \
+ "or 3,3,3\n\t"
+#endif /* PLAT_ppc32_linux */
+
+/* ------------------------ ppc64-linux ------------------------ */
+
+#if defined(PLAT_ppc64_linux)
+
+typedef
+ struct {
+ unsigned long long int nraddr; /* where's the code? */
+ unsigned long long int r2; /* what tocptr do we need? */
+ }
+ OrigFn;
+
+#define __SPECIAL_INSTRUCTION_PREAMBLE \
+ "rotldi 0,0,3 ; rotldi 0,0,13\n\t" \
+ "rotldi 0,0,61 ; rotldi 0,0,51\n\t"
+
+#define VALGRIND_DO_CLIENT_REQUEST( \
+ _zzq_rlval, _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
+ \
+ { unsigned long long int _zzq_args[6]; \
+ register unsigned long long int _zzq_result __asm__("r3"); \
+ register unsigned long long int* _zzq_ptr __asm__("r4"); \
+ _zzq_args[0] = (unsigned long long int)(_zzq_request); \
+ _zzq_args[1] = (unsigned long long int)(_zzq_arg1); \
+ _zzq_args[2] = (unsigned long long int)(_zzq_arg2); \
+ _zzq_args[3] = (unsigned long long int)(_zzq_arg3); \
+ _zzq_args[4] = (unsigned long long int)(_zzq_arg4); \
+ _zzq_args[5] = (unsigned long long int)(_zzq_arg5); \
+ _zzq_ptr = _zzq_args; \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 = client_request ( %R4 ) */ \
+ "or 1,1,1" \
+ : "=r" (_zzq_result) \
+ : "0" (_zzq_default), "r" (_zzq_ptr) \
+ : "cc", "memory"); \
+ _zzq_rlval = _zzq_result; \
+ }
+
+#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
+ { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
+ register unsigned long long int __addr __asm__("r3"); \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 = guest_NRADDR */ \
+ "or 2,2,2" \
+ : "=r" (__addr) \
+ : \
+ : "cc", "memory" \
+ ); \
+ _zzq_orig->nraddr = __addr; \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 = guest_NRADDR_GPR2 */ \
+ "or 4,4,4" \
+ : "=r" (__addr) \
+ : \
+ : "cc", "memory" \
+ ); \
+ _zzq_orig->r2 = __addr; \
+ }
+
+#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
+ /* branch-and-link-to-noredir *%R11 */ \
+ "or 3,3,3\n\t"
+
+#endif /* PLAT_ppc64_linux */
+
+/* ------------------------ ppc32-aix5 ------------------------- */
+
+#if defined(PLAT_ppc32_aix5)
+
+typedef
+ struct {
+ unsigned int nraddr; /* where's the code? */
+ unsigned int r2; /* what tocptr do we need? */
+ }
+ OrigFn;
+
+#define __SPECIAL_INSTRUCTION_PREAMBLE \
+ "rlwinm 0,0,3,0,0 ; rlwinm 0,0,13,0,0\n\t" \
+ "rlwinm 0,0,29,0,0 ; rlwinm 0,0,19,0,0\n\t"
+
+#define VALGRIND_DO_CLIENT_REQUEST( \
+ _zzq_rlval, _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
+ \
+ { unsigned int _zzq_args[7]; \
+ register unsigned int _zzq_result; \
+ register unsigned int* _zzq_ptr; \
+ _zzq_args[0] = (unsigned int)(_zzq_request); \
+ _zzq_args[1] = (unsigned int)(_zzq_arg1); \
+ _zzq_args[2] = (unsigned int)(_zzq_arg2); \
+ _zzq_args[3] = (unsigned int)(_zzq_arg3); \
+ _zzq_args[4] = (unsigned int)(_zzq_arg4); \
+ _zzq_args[5] = (unsigned int)(_zzq_arg5); \
+ _zzq_args[6] = (unsigned int)(_zzq_default); \
+ _zzq_ptr = _zzq_args; \
+ __asm__ volatile("mr 4,%1\n\t" \
+ "lwz 3, 24(4)\n\t" \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 = client_request ( %R4 ) */ \
+ "or 1,1,1\n\t" \
+ "mr %0,3" \
+ : "=b" (_zzq_result) \
+ : "b" (_zzq_ptr) \
+ : "r3", "r4", "cc", "memory"); \
+ _zzq_rlval = _zzq_result; \
+ }
+
+#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
+ { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
+ register unsigned int __addr; \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 = guest_NRADDR */ \
+ "or 2,2,2\n\t" \
+ "mr %0,3" \
+ : "=b" (__addr) \
+ : \
+ : "r3", "cc", "memory" \
+ ); \
+ _zzq_orig->nraddr = __addr; \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 = guest_NRADDR_GPR2 */ \
+ "or 4,4,4\n\t" \
+ "mr %0,3" \
+ : "=b" (__addr) \
+ : \
+ : "r3", "cc", "memory" \
+ ); \
+ _zzq_orig->r2 = __addr; \
+ }
+
+#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
+ /* branch-and-link-to-noredir *%R11 */ \
+ "or 3,3,3\n\t"
+
+#endif /* PLAT_ppc32_aix5 */
+
+/* ------------------------ ppc64-aix5 ------------------------- */
+
+#if defined(PLAT_ppc64_aix5)
+
+typedef
+ struct {
+ unsigned long long int nraddr; /* where's the code? */
+ unsigned long long int r2; /* what tocptr do we need? */
+ }
+ OrigFn;
+
+#define __SPECIAL_INSTRUCTION_PREAMBLE \
+ "rotldi 0,0,3 ; rotldi 0,0,13\n\t" \
+ "rotldi 0,0,61 ; rotldi 0,0,51\n\t"
+
+#define VALGRIND_DO_CLIENT_REQUEST( \
+ _zzq_rlval, _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
+ \
+ { unsigned long long int _zzq_args[7]; \
+ register unsigned long long int _zzq_result; \
+ register unsigned long long int* _zzq_ptr; \
+ _zzq_args[0] = (unsigned int long long)(_zzq_request); \
+ _zzq_args[1] = (unsigned int long long)(_zzq_arg1); \
+ _zzq_args[2] = (unsigned int long long)(_zzq_arg2); \
+ _zzq_args[3] = (unsigned int long long)(_zzq_arg3); \
+ _zzq_args[4] = (unsigned int long long)(_zzq_arg4); \
+ _zzq_args[5] = (unsigned int long long)(_zzq_arg5); \
+ _zzq_args[6] = (unsigned int long long)(_zzq_default); \
+ _zzq_ptr = _zzq_args; \
+ __asm__ volatile("mr 4,%1\n\t" \
+ "ld 3, 48(4)\n\t" \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 = client_request ( %R4 ) */ \
+ "or 1,1,1\n\t" \
+ "mr %0,3" \
+ : "=b" (_zzq_result) \
+ : "b" (_zzq_ptr) \
+ : "r3", "r4", "cc", "memory"); \
+ _zzq_rlval = _zzq_result; \
+ }
+
+#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
+ { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
+ register unsigned long long int __addr; \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 = guest_NRADDR */ \
+ "or 2,2,2\n\t" \
+ "mr %0,3" \
+ : "=b" (__addr) \
+ : \
+ : "r3", "cc", "memory" \
+ ); \
+ _zzq_orig->nraddr = __addr; \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %R3 = guest_NRADDR_GPR2 */ \
+ "or 4,4,4\n\t" \
+ "mr %0,3" \
+ : "=b" (__addr) \
+ : \
+ : "r3", "cc", "memory" \
+ ); \
+ _zzq_orig->r2 = __addr; \
+ }
+
+#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
+ /* branch-and-link-to-noredir *%R11 */ \
+ "or 3,3,3\n\t"
+
+#endif /* PLAT_ppc64_aix5 */
+
+/* Insert assembly code for other platforms here... */
+
+#endif /* NVALGRIND */
+
+
+/* ------------------------------------------------------------------ */
+/* PLATFORM SPECIFICS for FUNCTION WRAPPING. This is all very */
+/* ugly. It's the least-worst tradeoff I can think of. */
+/* ------------------------------------------------------------------ */
+
+/* This section defines magic (a.k.a appalling-hack) macros for doing
+ guaranteed-no-redirection macros, so as to get from function
+ wrappers to the functions they are wrapping. The whole point is to
+ construct standard call sequences, but to do the call itself with a
+ special no-redirect call pseudo-instruction that the JIT
+ understands and handles specially. This section is long and
+ repetitious, and I can't see a way to make it shorter.
+
+ The naming scheme is as follows:
+
+ CALL_FN_{W,v}_{v,W,WW,WWW,WWWW,5W,6W,7W,etc}
+
+ 'W' stands for "word" and 'v' for "void". Hence there are
+ different macros for calling arity 0, 1, 2, 3, 4, etc, functions,
+ and for each, the possibility of returning a word-typed result, or
+ no result.
+*/
+
+/* Use these to write the name of your wrapper. NOTE: duplicates
+ VG_WRAP_FUNCTION_Z{U,Z} in pub_tool_redir.h. */
+
+#define I_WRAP_SONAME_FNNAME_ZU(soname,fnname) \
+ _vgwZU_##soname##_##fnname
+
+#define I_WRAP_SONAME_FNNAME_ZZ(soname,fnname) \
+ _vgwZZ_##soname##_##fnname
+
+/* Use this macro from within a wrapper function to collect the
+ context (address and possibly other info) of the original function.
+ Once you have that you can then use it in one of the CALL_FN_
+ macros. The type of the argument _lval is OrigFn. */
+#define VALGRIND_GET_ORIG_FN(_lval) VALGRIND_GET_NR_CONTEXT(_lval)
+
+/* Derivatives of the main macros below, for calling functions
+ returning void. */
+
+#define CALL_FN_v_v(fnptr) \
+ do { volatile unsigned long _junk; \
+ CALL_FN_W_v(_junk,fnptr); } while (0)
+
+#define CALL_FN_v_W(fnptr, arg1) \
+ do { volatile unsigned long _junk; \
+ CALL_FN_W_W(_junk,fnptr,arg1); } while (0)
+
+#define CALL_FN_v_WW(fnptr, arg1,arg2) \
+ do { volatile unsigned long _junk; \
+ CALL_FN_W_WW(_junk,fnptr,arg1,arg2); } while (0)
+
+#define CALL_FN_v_WWW(fnptr, arg1,arg2,arg3) \
+ do { volatile unsigned long _junk; \
+ CALL_FN_W_WWW(_junk,fnptr,arg1,arg2,arg3); } while (0)
+
+/* ------------------------- x86-linux ------------------------- */
+
+#if defined(PLAT_x86_linux)
+
+/* These regs are trashed by the hidden call. No need to mention eax
+ as gcc can already see that, plus causes gcc to bomb. */
+#define __CALLER_SAVED_REGS /*"eax"*/ "ecx", "edx"
+
+/* These CALL_FN_ macros assume that on x86-linux, sizeof(unsigned
+ long) == 4. */
+
+#define CALL_FN_W_v(lval, orig) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[1]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ __asm__ volatile( \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_W(lval, orig, arg1) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[2]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ __asm__ volatile( \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $4, %%esp\n" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ __asm__ volatile( \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $8, %%esp\n" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[4]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ __asm__ volatile( \
+ "pushl 12(%%eax)\n\t" \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $12, %%esp\n" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[5]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ __asm__ volatile( \
+ "pushl 16(%%eax)\n\t" \
+ "pushl 12(%%eax)\n\t" \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $16, %%esp\n" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[6]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ __asm__ volatile( \
+ "pushl 20(%%eax)\n\t" \
+ "pushl 16(%%eax)\n\t" \
+ "pushl 12(%%eax)\n\t" \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $20, %%esp\n" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[7]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ __asm__ volatile( \
+ "pushl 24(%%eax)\n\t" \
+ "pushl 20(%%eax)\n\t" \
+ "pushl 16(%%eax)\n\t" \
+ "pushl 12(%%eax)\n\t" \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $24, %%esp\n" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[8]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ __asm__ volatile( \
+ "pushl 28(%%eax)\n\t" \
+ "pushl 24(%%eax)\n\t" \
+ "pushl 20(%%eax)\n\t" \
+ "pushl 16(%%eax)\n\t" \
+ "pushl 12(%%eax)\n\t" \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $28, %%esp\n" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[9]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ __asm__ volatile( \
+ "pushl 32(%%eax)\n\t" \
+ "pushl 28(%%eax)\n\t" \
+ "pushl 24(%%eax)\n\t" \
+ "pushl 20(%%eax)\n\t" \
+ "pushl 16(%%eax)\n\t" \
+ "pushl 12(%%eax)\n\t" \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $32, %%esp\n" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[10]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ __asm__ volatile( \
+ "pushl 36(%%eax)\n\t" \
+ "pushl 32(%%eax)\n\t" \
+ "pushl 28(%%eax)\n\t" \
+ "pushl 24(%%eax)\n\t" \
+ "pushl 20(%%eax)\n\t" \
+ "pushl 16(%%eax)\n\t" \
+ "pushl 12(%%eax)\n\t" \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $36, %%esp\n" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[11]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ _argvec[10] = (unsigned long)(arg10); \
+ __asm__ volatile( \
+ "pushl 40(%%eax)\n\t" \
+ "pushl 36(%%eax)\n\t" \
+ "pushl 32(%%eax)\n\t" \
+ "pushl 28(%%eax)\n\t" \
+ "pushl 24(%%eax)\n\t" \
+ "pushl 20(%%eax)\n\t" \
+ "pushl 16(%%eax)\n\t" \
+ "pushl 12(%%eax)\n\t" \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $40, %%esp\n" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
+ arg6,arg7,arg8,arg9,arg10, \
+ arg11) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[12]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ _argvec[10] = (unsigned long)(arg10); \
+ _argvec[11] = (unsigned long)(arg11); \
+ __asm__ volatile( \
+ "pushl 44(%%eax)\n\t" \
+ "pushl 40(%%eax)\n\t" \
+ "pushl 36(%%eax)\n\t" \
+ "pushl 32(%%eax)\n\t" \
+ "pushl 28(%%eax)\n\t" \
+ "pushl 24(%%eax)\n\t" \
+ "pushl 20(%%eax)\n\t" \
+ "pushl 16(%%eax)\n\t" \
+ "pushl 12(%%eax)\n\t" \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $44, %%esp\n" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
+ arg6,arg7,arg8,arg9,arg10, \
+ arg11,arg12) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[13]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ _argvec[10] = (unsigned long)(arg10); \
+ _argvec[11] = (unsigned long)(arg11); \
+ _argvec[12] = (unsigned long)(arg12); \
+ __asm__ volatile( \
+ "pushl 48(%%eax)\n\t" \
+ "pushl 44(%%eax)\n\t" \
+ "pushl 40(%%eax)\n\t" \
+ "pushl 36(%%eax)\n\t" \
+ "pushl 32(%%eax)\n\t" \
+ "pushl 28(%%eax)\n\t" \
+ "pushl 24(%%eax)\n\t" \
+ "pushl 20(%%eax)\n\t" \
+ "pushl 16(%%eax)\n\t" \
+ "pushl 12(%%eax)\n\t" \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $48, %%esp\n" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#endif /* PLAT_x86_linux */
+
+/* ------------------------ amd64-linux ------------------------ */
+
+#if defined(PLAT_amd64_linux)
+
+/* ARGREGS: rdi rsi rdx rcx r8 r9 (the rest on stack in R-to-L order) */
+
+/* These regs are trashed by the hidden call. */
+#define __CALLER_SAVED_REGS /*"rax",*/ "rcx", "rdx", "rsi", \
+ "rdi", "r8", "r9", "r10", "r11"
+
+/* These CALL_FN_ macros assume that on amd64-linux, sizeof(unsigned
+ long) == 8. */
+
+/* NB 9 Sept 07. There is a nasty kludge here in all these CALL_FN_
+ macros. In order not to trash the stack redzone, we need to drop
+ %rsp by 128 before the hidden call, and restore afterwards. The
+ nastyness is that it is only by luck that the stack still appears
+ to be unwindable during the hidden call - since then the behaviour
+ of any routine using this macro does not match what the CFI data
+ says. Sigh.
+
+ Why is this important? Imagine that a wrapper has a stack
+ allocated local, and passes to the hidden call, a pointer to it.
+ Because gcc does not know about the hidden call, it may allocate
+ that local in the redzone. Unfortunately the hidden call may then
+ trash it before it comes to use it. So we must step clear of the
+ redzone, for the duration of the hidden call, to make it safe.
+
+ Probably the same problem afflicts the other redzone-style ABIs too
+ (ppc64-linux, ppc32-aix5, ppc64-aix5); but for those, the stack is
+ self describing (none of this CFI nonsense) so at least messing
+ with the stack pointer doesn't give a danger of non-unwindable
+ stack. */
+
+#define CALL_FN_W_v(lval, orig) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[1]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ __asm__ volatile( \
+ "subq $128,%%rsp\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ "addq $128,%%rsp\n\t" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_W(lval, orig, arg1) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[2]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ __asm__ volatile( \
+ "subq $128,%%rsp\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ "addq $128,%%rsp\n\t" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ __asm__ volatile( \
+ "subq $128,%%rsp\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ "addq $128,%%rsp\n\t" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[4]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ __asm__ volatile( \
+ "subq $128,%%rsp\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ "addq $128,%%rsp\n\t" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[5]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ __asm__ volatile( \
+ "subq $128,%%rsp\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ "addq $128,%%rsp\n\t" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[6]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ __asm__ volatile( \
+ "subq $128,%%rsp\n\t" \
+ "movq 40(%%rax), %%r8\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ "addq $128,%%rsp\n\t" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[7]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ __asm__ volatile( \
+ "subq $128,%%rsp\n\t" \
+ "movq 48(%%rax), %%r9\n\t" \
+ "movq 40(%%rax), %%r8\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ "addq $128,%%rsp\n\t" \
+ VALGRIND_CALL_NOREDIR_RAX \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[8]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ __asm__ volatile( \
+ "subq $128,%%rsp\n\t" \
+ "pushq 56(%%rax)\n\t" \
+ "movq 48(%%rax), %%r9\n\t" \
+ "movq 40(%%rax), %%r8\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ "addq $8, %%rsp\n" \
+ "addq $128,%%rsp\n\t" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[9]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ __asm__ volatile( \
+ "subq $128,%%rsp\n\t" \
+ "pushq 64(%%rax)\n\t" \
+ "pushq 56(%%rax)\n\t" \
+ "movq 48(%%rax), %%r9\n\t" \
+ "movq 40(%%rax), %%r8\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ "addq $16, %%rsp\n" \
+ "addq $128,%%rsp\n\t" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[10]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ __asm__ volatile( \
+ "subq $128,%%rsp\n\t" \
+ "pushq 72(%%rax)\n\t" \
+ "pushq 64(%%rax)\n\t" \
+ "pushq 56(%%rax)\n\t" \
+ "movq 48(%%rax), %%r9\n\t" \
+ "movq 40(%%rax), %%r8\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ "addq $24, %%rsp\n" \
+ "addq $128,%%rsp\n\t" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[11]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ _argvec[10] = (unsigned long)(arg10); \
+ __asm__ volatile( \
+ "subq $128,%%rsp\n\t" \
+ "pushq 80(%%rax)\n\t" \
+ "pushq 72(%%rax)\n\t" \
+ "pushq 64(%%rax)\n\t" \
+ "pushq 56(%%rax)\n\t" \
+ "movq 48(%%rax), %%r9\n\t" \
+ "movq 40(%%rax), %%r8\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ "addq $32, %%rsp\n" \
+ "addq $128,%%rsp\n\t" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10,arg11) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[12]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ _argvec[10] = (unsigned long)(arg10); \
+ _argvec[11] = (unsigned long)(arg11); \
+ __asm__ volatile( \
+ "subq $128,%%rsp\n\t" \
+ "pushq 88(%%rax)\n\t" \
+ "pushq 80(%%rax)\n\t" \
+ "pushq 72(%%rax)\n\t" \
+ "pushq 64(%%rax)\n\t" \
+ "pushq 56(%%rax)\n\t" \
+ "movq 48(%%rax), %%r9\n\t" \
+ "movq 40(%%rax), %%r8\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ "addq $40, %%rsp\n" \
+ "addq $128,%%rsp\n\t" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10,arg11,arg12) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[13]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ _argvec[10] = (unsigned long)(arg10); \
+ _argvec[11] = (unsigned long)(arg11); \
+ _argvec[12] = (unsigned long)(arg12); \
+ __asm__ volatile( \
+ "subq $128,%%rsp\n\t" \
+ "pushq 96(%%rax)\n\t" \
+ "pushq 88(%%rax)\n\t" \
+ "pushq 80(%%rax)\n\t" \
+ "pushq 72(%%rax)\n\t" \
+ "pushq 64(%%rax)\n\t" \
+ "pushq 56(%%rax)\n\t" \
+ "movq 48(%%rax), %%r9\n\t" \
+ "movq 40(%%rax), %%r8\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ "addq $48, %%rsp\n" \
+ "addq $128,%%rsp\n\t" \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#endif /* PLAT_amd64_linux */
+
+/* ------------------------ ppc32-linux ------------------------ */
+
+#if defined(PLAT_ppc32_linux)
+
+/* This is useful for finding out about the on-stack stuff:
+
+ extern int f9 ( int,int,int,int,int,int,int,int,int );
+ extern int f10 ( int,int,int,int,int,int,int,int,int,int );
+ extern int f11 ( int,int,int,int,int,int,int,int,int,int,int );
+ extern int f12 ( int,int,int,int,int,int,int,int,int,int,int,int );
+
+ int g9 ( void ) {
+ return f9(11,22,33,44,55,66,77,88,99);
+ }
+ int g10 ( void ) {
+ return f10(11,22,33,44,55,66,77,88,99,110);
+ }
+ int g11 ( void ) {
+ return f11(11,22,33,44,55,66,77,88,99,110,121);
+ }
+ int g12 ( void ) {
+ return f12(11,22,33,44,55,66,77,88,99,110,121,132);
+ }
+*/
+
+/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
+
+/* These regs are trashed by the hidden call. */
+#define __CALLER_SAVED_REGS \
+ "lr", "ctr", "xer", \
+ "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
+ "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
+ "r11", "r12", "r13"
+
+/* These CALL_FN_ macros assume that on ppc32-linux,
+ sizeof(unsigned long) == 4. */
+
+#define CALL_FN_W_v(lval, orig) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[1]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_W(lval, orig, arg1) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[2]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[4]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[5]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[6]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7,20(11)\n\t" \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[7]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7,20(11)\n\t" \
+ "lwz 8,24(11)\n\t" \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[8]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7,20(11)\n\t" \
+ "lwz 8,24(11)\n\t" \
+ "lwz 9,28(11)\n\t" \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[9]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ _argvec[8] = (unsigned long)arg8; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7,20(11)\n\t" \
+ "lwz 8,24(11)\n\t" \
+ "lwz 9,28(11)\n\t" \
+ "lwz 10,32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[10]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ _argvec[8] = (unsigned long)arg8; \
+ _argvec[9] = (unsigned long)arg9; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "addi 1,1,-16\n\t" \
+ /* arg9 */ \
+ "lwz 3,36(11)\n\t" \
+ "stw 3,8(1)\n\t" \
+ /* args1-8 */ \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7,20(11)\n\t" \
+ "lwz 8,24(11)\n\t" \
+ "lwz 9,28(11)\n\t" \
+ "lwz 10,32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "addi 1,1,16\n\t" \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[11]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ _argvec[8] = (unsigned long)arg8; \
+ _argvec[9] = (unsigned long)arg9; \
+ _argvec[10] = (unsigned long)arg10; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "addi 1,1,-16\n\t" \
+ /* arg10 */ \
+ "lwz 3,40(11)\n\t" \
+ "stw 3,12(1)\n\t" \
+ /* arg9 */ \
+ "lwz 3,36(11)\n\t" \
+ "stw 3,8(1)\n\t" \
+ /* args1-8 */ \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7,20(11)\n\t" \
+ "lwz 8,24(11)\n\t" \
+ "lwz 9,28(11)\n\t" \
+ "lwz 10,32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "addi 1,1,16\n\t" \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10,arg11) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[12]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ _argvec[8] = (unsigned long)arg8; \
+ _argvec[9] = (unsigned long)arg9; \
+ _argvec[10] = (unsigned long)arg10; \
+ _argvec[11] = (unsigned long)arg11; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "addi 1,1,-32\n\t" \
+ /* arg11 */ \
+ "lwz 3,44(11)\n\t" \
+ "stw 3,16(1)\n\t" \
+ /* arg10 */ \
+ "lwz 3,40(11)\n\t" \
+ "stw 3,12(1)\n\t" \
+ /* arg9 */ \
+ "lwz 3,36(11)\n\t" \
+ "stw 3,8(1)\n\t" \
+ /* args1-8 */ \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7,20(11)\n\t" \
+ "lwz 8,24(11)\n\t" \
+ "lwz 9,28(11)\n\t" \
+ "lwz 10,32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "addi 1,1,32\n\t" \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10,arg11,arg12) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[13]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ _argvec[8] = (unsigned long)arg8; \
+ _argvec[9] = (unsigned long)arg9; \
+ _argvec[10] = (unsigned long)arg10; \
+ _argvec[11] = (unsigned long)arg11; \
+ _argvec[12] = (unsigned long)arg12; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "addi 1,1,-32\n\t" \
+ /* arg12 */ \
+ "lwz 3,48(11)\n\t" \
+ "stw 3,20(1)\n\t" \
+ /* arg11 */ \
+ "lwz 3,44(11)\n\t" \
+ "stw 3,16(1)\n\t" \
+ /* arg10 */ \
+ "lwz 3,40(11)\n\t" \
+ "stw 3,12(1)\n\t" \
+ /* arg9 */ \
+ "lwz 3,36(11)\n\t" \
+ "stw 3,8(1)\n\t" \
+ /* args1-8 */ \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7,20(11)\n\t" \
+ "lwz 8,24(11)\n\t" \
+ "lwz 9,28(11)\n\t" \
+ "lwz 10,32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "addi 1,1,32\n\t" \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#endif /* PLAT_ppc32_linux */
+
+/* ------------------------ ppc64-linux ------------------------ */
+
+#if defined(PLAT_ppc64_linux)
+
+/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
+
+/* These regs are trashed by the hidden call. */
+#define __CALLER_SAVED_REGS \
+ "lr", "ctr", "xer", \
+ "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
+ "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
+ "r11", "r12", "r13"
+
+/* These CALL_FN_ macros assume that on ppc64-linux, sizeof(unsigned
+ long) == 8. */
+
+#define CALL_FN_W_v(lval, orig) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+0]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)" /* restore tocptr */ \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_W(lval, orig, arg1) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+1]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)" /* restore tocptr */ \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+2]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)" /* restore tocptr */ \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+3]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)" /* restore tocptr */ \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+4]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)" /* restore tocptr */ \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+5]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)" /* restore tocptr */ \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+6]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)" /* restore tocptr */ \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+7]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)" /* restore tocptr */ \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+8]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 10, 64(11)\n\t" /* arg8->r10 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)" /* restore tocptr */ \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+9]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[2+9] = (unsigned long)arg9; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "addi 1,1,-128\n\t" /* expand stack frame */ \
+ /* arg9 */ \
+ "ld 3,72(11)\n\t" \
+ "std 3,112(1)\n\t" \
+ /* args1-8 */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 10, 64(11)\n\t" /* arg8->r10 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ "addi 1,1,128" /* restore frame */ \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+10]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[2+9] = (unsigned long)arg9; \
+ _argvec[2+10] = (unsigned long)arg10; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "addi 1,1,-128\n\t" /* expand stack frame */ \
+ /* arg10 */ \
+ "ld 3,80(11)\n\t" \
+ "std 3,120(1)\n\t" \
+ /* arg9 */ \
+ "ld 3,72(11)\n\t" \
+ "std 3,112(1)\n\t" \
+ /* args1-8 */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 10, 64(11)\n\t" /* arg8->r10 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ "addi 1,1,128" /* restore frame */ \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10,arg11) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+11]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[2+9] = (unsigned long)arg9; \
+ _argvec[2+10] = (unsigned long)arg10; \
+ _argvec[2+11] = (unsigned long)arg11; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "addi 1,1,-144\n\t" /* expand stack frame */ \
+ /* arg11 */ \
+ "ld 3,88(11)\n\t" \
+ "std 3,128(1)\n\t" \
+ /* arg10 */ \
+ "ld 3,80(11)\n\t" \
+ "std 3,120(1)\n\t" \
+ /* arg9 */ \
+ "ld 3,72(11)\n\t" \
+ "std 3,112(1)\n\t" \
+ /* args1-8 */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 10, 64(11)\n\t" /* arg8->r10 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ "addi 1,1,144" /* restore frame */ \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10,arg11,arg12) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+12]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[2+9] = (unsigned long)arg9; \
+ _argvec[2+10] = (unsigned long)arg10; \
+ _argvec[2+11] = (unsigned long)arg11; \
+ _argvec[2+12] = (unsigned long)arg12; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "addi 1,1,-144\n\t" /* expand stack frame */ \
+ /* arg12 */ \
+ "ld 3,96(11)\n\t" \
+ "std 3,136(1)\n\t" \
+ /* arg11 */ \
+ "ld 3,88(11)\n\t" \
+ "std 3,128(1)\n\t" \
+ /* arg10 */ \
+ "ld 3,80(11)\n\t" \
+ "std 3,120(1)\n\t" \
+ /* arg9 */ \
+ "ld 3,72(11)\n\t" \
+ "std 3,112(1)\n\t" \
+ /* args1-8 */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 10, 64(11)\n\t" /* arg8->r10 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ "addi 1,1,144" /* restore frame */ \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#endif /* PLAT_ppc64_linux */
+
+/* ------------------------ ppc32-aix5 ------------------------- */
+
+#if defined(PLAT_ppc32_aix5)
+
+/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
+
+/* These regs are trashed by the hidden call. */
+#define __CALLER_SAVED_REGS \
+ "lr", "ctr", "xer", \
+ "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
+ "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
+ "r11", "r12", "r13"
+
+/* Expand the stack frame, copying enough info that unwinding
+ still works. Trashes r3. */
+
+#define VG_EXPAND_FRAME_BY_trashes_r3(_n_fr) \
+ "addi 1,1,-" #_n_fr "\n\t" \
+ "lwz 3," #_n_fr "(1)\n\t" \
+ "stw 3,0(1)\n\t"
+
+#define VG_CONTRACT_FRAME_BY(_n_fr) \
+ "addi 1,1," #_n_fr "\n\t"
+
+/* These CALL_FN_ macros assume that on ppc32-aix5, sizeof(unsigned
+ long) == 4. */
+
+#define CALL_FN_W_v(lval, orig) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+0]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_W(lval, orig, arg1) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+1]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+2]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+3]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+4]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+5]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+6]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
+ "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+7]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
+ "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
+ "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+8]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
+ "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
+ "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
+ "lwz 10, 32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+9]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[2+9] = (unsigned long)arg9; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ VG_EXPAND_FRAME_BY_trashes_r3(64) \
+ /* arg9 */ \
+ "lwz 3,36(11)\n\t" \
+ "stw 3,56(1)\n\t" \
+ /* args1-8 */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
+ "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
+ "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
+ "lwz 10, 32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(64) \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+10]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[2+9] = (unsigned long)arg9; \
+ _argvec[2+10] = (unsigned long)arg10; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ VG_EXPAND_FRAME_BY_trashes_r3(64) \
+ /* arg10 */ \
+ "lwz 3,40(11)\n\t" \
+ "stw 3,60(1)\n\t" \
+ /* arg9 */ \
+ "lwz 3,36(11)\n\t" \
+ "stw 3,56(1)\n\t" \
+ /* args1-8 */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
+ "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
+ "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
+ "lwz 10, 32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(64) \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10,arg11) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+11]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[2+9] = (unsigned long)arg9; \
+ _argvec[2+10] = (unsigned long)arg10; \
+ _argvec[2+11] = (unsigned long)arg11; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ VG_EXPAND_FRAME_BY_trashes_r3(72) \
+ /* arg11 */ \
+ "lwz 3,44(11)\n\t" \
+ "stw 3,64(1)\n\t" \
+ /* arg10 */ \
+ "lwz 3,40(11)\n\t" \
+ "stw 3,60(1)\n\t" \
+ /* arg9 */ \
+ "lwz 3,36(11)\n\t" \
+ "stw 3,56(1)\n\t" \
+ /* args1-8 */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
+ "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
+ "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
+ "lwz 10, 32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(72) \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10,arg11,arg12) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+12]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[2+9] = (unsigned long)arg9; \
+ _argvec[2+10] = (unsigned long)arg10; \
+ _argvec[2+11] = (unsigned long)arg11; \
+ _argvec[2+12] = (unsigned long)arg12; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "stw 2,-8(11)\n\t" /* save tocptr */ \
+ "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
+ VG_EXPAND_FRAME_BY_trashes_r3(72) \
+ /* arg12 */ \
+ "lwz 3,48(11)\n\t" \
+ "stw 3,68(1)\n\t" \
+ /* arg11 */ \
+ "lwz 3,44(11)\n\t" \
+ "stw 3,64(1)\n\t" \
+ /* arg10 */ \
+ "lwz 3,40(11)\n\t" \
+ "stw 3,60(1)\n\t" \
+ /* arg9 */ \
+ "lwz 3,36(11)\n\t" \
+ "stw 3,56(1)\n\t" \
+ /* args1-8 */ \
+ "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
+ "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
+ "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
+ "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
+ "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
+ "lwz 10, 32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "lwz 2,-8(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(72) \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#endif /* PLAT_ppc32_aix5 */
+
+/* ------------------------ ppc64-aix5 ------------------------- */
+
+#if defined(PLAT_ppc64_aix5)
+
+/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
+
+/* These regs are trashed by the hidden call. */
+#define __CALLER_SAVED_REGS \
+ "lr", "ctr", "xer", \
+ "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
+ "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
+ "r11", "r12", "r13"
+
+/* Expand the stack frame, copying enough info that unwinding
+ still works. Trashes r3. */
+
+#define VG_EXPAND_FRAME_BY_trashes_r3(_n_fr) \
+ "addi 1,1,-" #_n_fr "\n\t" \
+ "ld 3," #_n_fr "(1)\n\t" \
+ "std 3,0(1)\n\t"
+
+#define VG_CONTRACT_FRAME_BY(_n_fr) \
+ "addi 1,1," #_n_fr "\n\t"
+
+/* These CALL_FN_ macros assume that on ppc64-aix5, sizeof(unsigned
+ long) == 8. */
+
+#define CALL_FN_W_v(lval, orig) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+0]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_W(lval, orig, arg1) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+1]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+2]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+3]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+4]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+5]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+6]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+7]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+8]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 10, 64(11)\n\t" /* arg8->r10 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+9]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[2+9] = (unsigned long)arg9; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ VG_EXPAND_FRAME_BY_trashes_r3(128) \
+ /* arg9 */ \
+ "ld 3,72(11)\n\t" \
+ "std 3,112(1)\n\t" \
+ /* args1-8 */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 10, 64(11)\n\t" /* arg8->r10 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(128) \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+10]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[2+9] = (unsigned long)arg9; \
+ _argvec[2+10] = (unsigned long)arg10; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ VG_EXPAND_FRAME_BY_trashes_r3(128) \
+ /* arg10 */ \
+ "ld 3,80(11)\n\t" \
+ "std 3,120(1)\n\t" \
+ /* arg9 */ \
+ "ld 3,72(11)\n\t" \
+ "std 3,112(1)\n\t" \
+ /* args1-8 */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 10, 64(11)\n\t" /* arg8->r10 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(128) \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10,arg11) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+11]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[2+9] = (unsigned long)arg9; \
+ _argvec[2+10] = (unsigned long)arg10; \
+ _argvec[2+11] = (unsigned long)arg11; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ VG_EXPAND_FRAME_BY_trashes_r3(144) \
+ /* arg11 */ \
+ "ld 3,88(11)\n\t" \
+ "std 3,128(1)\n\t" \
+ /* arg10 */ \
+ "ld 3,80(11)\n\t" \
+ "std 3,120(1)\n\t" \
+ /* arg9 */ \
+ "ld 3,72(11)\n\t" \
+ "std 3,112(1)\n\t" \
+ /* args1-8 */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 10, 64(11)\n\t" /* arg8->r10 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(144) \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10,arg11,arg12) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3+12]; \
+ volatile unsigned long _res; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[2+9] = (unsigned long)arg9; \
+ _argvec[2+10] = (unsigned long)arg10; \
+ _argvec[2+11] = (unsigned long)arg11; \
+ _argvec[2+12] = (unsigned long)arg12; \
+ __asm__ volatile( \
+ "mr 11,%1\n\t" \
+ VG_EXPAND_FRAME_BY_trashes_r3(512) \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ VG_EXPAND_FRAME_BY_trashes_r3(144) \
+ /* arg12 */ \
+ "ld 3,96(11)\n\t" \
+ "std 3,136(1)\n\t" \
+ /* arg11 */ \
+ "ld 3,88(11)\n\t" \
+ "std 3,128(1)\n\t" \
+ /* arg10 */ \
+ "ld 3,80(11)\n\t" \
+ "std 3,120(1)\n\t" \
+ /* arg9 */ \
+ "ld 3,72(11)\n\t" \
+ "std 3,112(1)\n\t" \
+ /* args1-8 */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 10, 64(11)\n\t" /* arg8->r10 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VG_CONTRACT_FRAME_BY(144) \
+ VG_CONTRACT_FRAME_BY(512) \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#endif /* PLAT_ppc64_aix5 */
+
+
+/* ------------------------------------------------------------------ */
+/* ARCHITECTURE INDEPENDENT MACROS for CLIENT REQUESTS. */
+/* */
+/* ------------------------------------------------------------------ */
+
+/* Some request codes. There are many more of these, but most are not
+ exposed to end-user view. These are the public ones, all of the
+ form 0x1000 + small_number.
+
+ Core ones are in the range 0x00000000--0x0000ffff. The non-public
+ ones start at 0x2000.
+*/
+
+/* These macros are used by tools -- they must be public, but don't
+ embed them into other programs. */
+#define VG_USERREQ_TOOL_BASE(a,b) \
+ ((unsigned int)(((a)&0xff) << 24 | ((b)&0xff) << 16))
+#define VG_IS_TOOL_USERREQ(a, b, v) \
+ (VG_USERREQ_TOOL_BASE(a,b) == ((v) & 0xffff0000))
+
+/* !! ABIWARNING !! ABIWARNING !! ABIWARNING !! ABIWARNING !!
+ This enum comprises an ABI exported by Valgrind to programs
+ which use client requests. DO NOT CHANGE THE ORDER OF THESE
+ ENTRIES, NOR DELETE ANY -- add new ones at the end. */
+typedef
+ enum { VG_USERREQ__RUNNING_ON_VALGRIND = 0x1001,
+ VG_USERREQ__DISCARD_TRANSLATIONS = 0x1002,
+
+ /* These allow any function to be called from the simulated
+ CPU but run on the real CPU. Nb: the first arg passed to
+ the function is always the ThreadId of the running
+ thread! So CLIENT_CALL0 actually requires a 1 arg
+ function, etc. */
+ VG_USERREQ__CLIENT_CALL0 = 0x1101,
+ VG_USERREQ__CLIENT_CALL1 = 0x1102,
+ VG_USERREQ__CLIENT_CALL2 = 0x1103,
+ VG_USERREQ__CLIENT_CALL3 = 0x1104,
+
+ /* Can be useful in regression testing suites -- eg. can
+ send Valgrind's output to /dev/null and still count
+ errors. */
+ VG_USERREQ__COUNT_ERRORS = 0x1201,
+
+ /* These are useful and can be interpreted by any tool that
+ tracks malloc() et al, by using vg_replace_malloc.c. */
+ VG_USERREQ__MALLOCLIKE_BLOCK = 0x1301,
+ VG_USERREQ__FREELIKE_BLOCK = 0x1302,
+ /* Memory pool support. */
+ VG_USERREQ__CREATE_MEMPOOL = 0x1303,
+ VG_USERREQ__DESTROY_MEMPOOL = 0x1304,
+ VG_USERREQ__MEMPOOL_ALLOC = 0x1305,
+ VG_USERREQ__MEMPOOL_FREE = 0x1306,
+ VG_USERREQ__MEMPOOL_TRIM = 0x1307,
+ VG_USERREQ__MOVE_MEMPOOL = 0x1308,
+ VG_USERREQ__MEMPOOL_CHANGE = 0x1309,
+ VG_USERREQ__MEMPOOL_EXISTS = 0x130a,
+
+ /* Allow printfs to valgrind log. */
+ VG_USERREQ__PRINTF = 0x1401,
+ VG_USERREQ__PRINTF_BACKTRACE = 0x1402,
+
+ /* Stack support. */
+ VG_USERREQ__STACK_REGISTER = 0x1501,
+ VG_USERREQ__STACK_DEREGISTER = 0x1502,
+ VG_USERREQ__STACK_CHANGE = 0x1503
+ } Vg_ClientRequest;
+
+#if !defined(__GNUC__)
+# define __extension__ /* */
+#endif
+
+/* Returns the number of Valgrinds this code is running under. That
+ is, 0 if running natively, 1 if running under Valgrind, 2 if
+ running under Valgrind which is running under another Valgrind,
+ etc. */
+#define RUNNING_ON_VALGRIND __extension__ \
+ ({unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* if not */, \
+ VG_USERREQ__RUNNING_ON_VALGRIND, \
+ 0, 0, 0, 0, 0); \
+ _qzz_res; \
+ })
+
+
+/* Discard translation of code in the range [_qzz_addr .. _qzz_addr +
+ _qzz_len - 1]. Useful if you are debugging a JITter or some such,
+ since it provides a way to make sure valgrind will retranslate the
+ invalidated area. Returns no value. */
+#define VALGRIND_DISCARD_TRANSLATIONS(_qzz_addr,_qzz_len) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__DISCARD_TRANSLATIONS, \
+ _qzz_addr, _qzz_len, 0, 0, 0); \
+ }
+
+
+/* These requests are for getting Valgrind itself to print something.
+ Possibly with a backtrace. This is a really ugly hack. */
+
+#if defined(NVALGRIND)
+
+# define VALGRIND_PRINTF(...)
+# define VALGRIND_PRINTF_BACKTRACE(...)
+
+#else /* NVALGRIND */
+
+/* Modern GCC will optimize the static routine out if unused,
+ and unused attribute will shut down warnings about it. */
+static int VALGRIND_PRINTF(const char *format, ...)
+ __attribute__((format(__printf__, 1, 2), __unused__));
+static int
+VALGRIND_PRINTF(const char *format, ...)
+{
+ unsigned long _qzz_res;
+ va_list vargs;
+ va_start(vargs, format);
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, VG_USERREQ__PRINTF,
+ (unsigned long)format, (unsigned long)vargs,
+ 0, 0, 0);
+ va_end(vargs);
+ return (int)_qzz_res;
+}
+
+static int VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
+ __attribute__((format(__printf__, 1, 2), __unused__));
+static int
+VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
+{
+ unsigned long _qzz_res;
+ va_list vargs;
+ va_start(vargs, format);
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, VG_USERREQ__PRINTF_BACKTRACE,
+ (unsigned long)format, (unsigned long)vargs,
+ 0, 0, 0);
+ va_end(vargs);
+ return (int)_qzz_res;
+}
+
+#endif /* NVALGRIND */
+
+
+/* These requests allow control to move from the simulated CPU to the
+ real CPU, calling an arbitary function.
+
+ Note that the current ThreadId is inserted as the first argument.
+ So this call:
+
+ VALGRIND_NON_SIMD_CALL2(f, arg1, arg2)
+
+ requires f to have this signature:
+
+ Word f(Word tid, Word arg1, Word arg2)
+
+ where "Word" is a word-sized type.
+
+ Note that these client requests are not entirely reliable. For example,
+ if you call a function with them that subsequently calls printf(),
+ there's a high chance Valgrind will crash. Generally, your prospects of
+ these working are made higher if the called function does not refer to
+ any global variables, and does not refer to any libc or other functions
+ (printf et al). Any kind of entanglement with libc or dynamic linking is
+ likely to have a bad outcome, for tricky reasons which we've grappled
+ with a lot in the past.
+*/
+#define VALGRIND_NON_SIMD_CALL0(_qyy_fn) \
+ __extension__ \
+ ({unsigned long _qyy_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \
+ VG_USERREQ__CLIENT_CALL0, \
+ _qyy_fn, \
+ 0, 0, 0, 0); \
+ _qyy_res; \
+ })
+
+#define VALGRIND_NON_SIMD_CALL1(_qyy_fn, _qyy_arg1) \
+ __extension__ \
+ ({unsigned long _qyy_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \
+ VG_USERREQ__CLIENT_CALL1, \
+ _qyy_fn, \
+ _qyy_arg1, 0, 0, 0); \
+ _qyy_res; \
+ })
+
+#define VALGRIND_NON_SIMD_CALL2(_qyy_fn, _qyy_arg1, _qyy_arg2) \
+ __extension__ \
+ ({unsigned long _qyy_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \
+ VG_USERREQ__CLIENT_CALL2, \
+ _qyy_fn, \
+ _qyy_arg1, _qyy_arg2, 0, 0); \
+ _qyy_res; \
+ })
+
+#define VALGRIND_NON_SIMD_CALL3(_qyy_fn, _qyy_arg1, _qyy_arg2, _qyy_arg3) \
+ __extension__ \
+ ({unsigned long _qyy_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \
+ VG_USERREQ__CLIENT_CALL3, \
+ _qyy_fn, \
+ _qyy_arg1, _qyy_arg2, \
+ _qyy_arg3, 0); \
+ _qyy_res; \
+ })
+
+
+/* Counts the number of errors that have been recorded by a tool. Nb:
+ the tool must record the errors with VG_(maybe_record_error)() or
+ VG_(unique_error)() for them to be counted. */
+#define VALGRIND_COUNT_ERRORS \
+ __extension__ \
+ ({unsigned int _qyy_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \
+ VG_USERREQ__COUNT_ERRORS, \
+ 0, 0, 0, 0, 0); \
+ _qyy_res; \
+ })
+
+/* Mark a block of memory as having been allocated by a malloc()-like
+ function. `addr' is the start of the usable block (ie. after any
+ redzone) `rzB' is redzone size if the allocator can apply redzones;
+ use '0' if not. Adding redzones makes it more likely Valgrind will spot
+ block overruns. `is_zeroed' indicates if the memory is zeroed, as it is
+ for calloc(). Put it immediately after the point where a block is
+ allocated.
+
+ If you're using Memcheck: If you're allocating memory via superblocks,
+ and then handing out small chunks of each superblock, if you don't have
+ redzones on your small blocks, it's worth marking the superblock with
+ VALGRIND_MAKE_MEM_NOACCESS when it's created, so that block overruns are
+ detected. But if you can put redzones on, it's probably better to not do
+ this, so that messages for small overruns are described in terms of the
+ small block rather than the superblock (but if you have a big overrun
+ that skips over a redzone, you could miss an error this way). See
+ memcheck/tests/custom_alloc.c for an example.
+
+ WARNING: if your allocator uses malloc() or 'new' to allocate
+ superblocks, rather than mmap() or brk(), this will not work properly --
+ you'll likely get assertion failures during leak detection. This is
+ because Valgrind doesn't like seeing overlapping heap blocks. Sorry.
+
+ Nb: block must be freed via a free()-like function specified
+ with VALGRIND_FREELIKE_BLOCK or mismatch errors will occur. */
+#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__MALLOCLIKE_BLOCK, \
+ addr, sizeB, rzB, is_zeroed, 0); \
+ }
+
+/* Mark a block of memory as having been freed by a free()-like function.
+ `rzB' is redzone size; it must match that given to
+ VALGRIND_MALLOCLIKE_BLOCK. Memory not freed will be detected by the leak
+ checker. Put it immediately after the point where the block is freed. */
+#define VALGRIND_FREELIKE_BLOCK(addr, rzB) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__FREELIKE_BLOCK, \
+ addr, rzB, 0, 0, 0); \
+ }
+
+/* Create a memory pool. */
+#define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__CREATE_MEMPOOL, \
+ pool, rzB, is_zeroed, 0, 0); \
+ }
+
+/* Destroy a memory pool. */
+#define VALGRIND_DESTROY_MEMPOOL(pool) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__DESTROY_MEMPOOL, \
+ pool, 0, 0, 0, 0); \
+ }
+
+/* Associate a piece of memory with a memory pool. */
+#define VALGRIND_MEMPOOL_ALLOC(pool, addr, size) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__MEMPOOL_ALLOC, \
+ pool, addr, size, 0, 0); \
+ }
+
+/* Disassociate a piece of memory from a memory pool. */
+#define VALGRIND_MEMPOOL_FREE(pool, addr) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__MEMPOOL_FREE, \
+ pool, addr, 0, 0, 0); \
+ }
+
+/* Disassociate any pieces outside a particular range. */
+#define VALGRIND_MEMPOOL_TRIM(pool, addr, size) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__MEMPOOL_TRIM, \
+ pool, addr, size, 0, 0); \
+ }
+
+/* Resize and/or move a piece associated with a memory pool. */
+#define VALGRIND_MOVE_MEMPOOL(poolA, poolB) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__MOVE_MEMPOOL, \
+ poolA, poolB, 0, 0, 0); \
+ }
+
+/* Resize and/or move a piece associated with a memory pool. */
+#define VALGRIND_MEMPOOL_CHANGE(pool, addrA, addrB, size) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__MEMPOOL_CHANGE, \
+ pool, addrA, addrB, size, 0); \
+ }
+
+/* Return 1 if a mempool exists, else 0. */
+#define VALGRIND_MEMPOOL_EXISTS(pool) \
+ ({unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__MEMPOOL_EXISTS, \
+ pool, 0, 0, 0, 0); \
+ _qzz_res; \
+ })
+
+/* Mark a piece of memory as being a stack. Returns a stack id. */
+#define VALGRIND_STACK_REGISTER(start, end) \
+ ({unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__STACK_REGISTER, \
+ start, end, 0, 0, 0); \
+ _qzz_res; \
+ })
+
+/* Unmark the piece of memory associated with a stack id as being a
+ stack. */
+#define VALGRIND_STACK_DEREGISTER(id) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__STACK_DEREGISTER, \
+ id, 0, 0, 0, 0); \
+ }
+
+/* Change the start and end address of the stack id. */
+#define VALGRIND_STACK_CHANGE(id, start, end) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__STACK_CHANGE, \
+ id, start, end, 0, 0); \
+ }
+
+
+#undef PLAT_x86_linux
+#undef PLAT_amd64_linux
+#undef PLAT_ppc32_linux
+#undef PLAT_ppc64_linux
+#undef PLAT_ppc32_aix5
+#undef PLAT_ppc64_aix5
+
+#endif /* __VALGRIND_H */
diff --git a/tests/auto/exceptionsafety_objects/exceptionsafety_objects.pro b/tests/auto/exceptionsafety_objects/exceptionsafety_objects.pro
new file mode 100644
index 0000000..d0945a4
--- /dev/null
+++ b/tests/auto/exceptionsafety_objects/exceptionsafety_objects.pro
@@ -0,0 +1,3 @@
+load(qttest_p4)
+HEADERS += oomsimulator.h 3rdparty/valgrind.h 3rdparty/memcheck.h
+SOURCES += tst_exceptionsafety_objects.cpp
diff --git a/tests/auto/exceptionsafety_objects/oomsimulator.h b/tests/auto/exceptionsafety_objects/oomsimulator.h
new file mode 100644
index 0000000..88d8039
--- /dev/null
+++ b/tests/auto/exceptionsafety_objects/oomsimulator.h
@@ -0,0 +1,286 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef Q_OS_SYMBIAN
+#include <malloc.h>
+#endif
+#include <limits.h>
+#include <stdio.h>
+#include <exception>
+
+#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN)
+# include "3rdparty/memcheck.h"
+#endif
+
+static bool mallocFailActive = false;
+static int mallocFailIndex = 0;
+static int mallocCount = 0;
+
+static void my_terminate_handler()
+{
+ // set a breakpoint here to get a backtrace for your uncaught exceptions
+ fprintf(stderr, "Uncaught Exception Detected. Set a breakpoint in my_terminate_handler()\n");
+ exit(1);
+}
+
+#ifdef __GLIBC__
+/* Use glibc's memory allocation hooks */
+
+/* our hooks */
+static void *my_malloc_hook(size_t, const void *);
+static void *my_realloc_hook(void *, size_t, const void *);
+static void *my_memalign_hook(size_t, size_t, const void *);
+static void my_free_hook(void *, const void *);
+
+/* original hooks. */
+static void *(*old_malloc_hook)(size_t, const void *);
+static void *(*old_realloc_hook)(void *, size_t, const void *);
+static void *(*old_memalign_hook)(size_t, size_t, const void *);
+static void (*old_free_hook)(void *, const void *);
+
+/* initializer function */
+static void my_init_hook();
+
+/* Override initialising hook from the C library. */
+void (*__malloc_initialize_hook) (void) = my_init_hook;
+
+static void disableHooks()
+{
+ __malloc_hook = old_malloc_hook;
+ __realloc_hook = old_realloc_hook;
+ __memalign_hook = old_memalign_hook;
+ __free_hook = old_free_hook;
+}
+
+static void enableHooks()
+{
+ __malloc_hook = my_malloc_hook;
+ __realloc_hook = my_realloc_hook;
+ __memalign_hook = my_memalign_hook;
+ __free_hook = my_free_hook;
+}
+
+void my_init_hook()
+{
+ old_malloc_hook = __malloc_hook;
+ old_realloc_hook = __realloc_hook;
+ old_memalign_hook = __memalign_hook;
+ old_free_hook = __free_hook;
+ enableHooks();
+}
+
+void *my_malloc_hook(size_t size, const void *)
+{
+ ++mallocCount;
+
+ if (mallocFailActive && --mallocFailIndex < 0)
+ return 0; // simulate OOM
+
+ __malloc_hook = old_malloc_hook;
+ void *result = ::malloc (size);
+ __malloc_hook = my_malloc_hook;
+
+ return result;
+}
+
+void *my_memalign_hook(size_t alignment, size_t size, const void *)
+{
+ ++mallocCount;
+
+ if (mallocFailActive && --mallocFailIndex < 0)
+ return 0; // simulate OOM
+
+ __memalign_hook = old_memalign_hook;
+ void *result = ::memalign(alignment, size);
+ __memalign_hook = my_memalign_hook;
+
+ return result;
+}
+
+void *my_realloc_hook(void *ptr, size_t size, const void *)
+{
+ ++mallocCount;
+
+ if (mallocFailActive && --mallocFailIndex < 0)
+ return 0; // simulate OOM
+
+ __realloc_hook = old_realloc_hook;
+ __malloc_hook = old_malloc_hook;
+ void *result = ::realloc(ptr, size);
+ __malloc_hook = my_malloc_hook;
+ __realloc_hook = my_realloc_hook;
+
+ return result;
+}
+
+void my_free_hook(void *ptr, const void *)
+{
+ __free_hook = old_free_hook;
+ ::free(ptr);
+ __free_hook = my_free_hook;
+}
+
+#elif defined(Q_CC_MSVC)
+
+#include "crtdbg.h"
+
+static int qCrtAllocHook(int allocType, void * /*userData*/, size_t /*size*/,
+ int blockType, long /*requestNumber*/,
+ const unsigned char * /*filename*/, int /*lineNumber*/)
+{
+ if (blockType == _CRT_BLOCK)
+ return TRUE; // ignore allocations from the C library
+
+ switch (allocType) {
+ case _HOOK_ALLOC:
+ case _HOOK_REALLOC:
+ ++mallocCount;
+ if (mallocFailActive && --mallocFailIndex < 0)
+ return FALSE; // simulate OOM
+ }
+
+ return TRUE;
+}
+
+static struct QCrtDebugRegistrator
+{
+ QCrtDebugRegistrator()
+ {
+ _CrtSetAllocHook(qCrtAllocHook);
+ }
+
+} crtDebugRegistrator;
+
+#endif
+
+struct AllocFailer
+{
+ inline AllocFailer(int index) { reactivateAt(index); }
+ inline ~AllocFailer() { deactivate(); }
+
+ inline void reactivateAt(int index)
+ {
+#ifdef RUNNING_ON_VALGRIND
+ if (RUNNING_ON_VALGRIND)
+ VALGRIND_ENABLE_OOM_AT_ALLOC_INDEX(VALGRIND_GET_ALLOC_INDEX + index + 1);
+#elif defined(Q_OS_SYMBIAN)
+ // symbian alloc fail index is 1 based
+ __UHEAP_BURSTFAILNEXT(index+1, KMaxTUint16);
+#endif
+ mallocFailIndex = index;
+ mallocFailActive = true;
+ }
+
+ inline void deactivate()
+ {
+ mallocFailActive = false;
+#ifdef RUNNING_ON_VALGRIND
+ VALGRIND_ENABLE_OOM_AT_ALLOC_INDEX(0);
+#elif defined(Q_OS_SYMBIAN)
+ __UHEAP_RESET;
+#endif
+ }
+
+ inline int currentAllocIndex() const
+ {
+#ifdef RUNNING_ON_VALGRIND
+ if (RUNNING_ON_VALGRIND)
+ return VALGRIND_GET_ALLOC_INDEX;
+#endif
+ return mallocCount;
+ }
+
+ static bool initialize()
+ {
+ std::set_terminate(my_terminate_handler);
+#ifdef RUNNING_ON_VALGRIND
+ if (RUNNING_ON_VALGRIND) {
+ if (VALGRIND_GET_ALLOC_INDEX == -1u) {
+ qWarning("You must use a valgrind with oom simulation support");
+ return false;
+ }
+ // running in valgrind - don't use glibc hooks
+ disableHooks();
+
+ // never stop simulating OOM
+ VALGRIND_DISABLE_OOM_AT_ALLOC_INDEX(-1u);
+ }
+#endif
+ return true;
+ }
+};
+
+#ifndef Q_OS_SYMBIAN
+
+static void *new_helper(std::size_t size)
+{
+ void *ptr = malloc(size);
+ if (!ptr)
+ throw std::bad_alloc();
+ return ptr;
+}
+
+#ifdef Q_CC_MSVC
+# pragma warning(push)
+# pragma warning(disable: 4290)
+#endif
+
+// overload operator new
+void* operator new(size_t size) throw (std::bad_alloc) { return new_helper(size); }
+void* operator new[](size_t size) throw (std::bad_alloc) { return new_helper(size); }
+void* operator new(size_t size, const std::nothrow_t&) throw() { return malloc(size); }
+void* operator new[](std::size_t size, const std::nothrow_t&) throw() { return malloc(size); }
+
+// overload operator delete
+void operator delete(void *ptr) throw() { if (ptr) free(ptr); }
+void operator delete[](void *ptr) throw() { if (ptr) free(ptr); }
+void operator delete(void *ptr, const std::nothrow_t&) throw() { if (ptr) free(ptr); }
+void operator delete[](void *ptr, const std::nothrow_t&) throw() { if (ptr) free (ptr); }
+
+#ifdef Q_CC_MSVC
+# pragma warning(pop)
+#endif
+
+#endif
+
+// ignore placement new and placement delete - those don't allocate.
+
+
diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp
new file mode 100644
index 0000000..c18b5c8
--- /dev/null
+++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp
@@ -0,0 +1,651 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QtGui>
+#include <QtTest/QtTest>
+
+#include <stddef.h>
+
+QT_USE_NAMESPACE
+
+// this test only works with
+// * GLIBC
+// * MSVC - only debug builds (we need the crtdbg.h helpers)
+// * SYMBIAN - only when __UHEAP_BURSTFAILNEXT is available
+#if (defined(QT_NO_EXCEPTIONS) || (!defined(__GLIBC__) && !defined(Q_CC_MSVC) && (!defined(Q_OS_SYMBIAN) || !defined(__UHEAP_BURSTFAILNEXT)))) && !defined(Q_MOC_RUN)
+ QTEST_NOOP_MAIN
+#else
+
+#include "oomsimulator.h"
+#if !defined(Q_OS_SYMBIAN)
+#include "3rdparty/memcheck.h"
+#endif
+
+class tst_ExceptionSafetyObjects: public QObject
+{
+ Q_OBJECT
+
+public slots:
+ void initTestCase();
+
+private slots:
+ void objects_data();
+ void objects();
+
+ void widgets_data();
+ void widgets();
+
+ void vector_data();
+ void vector();
+
+ void list_data();
+ void list();
+
+ void linkedList_data();
+ void linkedList();
+};
+
+// helper structs to create an arbitrary widget
+struct AbstractTester
+{
+ virtual void operator()(QObject *parent) = 0;
+};
+Q_DECLARE_METATYPE(AbstractTester *)
+
+typedef void (*TestFunction)(QObject*);
+Q_DECLARE_METATYPE(TestFunction)
+
+template <typename T>
+struct ObjectCreator : public AbstractTester
+{
+ void operator()(QObject *)
+ {
+ QScopedPointer<T> ptr(new T);
+ }
+};
+
+struct BitArrayCreator : public AbstractTester
+{
+ void operator()(QObject *)
+ { QScopedPointer<QBitArray> bitArray(new QBitArray(100, true)); }
+};
+
+struct ByteArrayMatcherCreator : public AbstractTester
+{
+ void operator()(QObject *)
+ { QScopedPointer<QByteArrayMatcher> ptr(new QByteArrayMatcher("ralf test",8)); }
+};
+
+struct CryptographicHashCreator : public AbstractTester
+{
+ void operator()(QObject *)
+ {
+ QScopedPointer<QCryptographicHash> ptr(new QCryptographicHash(QCryptographicHash::Sha1));
+ ptr->addData("ralf test",8);
+ }
+};
+
+struct DataStreamCreator : public AbstractTester
+{
+ void operator()(QObject *)
+ {
+ QScopedPointer<QByteArray> arr(new QByteArray("hallo, test"));
+ QScopedPointer<QDataStream> ptr(new QDataStream(arr.data(), QIODevice::ReadWrite));
+ ptr->writeBytes("ralf test",8);
+ }
+};
+
+struct DirCreator : public AbstractTester
+{
+ void operator()(QObject *)
+ {
+ QDir::cleanPath("../////././");
+ QScopedPointer<QDir> ptr(new QDir("."));
+ while( ptr->cdUp() )
+ ; // just going up
+ ptr->count();
+ ptr->exists(ptr->path());
+
+ QStringList filters;
+ filters << "*.cpp" << "*.cxx" << "*.cc";
+ ptr->setNameFilters(filters);
+ }
+};
+
+void tst_ExceptionSafetyObjects::objects_data()
+{
+ QTest::addColumn<AbstractTester *>("objectCreator");
+
+#define NEWROW(T) QTest::newRow(#T) << static_cast<AbstractTester *>(new ObjectCreator<T >)
+ NEWROW(QObject);
+ NEWROW(QBuffer);
+ NEWROW(QFile);
+ NEWROW(QProcess);
+ NEWROW(QSettings);
+ NEWROW(QThread);
+ NEWROW(QThreadPool);
+ NEWROW(QTranslator);
+ NEWROW(QFSFileEngine);
+
+#define NEWROW2(T, CREATOR) QTest::newRow(#T) << static_cast<AbstractTester *>(new CREATOR)
+ NEWROW2(QBitArray, BitArrayCreator);
+ NEWROW2(QByteArrayMatcher, ByteArrayMatcherCreator);
+ NEWROW2(QCryptographicHash, CryptographicHashCreator);
+ NEWROW2(QDataStream, DataStreamCreator);
+ NEWROW2(QDir, DirCreator);
+
+}
+
+// create and destructs an object, and lets each and every allocation
+// during construction and destruction fail.
+template <typename T>
+static void doOOMTest(T &testFunc, QObject *parent, int start=0)
+{
+ int currentOOMIndex = start;
+ bool caught = false;
+ bool done = false;
+
+ AllocFailer allocFailer(0);
+ int allocCountBefore = allocFailer.currentAllocIndex();
+
+ do {
+ allocFailer.reactivateAt(++currentOOMIndex);
+
+ caught = false;
+
+ try {
+ testFunc(parent);
+ } catch (const std::bad_alloc &) {
+ caught = true;
+ } catch (const std::exception &ex) {
+ if (strcmp(ex.what(), "autotest swallow") != 0)
+ throw;
+ caught = true;
+ }
+
+ if (!caught) {
+ void *buf = malloc(42);
+ if (buf) {
+ // we got memory here - oom test is over.
+ free(buf);
+ done = true;
+ }
+ }
+
+ // if we get a FAIL, stop executing now
+ if (QTest::currentTestFailed())
+ done = true;
+
+//#define REALLY_VERBOSE
+#ifdef REALLY_VERBOSE
+ fprintf(stderr, " OOM Index: %d\n", currentOOMIndex);
+#endif
+
+
+ } while (caught || !done);
+
+ allocFailer.deactivate();
+
+//#define VERBOSE
+#ifdef VERBOSE
+ fprintf(stderr, "OOM Test done, checked allocs: %d (range %d - %d)\n", currentOOMIndex,
+ allocCountBefore, allocFailer.currentAllocIndex());
+#else
+ Q_UNUSED(allocCountBefore);
+#endif
+}
+
+static int alloc1Failed = 0;
+static int alloc2Failed = 0;
+static int alloc3Failed = 0;
+static int alloc4Failed = 0;
+static int malloc1Failed = 0;
+static int malloc2Failed = 0;
+
+// Tests that new, new[] and malloc() fail at least once during OOM testing.
+class SelfTestObject : public QObject
+{
+public:
+ SelfTestObject(QObject *parent = 0)
+ : QObject(parent)
+ {
+ try { delete new int; } catch (const std::bad_alloc &) { ++alloc1Failed; throw; }
+ try { delete [] new double[5]; } catch (const std::bad_alloc &) { ++alloc2Failed; throw ;}
+ void *buf = malloc(42);
+ if (buf)
+ free(buf);
+ else
+ ++malloc1Failed;
+ }
+
+ ~SelfTestObject()
+ {
+ try { delete new int; } catch (const std::bad_alloc &) { ++alloc3Failed; }
+ try { delete [] new double[5]; } catch (const std::bad_alloc &) { ++alloc4Failed; }
+ void *buf = malloc(42);
+ if (buf)
+ free(buf);
+ else
+ ++malloc2Failed = true;
+ }
+};
+
+void tst_ExceptionSafetyObjects::initTestCase()
+{
+ QVERIFY(AllocFailer::initialize());
+
+ // sanity check whether OOM simulation works
+ AllocFailer allocFailer(0);
+
+ // malloc fail index is 0 -> this malloc should fail.
+ void *buf = malloc(42);
+ allocFailer.deactivate();
+ QVERIFY(!buf);
+
+ // malloc fail index is 1 - second malloc should fail.
+ allocFailer.reactivateAt(1);
+ buf = malloc(42);
+ void *buf2 = malloc(42);
+ allocFailer.deactivate();
+
+ QVERIFY(buf);
+ free(buf);
+ QVERIFY(!buf2);
+
+#ifdef Q_OS_SYMBIAN
+ // temporary workaround for INC138398
+ std::new_handler nh_func = std::set_new_handler(0);
+ (void) std::set_new_handler(nh_func);
+#endif
+
+ ObjectCreator<SelfTestObject> *selfTest = new ObjectCreator<SelfTestObject>;
+ doOOMTest(*selfTest, 0);
+ delete selfTest;
+ QCOMPARE(alloc1Failed, 1);
+ QCOMPARE(alloc2Failed, 1);
+ QCOMPARE(alloc3Failed, 2);
+ QCOMPARE(alloc4Failed, 3);
+ QCOMPARE(malloc1Failed, 1);
+ QCOMPARE(malloc2Failed, 1);
+}
+
+void tst_ExceptionSafetyObjects::objects()
+{
+ QFETCH(AbstractTester *, objectCreator);
+
+ doOOMTest(*objectCreator, 0);
+
+ delete objectCreator;
+}
+
+template <typename T>
+struct WidgetCreator : public AbstractTester
+{
+ void operator()(QObject *parent)
+ {
+ Q_ASSERT(!parent || parent->isWidgetType());
+ QScopedPointer<T> ptr(parent ? new T(static_cast<QWidget *>(parent)) : new T);
+ }
+};
+
+// QSizeGrip doesn't have a default constructor - always pass parent (even though it might be 0)
+template <> struct WidgetCreator<QSizeGrip> : public AbstractTester
+{
+ void operator()(QObject *parent)
+ {
+ Q_ASSERT(!parent || parent->isWidgetType());
+ QScopedPointer<QSizeGrip> ptr(new QSizeGrip(static_cast<QWidget *>(parent)));
+ }
+};
+
+// QDesktopWidget doesn't need a parent.
+template <> struct WidgetCreator<QDesktopWidget> : public AbstractTester
+{
+ void operator()(QObject *parent)
+ {
+ Q_ASSERT(!parent || parent->isWidgetType());
+ QScopedPointer<QDesktopWidget> ptr(new QDesktopWidget());
+ }
+};
+void tst_ExceptionSafetyObjects::widgets_data()
+{
+ QTest::addColumn<AbstractTester *>("widgetCreator");
+
+#undef NEWROW
+#define NEWROW(T) QTest::newRow(#T) << static_cast<AbstractTester *>(new WidgetCreator<T >)
+
+ NEWROW(QWidget);
+
+ NEWROW(QButtonGroup);
+ NEWROW(QDesktopWidget);
+ NEWROW(QCheckBox);
+ NEWROW(QComboBox);
+ NEWROW(QCommandLinkButton);
+ NEWROW(QDateEdit);
+ NEWROW(QDateTimeEdit);
+ NEWROW(QDial);
+ NEWROW(QDoubleSpinBox);
+ NEWROW(QFocusFrame);
+ NEWROW(QFontComboBox);
+ NEWROW(QFrame);
+ NEWROW(QGroupBox);
+ NEWROW(QLCDNumber);
+ NEWROW(QLabel);
+ NEWROW(QLCDNumber);
+ NEWROW(QLineEdit);
+ NEWROW(QMenu);
+ NEWROW(QPlainTextEdit);
+ NEWROW(QProgressBar);
+ NEWROW(QPushButton);
+ NEWROW(QRadioButton);
+ NEWROW(QScrollArea);
+ NEWROW(QScrollBar);
+ NEWROW(QSizeGrip);
+ NEWROW(QSlider);
+ NEWROW(QSpinBox);
+ NEWROW(QSplitter);
+ NEWROW(QStackedWidget);
+ NEWROW(QStatusBar);
+ NEWROW(QTabBar);
+ NEWROW(QTabWidget);
+ NEWROW(QTextBrowser);
+ NEWROW(QTextEdit);
+ NEWROW(QTimeEdit);
+ NEWROW(QToolBox);
+ NEWROW(QToolButton);
+ NEWROW(QStatusBar);
+ NEWROW(QSplitter);
+ NEWROW(QTextEdit);
+ NEWROW(QTextBrowser);
+ NEWROW(QToolBar);
+ NEWROW(QMenuBar);
+ NEWROW(QMainWindow);
+ NEWROW(QWorkspace);
+ NEWROW(QColumnView);
+ NEWROW(QListView);
+ NEWROW(QListWidget);
+ NEWROW(QTableView);
+ NEWROW(QTableWidget);
+ NEWROW(QTreeView);
+ NEWROW(QTreeWidget);
+}
+
+void tst_ExceptionSafetyObjects::widgets()
+{
+ QFETCH(AbstractTester *, widgetCreator);
+
+ doOOMTest(*widgetCreator, 0, 00000);
+
+ QWidget parent;
+ doOOMTest(*widgetCreator, &parent, 00000);
+
+ delete widgetCreator;
+
+ // if the test reaches here without crashing, we passed :)
+ QVERIFY(true);
+}
+
+struct Integer
+{
+ Integer(int value = 42)
+ : ptr(new int(value))
+ {
+ ++instanceCount;
+ }
+
+ Integer(const Integer &other)
+ : ptr(new int(*other.ptr))
+ {
+ ++instanceCount;
+ }
+
+ Integer &operator=(const Integer &other)
+ {
+ int *newPtr = new int(*other.ptr);
+ delete ptr;
+ ptr = newPtr;
+ return *this;
+ }
+
+ ~Integer()
+ {
+ --instanceCount;
+ delete ptr;
+ }
+
+ int value() const
+ {
+ return *ptr;
+ }
+
+ int *ptr;
+ static int instanceCount;
+};
+
+int Integer::instanceCount = 0;
+
+template <template<typename T> class Container>
+void containerInsertTest(QObject*)
+{
+ Container<Integer> container;
+
+ // insert an item in an empty container
+ try {
+ container.insert(container.begin(), 41);
+ } catch (...) {
+ QVERIFY(container.isEmpty());
+ QCOMPARE(Integer::instanceCount, 0);
+ return;
+ }
+
+ QCOMPARE(container.size(), 1);
+ QCOMPARE(Integer::instanceCount, 1);
+
+ // insert an item before another item
+ try {
+ container.insert(container.begin(), 42);
+ } catch (...) {
+ QCOMPARE(container.size(), 1);
+ QCOMPARE(container.first().value(), 41);
+ QCOMPARE(Integer::instanceCount, 1);
+ return;
+ }
+
+ QCOMPARE(Integer::instanceCount, 2);
+
+ // insert an item in between
+ try {
+ container.insert(container.begin() + 1, 43);
+ } catch (...) {
+ QCOMPARE(container.size(), 2);
+ QCOMPARE(container.first().value(), 41);
+ QCOMPARE((container.begin() + 1)->value(), 42);
+ QCOMPARE(Integer::instanceCount, 2);
+ return;
+ }
+
+ QCOMPARE(Integer::instanceCount, 3);
+}
+
+template <template<typename T> class Container>
+void containerAppendTest(QObject*)
+{
+ Container<Integer> container;
+
+ // append to an empty container
+ try {
+ container.append(42);
+ } catch (...) {
+ QCOMPARE(container.size(), 0);
+ QCOMPARE(Integer::instanceCount, 0);
+ return;
+ }
+
+ // append to a container with one item
+ try {
+ container.append(43);
+ } catch (...) {
+ QCOMPARE(container.size(), 1);
+ QCOMPARE(container.first().value(), 42);
+ QCOMPARE(Integer::instanceCount, 1);
+ return;
+ }
+}
+
+template <template<typename T> class Container>
+void containerEraseTest(QObject*)
+{
+ Container<Integer> container;
+
+ try {
+ container.append(42);
+ container.append(43);
+ container.append(44);
+ container.append(45);
+ container.append(46);
+ } catch (...) {
+ // don't care
+ return;
+ }
+
+ // sanity checks
+ QCOMPARE(container.size(), 5);
+ QCOMPARE(Integer::instanceCount, 5);
+
+ // delete the first one
+ try {
+ container.erase(container.begin());
+ } catch (...) {
+ QCOMPARE(container.size(), 5);
+ QCOMPARE(container.first().value(), 42);
+ QCOMPARE(Integer::instanceCount, 5);
+ return;
+ }
+
+ QCOMPARE(container.size(), 4);
+ QCOMPARE(container.first().value(), 43);
+ QCOMPARE(Integer::instanceCount, 4);
+
+ // delete the last one
+ try {
+ container.erase(container.end() - 1);
+ } catch (...) {
+ QCOMPARE(container.size(), 4);
+ QCOMPARE(Integer::instanceCount, 4);
+ return;
+ }
+
+ QCOMPARE(container.size(), 3);
+ QCOMPARE(container.first().value(), 43);
+ QCOMPARE((container.begin() + 1)->value(), 44);
+ QCOMPARE((container.begin() + 2)->value(), 45);
+ QCOMPARE(Integer::instanceCount, 3);
+
+ // delete the middle one
+ try {
+ container.erase(container.begin() + 1);
+ } catch (...) {
+ QCOMPARE(container.size(), 3);
+ QCOMPARE(container.first().value(), 43);
+ QCOMPARE((container.begin() + 1)->value(), 44);
+ QCOMPARE((container.begin() + 2)->value(), 45);
+ QCOMPARE(Integer::instanceCount, 3);
+ return;
+ }
+
+ QCOMPARE(container.size(), 2);
+ QCOMPARE(container.first().value(), 43);
+ QCOMPARE((container.begin() + 1)->value(), 45);
+ QCOMPARE(Integer::instanceCount, 2);
+}
+
+template <template<typename T> class Container>
+static void containerData()
+{
+ QTest::addColumn<TestFunction>("testFunction");
+
+ QTest::newRow("insert") << static_cast<TestFunction>(containerInsertTest<Container>);
+ QTest::newRow("append") << static_cast<TestFunction>(containerAppendTest<Container>);
+ QTest::newRow("erase") << static_cast<TestFunction>(containerEraseTest<Container>);
+}
+
+void tst_ExceptionSafetyObjects::vector_data()
+{
+ containerData<QVector>();
+}
+
+void tst_ExceptionSafetyObjects::vector()
+{
+ QFETCH(TestFunction, testFunction);
+
+ if (QLatin1String(QTest::currentDataTag()) == QLatin1String("insert"))
+ QSKIP("QVector::insert is currently not strongly exception safe", SkipSingle);
+
+ doOOMTest(testFunction, 0);
+}
+
+void tst_ExceptionSafetyObjects::list_data()
+{
+ containerData<QList>();
+}
+
+void tst_ExceptionSafetyObjects::list()
+{
+ QFETCH(TestFunction, testFunction);
+
+ doOOMTest(testFunction, 0);
+}
+
+void tst_ExceptionSafetyObjects::linkedList_data()
+{
+ containerData<QLinkedList>();
+}
+
+void tst_ExceptionSafetyObjects::linkedList()
+{
+ QFETCH(TestFunction, testFunction);
+
+ doOOMTest(testFunction, 0);
+}
+
+QTEST_MAIN(tst_ExceptionSafetyObjects)
+#include "tst_exceptionsafety_objects.moc"
+#endif // QT_NO_EXCEPTIONS
diff --git a/tests/auto/headers/headers.pro b/tests/auto/headers/headers.pro
index 9da40ce..703da7c 100644
--- a/tests/auto/headers/headers.pro
+++ b/tests/auto/headers/headers.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_headers.cpp
QT = core
-
-
diff --git a/tests/auto/languagechange/tst_languagechange.cpp b/tests/auto/languagechange/tst_languagechange.cpp
index cb4cf1e..7c98809 100644
--- a/tests/auto/languagechange/tst_languagechange.cpp
+++ b/tests/auto/languagechange/tst_languagechange.cpp
@@ -122,10 +122,7 @@ public slots:
void install() {
QCoreApplication::installTranslator(this);
QTest::qWait(2500);
- //### is there any better way to close a Qt dialog?
- QThreadData *data = QThreadData::current();
- if (!data->eventLoops.isEmpty())
- data->eventLoops.top()->quit();
+ QApplication::closeAllWindows();
}
public:
mutable QSet<QByteArray> m_translations;
@@ -212,7 +209,12 @@ void tst_languageChange::retranslatability()
"languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to "
"get proper widget layout.");
TransformTranslator translator;
+#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
+ // Allow a little extra time or emulator startup delays cause failure
+ QTimer::singleShot(5000, &translator, SLOT(install()));
+#else
QTimer::singleShot(500, &translator, SLOT(install()));
+#endif
switch (dialogType) {
case InputDialog:
(void)QInputDialog::getInteger(0, QLatin1String("title"), QLatin1String("label"));
@@ -235,7 +237,17 @@ void tst_languageChange::retranslatability()
QString fooName = tmpParentDir + "/foo";
QDir dir;
QCOMPARE(dir.mkpath(tmpDir), true);
+#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
+ // Just create a new file instead of copying exe, because exe is not there in emulator
+ {
+ QFile fooFile(fooName);
+ QVERIFY(fooFile.open(QIODevice::WriteOnly | QIODevice::Text));
+ for(int i=0; i<2048; i++) // File needs to be big enough for size to read in KB
+ fooFile.write("@");
+ }
+#else
QCOMPARE(QFile::copy(QApplication::applicationFilePath(), fooName), true);
+#endif
dlg.setDirectory(tmpParentDir);
#ifdef Q_OS_WINCE
@@ -244,7 +256,12 @@ void tst_languageChange::retranslatability()
dlg.setFileMode(QFileDialog::ExistingFiles);
dlg.setViewMode(QFileDialog::Detail);
dlg.exec();
+#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
+ // increase the wait time because of increased delay caused by emulator startup
+ QTest::qWait(15000);
+#else
QTest::qWait(3000);
+#endif
QCOMPARE(QFile::remove(fooName), true);
QCOMPARE(dir.rmdir(tmpDir), true);
QCOMPARE(dir.rmdir(tmpParentDir), true);
diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h
index 64bfaee..702dabb 100644
--- a/tests/auto/network-settings.h
+++ b/tests/auto/network-settings.h
@@ -1,6 +1,4 @@
/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the test suite of the Qt Toolkit.
@@ -39,21 +37,84 @@
**
****************************************************************************/
#include <QString>
+#ifdef QT_NETWORK_LIB
#include <QtNetwork/QHostInfo>
+#endif
+
+
+#ifdef Q_OS_SYMBIAN
+#include <sys/socket.h>
+#include <net/if.h>
+#include <QSharedPointer>
+#include <QHash>
+#endif
+#if defined(Q_OS_SYMBIAN)
+#if defined(Q_CC_NOKIAX86)
+// In emulator we use WINSOCK connectivity by default. Unfortunately winsock
+// does not work very well with UDP sockets. This defines skips some test
+// cases which have known problems.
+
+// NOTE: Prefer to use WINPCAP based connectivity in S60 emulator when running
+// network tests. WINPCAP connectivity uses Symbian OS IP stack,
+// correspondingly as HW does. When using WINPCAP disable this define
+//#define SYMBIAN_WINSOCK_CONNECTIVITY
+#endif // Q_CC_NOKIAX86
+
+class QtNetworkSettingsRecord {
+public:
+ QtNetworkSettingsRecord() { }
+
+ QtNetworkSettingsRecord(const QString& recName, const QString& recVal)
+ : strRecordName(recName), strRecordValue(recVal) { }
+
+ QtNetworkSettingsRecord(const QtNetworkSettingsRecord & other)
+ : strRecordName(other.strRecordName), strRecordValue(other.strRecordValue) { }
+
+ ~QtNetworkSettingsRecord() { }
+
+ const QString& recordName() const { return strRecordName; }
+ const QString& recordValue() const { return strRecordValue; }
+
+private:
+ QString strRecordName;
+ QString strRecordValue;
+};
+
+#endif // Q_OS_SYMBIAN
class QtNetworkSettings
{
public:
+
static QString serverLocalName()
{
+#ifdef Q_OS_SYMBIAN
+ loadTestSettings();
+
+ if(QtNetworkSettings::entries.contains("server.localname")) {
+ QtNetworkSettingsRecord* entry = entries["server.localname"];
+ return entry->recordValue();
+ }
+#endif
return QString("qt-test-server");
}
static QString serverDomainName()
{
+#ifdef Q_OS_SYMBIAN
+ loadTestSettings();
+
+ if(QtNetworkSettings::entries.contains("server.domainname")) {
+ QtNetworkSettingsRecord* entry = entries["server.domainname"];
+ return entry->recordValue();
+ }
+#endif
return QString("qt-test-net");
}
static QString serverName()
{
+#ifdef Q_OS_SYMBIAN
+ loadTestSettings();
+#endif
return serverLocalName() + "." + serverDomainName();
}
static QString winServerName()
@@ -63,13 +124,205 @@ public:
static QString wildcardServerName()
{
return "qt-test-server.wildcard.dev." + serverDomainName();
+ //return "qttest.wildcard.dev." + serverDomainName();
}
#ifdef QT_NETWORK_LIB
static QHostAddress serverIP()
{
+#ifdef Q_OS_SYMBIAN
+ loadTestSettings();
+
+ if(QtNetworkSettings::entries.contains("server.ip")) {
+ QtNetworkSettingsRecord* entry = entries["server.ip"];
+ if(serverIp.isNull()) {
+ serverIp = entry->recordValue().toAscii();
+ }
+ return QHostAddress(serverIp.data());
+ }
+#endif
return QHostInfo::fromName(serverName()).addresses().first();
}
#endif
+ static QByteArray expectedReplyIMAP()
+ {
+#ifdef Q_OS_SYMBIAN
+ loadTestSettings();
+
+ if(QtNetworkSettings::entries.contains("imap.expectedreply")) {
+ QtNetworkSettingsRecord* entry = entries["imap.expectedreply"];
+ if(imapExpectedReply.isNull()) {
+ imapExpectedReply = entry->recordValue().toAscii();
+ imapExpectedReply.append('\r').append('\n');
+ }
+ return imapExpectedReply.data();
+ }
+#else
+ QByteArray expected( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] " );
+ expected = expected.append(QtNetworkSettings::serverName().toAscii());
+ expected = expected.append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ return expected;
+#endif
+ }
+
+ static QByteArray expectedReplySSL()
+ {
+#ifdef Q_OS_SYMBIAN
+ loadTestSettings();
+
+ if(QtNetworkSettings::entries.contains("imap.expectedreplyssl")) {
+ QtNetworkSettingsRecord* entry = entries["imap.expectedreplyssl"];
+ if(imapExpectedReplySsl.isNull()) {
+ imapExpectedReplySsl = entry->recordValue().toAscii();
+ imapExpectedReplySsl.append('\r').append('\n');
+ }
+ return imapExpectedReplySsl.data();
+ }
+#endif
+ QByteArray expected( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID AUTH=PLAIN SASL-IR] " );
+ expected = expected.append(QtNetworkSettings::serverLocalName().toAscii());
+ expected = expected.append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ return expected;
+ }
+
+ static QByteArray expectedReplyFtp()
+ {
+ QByteArray expected( "220 (vsFTPd 2.0.5)\r\n221 Goodbye.\r\n" );
+ return expected;
+ }
+
+#ifdef Q_OS_SYMBIAN
+ static void setDefaultIap()
+ {
+ loadDefaultIap();
+
+ struct ifreq ifReq;
+ if(entries.contains("iap.default")) {
+ QtNetworkSettingsRecord* entry = entries["iap.default"];
+ QByteArray tmp(entry->recordValue().toAscii());
+ strcpy( ifReq.ifr_name, tmp.data());
+ }
+ else // some default value
+ strcpy( ifReq.ifr_name, "Lab");
+
+ int err = setdefaultif( &ifReq );
+ if(err)
+ printf("Setting default IAP - '%s' failed: %d\n", ifReq.ifr_name, err);
+ else
+ printf("'%s' used as an default IAP\n", ifReq.ifr_name);
+ }
+#endif
+
+private:
+
+#ifdef Q_OS_SYMBIAN
+
+ static QHash<QString, QtNetworkSettingsRecord* > entries;
+ static bool bDefaultIapLoaded;
+ static bool bTestSettingsLoaded;
+ static QString iapFileFullPath;
+ static QByteArray serverIp;
+ static QByteArray imapExpectedReply;
+ static QByteArray imapExpectedReplySsl;
+
+ static bool loadDefaultIap() {
+ if(bDefaultIapLoaded)
+ return true;
+
+ QFile iapCfgFile(iapFileFullPath);
+
+ bool bFoundDefaultIapTag = false;
+
+ if (iapCfgFile.open(QFile::ReadOnly)) {
+ QTextStream input(&iapCfgFile);
+ QString line;
+ do {
+ line = input.readLine().trimmed();
+ if(line.startsWith(QString("#")))
+ continue; // comment found
+
+ if(line.contains(QString("[DEFAULT]"))) {
+ bFoundDefaultIapTag = true;
+ } else if(line.contains(QString("[")) && bFoundDefaultIapTag) {
+ break;
+ }
+
+ if(bFoundDefaultIapTag && line.contains("name")) {
+ int position = line.indexOf(QString("="));
+ position += QString("=").length();
+
+ //create record
+ QtNetworkSettingsRecord *entry =
+ new QtNetworkSettingsRecord( QString("iap.default"), line.mid(position).trimmed() );
+ entries.insert(entry->recordName(), entry);
+ break;
+ }
+ } while (!line.isNull());
+ }
+
+ return bDefaultIapLoaded = bFoundDefaultIapTag;
+ }
+
+ static bool loadTestSettings() {
+ if(bTestSettingsLoaded)
+ return true;
+
+ QFile cfgFile(iapFileFullPath);
+ bool bFoundTestTag = false;
+
+ if (cfgFile.open(QFile::ReadOnly)) {
+ QTextStream input(&cfgFile);
+ QString line;
+ do {
+ line = input.readLine().trimmed();
+
+ if(line.startsWith(QString("#")) || line.length() == 0)
+ continue; // comment or empty line found
+
+ if(line.contains(QString("[TEST]"))) {
+ bFoundTestTag = true;
+ } else if(line.startsWith(QString("[")) && bFoundTestTag) {
+ bFoundTestTag = false;
+ break; // finished with test tag
+ }
+
+ if(bFoundTestTag) { // non-empty line
+ int position = line.indexOf(QString("="));
+
+ if(position <= 0) // not found
+ continue;
+
+ // found - extract
+
+ QString recname = line.mid(0, position - QString("=").length()).trimmed();
+ QString recval = line.mid(position + QString("=").length()).trimmed();
+
+ //create record
+ QtNetworkSettingsRecord *entry = new QtNetworkSettingsRecord(recname, recval);
+ entries.insert(entry->recordName(), entry);
+ }
+ } while (!line.isNull());
+ }
+
+ return bTestSettingsLoaded = true;
+ }
+#endif
+
+
};
+#ifdef Q_OS_SYMBIAN
+QHash<QString, QtNetworkSettingsRecord* > QtNetworkSettings::entries = QHash<QString, QtNetworkSettingsRecord* > ();
+bool QtNetworkSettings::bDefaultIapLoaded = false;
+bool QtNetworkSettings::bTestSettingsLoaded = false;
+QString QtNetworkSettings::iapFileFullPath = QString("C:\\Data\\iap.txt");
+QByteArray QtNetworkSettings::serverIp;
+QByteArray QtNetworkSettings::imapExpectedReply;
+QByteArray QtNetworkSettings::imapExpectedReplySsl;
+#endif
+
+#ifdef Q_OS_SYMBIAN
+#define Q_SET_DEFAULT_IAP QtNetworkSettings::setDefaultIap();
+#else
+#define Q_SET_DEFAULT_IAP
+#endif
diff --git a/tests/auto/networkselftest/networkselftest.pro b/tests/auto/networkselftest/networkselftest.pro
index 9e2ad0e..ac610de 100644
--- a/tests/auto/networkselftest/networkselftest.pro
+++ b/tests/auto/networkselftest/networkselftest.pro
@@ -2,5 +2,4 @@ load(qttest_p4)
SOURCES += tst_networkselftest.cpp
QT = core network
-DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp
index 0dc3c62..5e07762 100644
--- a/tests/auto/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/networkselftest/tst_networkselftest.cpp
@@ -46,6 +46,10 @@
class tst_NetworkSelfTest: public QObject
{
Q_OBJECT
+public:
+ tst_NetworkSelfTest();
+ virtual ~tst_NetworkSelfTest();
+
private slots:
void hostTest();
void dnsResolution_data();
@@ -303,6 +307,15 @@ static void netChat(int port, const QList<Chat> &chat)
}
}
+tst_NetworkSelfTest::tst_NetworkSelfTest()
+{
+ Q_SET_DEFAULT_IAP
+}
+
+tst_NetworkSelfTest::~tst_NetworkSelfTest()
+{
+}
+
void tst_NetworkSelfTest::hostTest()
{
// this is a localhost self-test
@@ -361,6 +374,11 @@ void tst_NetworkSelfTest::remotePortsOpen_data()
void tst_NetworkSelfTest::remotePortsOpen()
{
+#ifdef Q_OS_SYMBIAN
+ if (qstrcmp(QTest::currentDataTag(), "http-proxy-auth-ntlm") == 0)
+ QSKIP("NTML authentication not yet supported in Symbian", SkipSingle);
+#endif
+
QFETCH(int, portNumber);
QTcpSocket socket;
socket.connectToHost(QtNetworkSettings::serverName(), portNumber);
@@ -514,6 +532,9 @@ void tst_NetworkSelfTest::httpProxyBasicAuth()
void tst_NetworkSelfTest::httpProxyNtlmAuth()
{
+#ifdef Q_OS_SYMBIAN
+ QSKIP("NTML authentication not yet supported in Symbian", SkipAll);
+#else
netChat(3130, QList<Chat>()
// test auth required response
<< Chat::send("GET http://" + QtNetworkSettings::serverName().toLatin1() + "/ HTTP/1.0\r\n"
@@ -526,6 +547,7 @@ void tst_NetworkSelfTest::httpProxyNtlmAuth()
<< Chat::discardUntil("\r\nProxy-Authenticate: NTLM\r\n")
<< Chat::DiscardUntilDisconnect
);
+#endif
}
// SOCKSv5 is a binary protocol
diff --git a/tests/auto/patternistexamplefiletree/patternistexamplefiletree.pro b/tests/auto/patternistexamplefiletree/patternistexamplefiletree.pro
index 9e962d0..772c833 100644
--- a/tests/auto/patternistexamplefiletree/patternistexamplefiletree.pro
+++ b/tests/auto/patternistexamplefiletree/patternistexamplefiletree.pro
@@ -1,4 +1,5 @@
load(qttest_p4)
SOURCES += tst_patternistexamplefiletree.cpp
+QT = core
include (../xmlpatterns.pri)
diff --git a/tests/auto/patternistexamples/patternistexamples.pro b/tests/auto/patternistexamples/patternistexamples.pro
index 90fc166..4092fc8 100644
--- a/tests/auto/patternistexamples/patternistexamples.pro
+++ b/tests/auto/patternistexamples/patternistexamples.pro
@@ -1,7 +1,7 @@
load(qttest_p4)
SOURCES += tst_patternistexamples.cpp
CONFIG += qtestlib
-wince*: {
+wince*|symbian*: {
snippets.sources = $$QT_SOURCE_TREE/doc/src/snippets/patternist/*
snippets.path = patternist
widgetRen.sources = $$QT_SOURCE_TREE/examples/xmlpatterns/xquery/widgetRenderer/*
diff --git a/tests/auto/patternistheaders/patternistheaders.pro b/tests/auto/patternistheaders/patternistheaders.pro
index be93266..fe4d670 100644
--- a/tests/auto/patternistheaders/patternistheaders.pro
+++ b/tests/auto/patternistheaders/patternistheaders.pro
@@ -1,4 +1,5 @@
load(qttest_p4)
SOURCES += tst_patternistheaders.cpp
+QT = core
include (../xmlpatterns.pri)
diff --git a/tests/auto/q3urloperator/copy.res/.gitattributes b/tests/auto/q3urloperator/copy.res/.gitattributes
new file mode 100644
index 0000000..e04709a
--- /dev/null
+++ b/tests/auto/q3urloperator/copy.res/.gitattributes
@@ -0,0 +1 @@
+rfc3252.txt -crlf
diff --git a/tests/auto/q_func_info/q_func_info.pro b/tests/auto/q_func_info/q_func_info.pro
index fa60aff..b30e3fb 100644
--- a/tests/auto/q_func_info/q_func_info.pro
+++ b/tests/auto/q_func_info/q_func_info.pro
@@ -1,3 +1,3 @@
load(qttest_p4)
SOURCES += tst_q_func_info.cpp
-QT -= gui
+QT = core
diff --git a/tests/auto/q_func_info/tst_q_func_info.cpp b/tests/auto/q_func_info/tst_q_func_info.cpp
index fa985b1..51c5dd1 100644
--- a/tests/auto/q_func_info/tst_q_func_info.cpp
+++ b/tests/auto/q_func_info/tst_q_func_info.cpp
@@ -41,7 +41,7 @@
#include <QString>
-#include <QTest>
+#include <QtTest/QtTest>
#include <QtDebug>
class tst_q_func_info : public QObject
diff --git a/tests/auto/qabstractitemmodel/qabstractitemmodel.pro b/tests/auto/qabstractitemmodel/qabstractitemmodel.pro
index 9bc660d..5ad1020 100644
--- a/tests/auto/qabstractitemmodel/qabstractitemmodel.pro
+++ b/tests/auto/qabstractitemmodel/qabstractitemmodel.pro
@@ -1,6 +1,3 @@
load(qttest_p4)
SOURCES += tst_qabstractitemmodel.cpp
-
-#QT = core
-
-
+QT = core
diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
index edbbac4..496ab45 100644
--- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
@@ -148,8 +148,10 @@ public:
inline QItemSelectionModel::SelectionFlags tst_selectionCommand(const QModelIndex &index,
const QEvent *event = 0) const
{ return selectionCommand(index, event); }
+#ifndef QT_NO_DRAGANDDROP
inline void tst_startDrag(Qt::DropActions supportedActions)
{ startDrag(supportedActions); }
+#endif
inline QStyleOptionViewItem tst_viewOptions() const
{ return viewOptions(); }
enum tst_State {
@@ -267,11 +269,12 @@ void tst_QAbstractItemView::getSetCheck()
// bool QAbstractItemView::dragEnabled()
// void QAbstractItemView::setDragEnabled(bool)
+#ifndef QT_NO_DRAGANDDROP
obj1->setDragEnabled(false);
QCOMPARE(false, obj1->dragEnabled());
obj1->setDragEnabled(true);
QCOMPARE(true, obj1->dragEnabled());
-
+#endif
// bool QAbstractItemView::alternatingRowColors()
// void QAbstractItemView::setAlternatingRowColors(bool)
obj1->setAlternatingRowColors(false);
@@ -440,6 +443,7 @@ void tst_QAbstractItemView::basic_tests(TestView *view)
view->setTabKeyNavigation(true);
QCOMPARE(view->tabKeyNavigation(), true);
+#ifndef QT_NO_DRAGANDDROP
// setDropIndicatorShown
view->setDropIndicatorShown(false);
QCOMPARE(view->showDropIndicator(), false);
@@ -451,6 +455,7 @@ void tst_QAbstractItemView::basic_tests(TestView *view)
QCOMPARE(view->dragEnabled(), false);
view->setDragEnabled(true);
QCOMPARE(view->dragEnabled(), true);
+#endif
// setAlternatingRowColors
view->setAlternatingRowColors(false);
@@ -545,6 +550,7 @@ void tst_QAbstractItemView::basic_tests(TestView *view)
view->tst_selectionCommand(QModelIndex(), 0);
+#ifndef QT_NO_DRAGANDDROP
if (!view->model())
view->tst_startDrag(Qt::CopyAction);
@@ -562,6 +568,7 @@ void tst_QAbstractItemView::basic_tests(TestView *view)
QVERIFY(view->tst_state()==TestView::ExpandingState);
view->tst_setState(TestView::CollapsingState);
QVERIFY(view->tst_state()==TestView::CollapsingState);
+#endif
view->tst_startAutoScroll();
view->tst_stopAutoScroll();
diff --git a/tests/auto/qabstractmessagehandler/qabstractmessagehandler.pro b/tests/auto/qabstractmessagehandler/qabstractmessagehandler.pro
index 4b2e7b4..5c50103 100644
--- a/tests/auto/qabstractmessagehandler/qabstractmessagehandler.pro
+++ b/tests/auto/qabstractmessagehandler/qabstractmessagehandler.pro
@@ -1,4 +1,5 @@
load(qttest_p4)
SOURCES += tst_qabstractmessagehandler.cpp
+QT = core
include (../xmlpatterns.pri)
diff --git a/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro b/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro
index cffadb0..11e340d 100644
--- a/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro
+++ b/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro
@@ -2,7 +2,7 @@ load(qttest_p4)
QT += network
SOURCES += tst_qabstractnetworkcache.cpp
-wince*: {
+wince*|symbian: {
testFiles.sources = tests
testFiles.path = .
DEPLOYMENT += testFiles
diff --git a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
index 1ac72b5..d5e9fea 100644
--- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
+++ b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
@@ -81,8 +81,12 @@ public:
: QNetworkDiskCache(parent)
, gotData(false)
{
+#ifdef Q_OS_SYMBIAN
+ QString location = QLatin1String("./cache/");
+#else
QString location = QDesktopServices::storageLocation(QDesktopServices::DataLocation)
- + QLatin1String("/cache/");
+ + QLatin1String("/cache/");
+#endif
setCacheDirectory(location);
clear();
}
@@ -99,6 +103,8 @@ public:
tst_QAbstractNetworkCache::tst_QAbstractNetworkCache()
{
+ Q_SET_DEFAULT_IAP
+
QCoreApplication::setOrganizationName(QLatin1String("Trolltech"));
QCoreApplication::setApplicationName(QLatin1String("autotest_qabstractnetworkcache"));
QCoreApplication::setApplicationVersion(QLatin1String("1.0"));
diff --git a/tests/auto/qabstracturiresolver/qabstracturiresolver.pro b/tests/auto/qabstracturiresolver/qabstracturiresolver.pro
index de9a368..0d76208 100644
--- a/tests/auto/qabstracturiresolver/qabstracturiresolver.pro
+++ b/tests/auto/qabstracturiresolver/qabstracturiresolver.pro
@@ -1,5 +1,6 @@
load(qttest_p4)
SOURCES += tst_qabstracturiresolver.cpp
HEADERS += TestURIResolver.h
+QT = core
include (../xmlpatterns.pri)
diff --git a/tests/auto/qabstractxmlforwarditerator/qabstractxmlforwarditerator.pro b/tests/auto/qabstractxmlforwarditerator/qabstractxmlforwarditerator.pro
index f6dca8b..6bc0c59 100644
--- a/tests/auto/qabstractxmlforwarditerator/qabstractxmlforwarditerator.pro
+++ b/tests/auto/qabstractxmlforwarditerator/qabstractxmlforwarditerator.pro
@@ -1,4 +1,5 @@
load(qttest_p4)
SOURCES += tst_qabstractxmlforwarditerator.cpp
+QT = core
include (../xmlpatterns.pri)
diff --git a/tests/auto/qabstractxmlreceiver/qabstractxmlreceiver.pro b/tests/auto/qabstractxmlreceiver/qabstractxmlreceiver.pro
index ad3f2b2..2bd2ba4 100644
--- a/tests/auto/qabstractxmlreceiver/qabstractxmlreceiver.pro
+++ b/tests/auto/qabstractxmlreceiver/qabstractxmlreceiver.pro
@@ -1,4 +1,5 @@
load(qttest_p4)
SOURCES += tst_qabstractxmlreceiver.cpp
+QT = core
include (../xmlpatterns.pri)
diff --git a/tests/auto/qaction/tst_qaction.cpp b/tests/auto/qaction/tst_qaction.cpp
index 2c6d421..f8d7acf 100644
--- a/tests/auto/qaction/tst_qaction.cpp
+++ b/tests/auto/qaction/tst_qaction.cpp
@@ -240,7 +240,7 @@ void tst_QAction::setStandardKeys()
QVERIFY(act.shortcut() == act.shortcuts().first());
QList<QKeySequence> expected;
-#ifdef Q_WS_MAC
+#if defined(Q_WS_MAC) || defined(Q_OS_SYMBIAN)
expected << QKeySequence("CTRL+C");
#elif defined(Q_WS_WIN) || defined(Q_WS_QWS)
expected << QKeySequence("CTRL+C") << QKeySequence("CTRL+INSERT");
diff --git a/tests/auto/qanimationgroup/qanimationgroup.pro b/tests/auto/qanimationgroup/qanimationgroup.pro
index 97d33dd..31667a8 100644
--- a/tests/auto/qanimationgroup/qanimationgroup.pro
+++ b/tests/auto/qanimationgroup/qanimationgroup.pro
@@ -1,5 +1,5 @@
load(qttest_p4)
-QT = core gui
+QT = core
SOURCES += tst_qanimationgroup.cpp
diff --git a/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro b/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro
index 904a62a..93a03db 100644
--- a/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro
+++ b/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro
@@ -3,13 +3,18 @@
######################################################################
TEMPLATE = app
+!symbian*: {
DEPENDPATH += .
INCLUDEPATH += .
-wince*:TARGET = ../desktopsettingsaware
+}
+wince*|symbian*:TARGET = ../desktopsettingsaware
+
# Input
SOURCES += main.cpp
CONFIG += qt warn_on create_prl link_prl
CONFIG -= app_bundle
+
+!symbian*: {
OBJECTS_DIR=.obj/debug-shared
MOC_DIR=.moc/debug-shared
-
+}
diff --git a/tests/auto/qapplication/test/test.pro b/tests/auto/qapplication/test/test.pro
index cda7940..7c3de3c 100644
--- a/tests/auto/qapplication/test/test.pro
+++ b/tests/auto/qapplication/test/test.pro
@@ -11,6 +11,14 @@ wince* {
DEPLOYMENT = additional deploy someTest
}
+symbian*: {
+ additional.sources = ../desktopsettingsaware/desktopsettingsaware.exe
+ additional.path = desktopsettingsaware
+ someTest.sources = test.pro
+ someTest.path = test
+ DEPLOYMENT = additional deploy someTest
+}
+
win32 {
CONFIG(debug, debug|release) {
TARGET = ../../debug/tst_qapplication
diff --git a/tests/auto/qapplication/tst_qapplication.cpp b/tests/auto/qapplication/tst_qapplication.cpp
index 00d676f..e37e52d 100644
--- a/tests/auto/qapplication/tst_qapplication.cpp
+++ b/tests/auto/qapplication/tst_qapplication.cpp
@@ -57,6 +57,21 @@
//TESTED_CLASS=
//TESTED_FILES=
+#if defined(Q_OS_SYMBIAN)
+// In Symbian, the PluginsPath doesn't specify the only absolute path; just the dir that can be found on any drive
+static void addExpectedSymbianPluginsPath(QStringList& expected)
+{
+ QString installPathPlugins = QDir::fromNativeSeparators(QLibraryInfo::location(QLibraryInfo::PluginsPath));
+ QFileInfoList driveList = QDir::drives();
+ QListIterator<QFileInfo> iter(driveList);
+ while (iter.hasNext()) {
+ QFileInfo testFi(iter.next().canonicalPath().append(installPathPlugins));
+ if (testFi.exists())
+ expected << testFi.canonicalFilePath();
+ }
+}
+#endif
+
class tst_QApplication : public QObject
{
Q_OBJECT
@@ -787,7 +802,13 @@ void tst_QApplication::libraryPaths()
QStringList actual = QApplication::libraryPaths();
actual.sort();
+#if defined(Q_OS_SYMBIAN)
+ QStringList expected;
+ addExpectedSymbianPluginsPath(expected);
+ expected << appDirPath;
+#else
QStringList expected = QSet<QString>::fromList((QStringList() << installPathPlugins << appDirPath)).toList();
+#endif
expected.sort();
QVERIFY2(isPathListIncluded(actual, expected),
@@ -890,7 +911,11 @@ void tst_QApplication::libraryPaths_qt_plugin_path()
void tst_QApplication::libraryPaths_qt_plugin_path_2()
{
-#ifdef Q_OS_UNIX
+#ifdef Q_OS_SYMBIAN
+ QByteArray validPath = "C:\\data";
+ QByteArray nonExistentPath = "Z:\\nonexistent";
+ QByteArray pluginPath = validPath + ";" + nonExistentPath;
+#elif defined(Q_OS_UNIX)
QByteArray validPath = QDir("/tmp").canonicalPath().toLatin1();
QByteArray nonExistentPath = "/nonexistent";
QByteArray pluginPath = validPath + ":" + nonExistentPath;
@@ -915,19 +940,25 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2()
QApplication app(argc, &argv0, QApplication::GuiServer);
// library path list should contain the default plus the one valid path
+#if defined(Q_OS_SYMBIAN)
+ // In Symbian, the PluginsPath doesn't specify the only absolute path; just the dir that can be found on any drive
+ QStringList expected;
+ addExpectedSymbianPluginsPath(expected);
+ expected << QDir(app.applicationDirPath()).canonicalPath()
+ << QDir(QDir::fromNativeSeparators(QString::fromLatin1(validPath))).canonicalPath();
+#else
QStringList expected =
QStringList()
<< QLibraryInfo::location(QLibraryInfo::PluginsPath)
<< QDir(app.applicationDirPath()).canonicalPath()
<< QDir(QDir::fromNativeSeparators(QString::fromLatin1(validPath))).canonicalPath();
-#ifdef Q_OS_WINCE
+# ifdef Q_OS_WINCE
expected = QSet<QString>::fromList(expected).toList();
+# endif
#endif
QVERIFY2(isPathListIncluded(app.libraryPaths(), expected),
qPrintable("actual:\n - " + app.libraryPaths().join("\n - ") +
"\nexpected:\n - " + expected.join("\n - ")));
-
- qputenv("QT_PLUGIN_PATH", QByteArray());
}
{
@@ -939,13 +970,19 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2()
// the environment variable here doesn't work
qputenv("QT_PLUGIN_PATH", pluginPath);
- // library path list should contain the default plus the one valid path
+ // library path list should contain the default
+#if defined(Q_OS_SYMBIAN)
+ QStringList expected;
+ addExpectedSymbianPluginsPath(expected);
+ expected << app.applicationDirPath();
+#else
QStringList expected =
QStringList()
<< QLibraryInfo::location(QLibraryInfo::PluginsPath)
<< app.applicationDirPath();
-#ifdef Q_OS_WINCE
+# ifdef Q_OS_WINCE
expected = QSet<QString>::fromList(expected).toList();
+# endif
#endif
QVERIFY(isPathListIncluded(app.libraryPaths(), expected));
@@ -1393,6 +1430,13 @@ void tst_QApplication::desktopSettingsAware()
testProcess.start("desktopsettingsaware/debug/desktopsettingsaware");
#elif defined(Q_OS_WIN)
testProcess.start("desktopsettingsaware/release/desktopsettingsaware");
+#elif defined(Q_OS_SYMBIAN)
+ testProcess.start("desktopsettingsaware");
+#if defined(Q_CC_NOKIAX86)
+ QEXPECT_FAIL("", "QProcess on Q_CC_NOKIAX86 cannot launch another Qt application, due to DLL conflicts.", Abort);
+ // TODO: Remove XFAIL, as soon as we can launch Qt applications from within Qt applications on Symbian
+ QVERIFY(testProcess.error() != QProcess::FailedToStart);
+#endif // defined(Q_CC_NOKIAX86)
#else
testProcess.start("desktopsettingsaware/desktopsettingsaware");
#endif
diff --git a/tests/auto/qatomicint/qatomicint.pro b/tests/auto/qatomicint/qatomicint.pro
index 26b5b90..4a09d5f 100644
--- a/tests/auto/qatomicint/qatomicint.pro
+++ b/tests/auto/qatomicint/qatomicint.pro
@@ -1,6 +1,3 @@
load(qttest_p4)
-
SOURCES += tst_qatomicint.cpp
QT = core
-
-
diff --git a/tests/auto/qatomicpointer/qatomicpointer.pro b/tests/auto/qatomicpointer/qatomicpointer.pro
index d4e88f6..d192bad 100644
--- a/tests/auto/qatomicpointer/qatomicpointer.pro
+++ b/tests/auto/qatomicpointer/qatomicpointer.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qatomicpointer.cpp
QT = core
-
-
diff --git a/tests/auto/qautoptr/qautoptr.pro b/tests/auto/qautoptr/qautoptr.pro
index 5058409..b0c574f 100644
--- a/tests/auto/qautoptr/qautoptr.pro
+++ b/tests/auto/qautoptr/qautoptr.pro
@@ -1,4 +1,4 @@
load(qttest_p4)
SOURCES += tst_qautoptr.cpp
-QT -= gui
+QT = core
include(../xmlpatterns.pri)
diff --git a/tests/auto/qbitarray/qbitarray.pro b/tests/auto/qbitarray/qbitarray.pro
index 182b06a..ec110c6 100644
--- a/tests/auto/qbitarray/qbitarray.pro
+++ b/tests/auto/qbitarray/qbitarray.pro
@@ -1,7 +1,3 @@
load(qttest_p4)
SOURCES += tst_qbitarray.cpp
-
-
QT = core
-
-
diff --git a/tests/auto/qbitarray/tst_qbitarray.cpp b/tests/auto/qbitarray/tst_qbitarray.cpp
index d48ace1..a98cc3d 100644
--- a/tests/auto/qbitarray/tst_qbitarray.cpp
+++ b/tests/auto/qbitarray/tst_qbitarray.cpp
@@ -43,7 +43,6 @@
#include <QtTest/QtTest>
#include <QtCore/QBuffer>
#include <QtCore/QDataStream>
-#include <iostream>
#include "qbitarray.h"
@@ -109,6 +108,8 @@ private slots:
void invertOnNull() const;
void operator_noteq_data();
void operator_noteq();
+
+ void resize();
};
Q_DECLARE_METATYPE(QBitArray)
@@ -629,5 +630,30 @@ void tst_QBitArray::operator_noteq()
QCOMPARE(b, res);
}
+void tst_QBitArray::resize()
+{
+ // -- check that a resize handles the bits correctly
+ QBitArray a = QStringToQBitArray(QString("11"));
+ a.resize(10);
+ QVERIFY(a.size() == 10);
+ QCOMPARE( a, QStringToQBitArray(QString("1100000000")) );
+
+ a.setBit(9);
+ a.resize(9);
+ // now the bit in a should have been gone:
+ QCOMPARE( a, QStringToQBitArray(QString("110000000")) );
+
+ // grow the array back and check the new bit
+ a.resize(10);
+ QCOMPARE( a, QStringToQBitArray(QString("1100000000")) );
+
+ // other test with and
+ a.resize(9);
+ QBitArray b = QStringToQBitArray(QString("1111111111"));
+ b &= a;
+ QCOMPARE( b, QStringToQBitArray(QString("1100000000")) );
+
+}
+
QTEST_APPLESS_MAIN(tst_QBitArray)
#include "tst_qbitarray.moc"
diff --git a/tests/auto/qbuffer/qbuffer.pro b/tests/auto/qbuffer/qbuffer.pro
index fc5842d..ea83657 100644
--- a/tests/auto/qbuffer/qbuffer.pro
+++ b/tests/auto/qbuffer/qbuffer.pro
@@ -1,7 +1,3 @@
load(qttest_p4)
SOURCES += tst_qbuffer.cpp
-
-
QT = core
-
-
diff --git a/tests/auto/qbytearray/.gitattributes b/tests/auto/qbytearray/.gitattributes
new file mode 100644
index 0000000..e04709a
--- /dev/null
+++ b/tests/auto/qbytearray/.gitattributes
@@ -0,0 +1 @@
+rfc3252.txt -crlf
diff --git a/tests/auto/qbytearray/qbytearray.pro b/tests/auto/qbytearray/qbytearray.pro
index f41c7ae..d14534b 100644
--- a/tests/auto/qbytearray/qbytearray.pro
+++ b/tests/auto/qbytearray/qbytearray.pro
@@ -4,11 +4,16 @@ SOURCES += tst_qbytearray.cpp
QT = core
-wince*: {
+wince*|symbian: {
addFile.sources = rfc3252.txt
addFile.path = .
DEPLOYMENT += addFile
+}
+
+wince: {
DEFINES += SRCDIR=\\\"\\\"
+} symbian: {
+ TARGET.EPOCHEAPSIZE="0x100 0x800000"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qbytearray/tst_qbytearray.cpp b/tests/auto/qbytearray/tst_qbytearray.cpp
index 47b0937..4ec02bc 100644
--- a/tests/auto/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/qbytearray/tst_qbytearray.cpp
@@ -53,6 +53,10 @@
//TESTED_CLASS=
//TESTED_FILES=
+#if defined(Q_OS_SYMBIAN)
+#define SRCDIR ""
+#endif
+
class tst_QByteArray : public QObject
{
Q_OBJECT
@@ -957,7 +961,7 @@ void tst_QByteArray::toInt()
QCOMPARE( number, expectednumber );
}
-Q_DECLARE_METATYPE(qulonglong);
+Q_DECLARE_METATYPE(qulonglong)
void tst_QByteArray::toULong_data()
{
QTest::addColumn<QByteArray>("str");
@@ -967,8 +971,8 @@ void tst_QByteArray::toULong_data()
ulong LongMaxPlusOne = (ulong)LONG_MAX + 1;
QTest::newRow("LONG_MAX+1") << QString::number(LongMaxPlusOne).toLatin1() << 10 << LongMaxPlusOne << true;
- QTest::newRow("default") << QByteArray() << 10 << 0UL << FALSE;
- QTest::newRow("empty") << QByteArray("") << 10 << 0UL << FALSE;
+ QTest::newRow("default") << QByteArray() << 10 << 0UL << false;
+ QTest::newRow("empty") << QByteArray("") << 10 << 0UL << false;
QTest::newRow("ulong1") << QByteArray("3234567890") << 10 << 3234567890UL << true;
QTest::newRow("ulong2") << QByteArray("fFFfFfFf") << 16 << 0xFFFFFFFFUL << true;
}
@@ -993,8 +997,8 @@ void tst_QByteArray::toULongLong_data()
QTest::addColumn<qulonglong>("result");
QTest::addColumn<bool>("ok");
- QTest::newRow("default") << QByteArray() << 10 << (qulonglong)0 << FALSE;
- QTest::newRow("out of base bound") << QByteArray("c") << 10 << (qulonglong)0 << FALSE;
+ QTest::newRow("default") << QByteArray() << 10 << (qulonglong)0 << false;
+ QTest::newRow("out of base bound") << QByteArray("c") << 10 << (qulonglong)0 << false;
}
@@ -1136,12 +1140,12 @@ void tst_QByteArray::toFromHex()
void tst_QByteArray::toFromPercentEncoding()
{
QByteArray arr("Qt is great!");
-
+/*
QByteArray data = arr.toPercentEncoding();
QCOMPARE(QString(data), QString("Qt%20is%20great%21"));
QCOMPARE(QByteArray::fromPercentEncoding(data), arr);
-
- data = arr.toPercentEncoding("! ", "Qt");
+*/
+ QByteArray data = arr.toPercentEncoding("! ", "Qt");
QCOMPARE(QString(data), QString("%51%74 is grea%74!"));
QCOMPARE(QByteArray::fromPercentEncoding(data), arr);
diff --git a/tests/auto/qcache/qcache.pro b/tests/auto/qcache/qcache.pro
index d09320b..728b0b6 100644
--- a/tests/auto/qcache/qcache.pro
+++ b/tests/auto/qcache/qcache.pro
@@ -1,7 +1,3 @@
load(qttest_p4)
SOURCES += tst_qcache.cpp
-
-
QT = core
-
-
diff --git a/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp b/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp
index 417a7b6..0037c68 100644
--- a/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp
+++ b/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp
@@ -200,7 +200,7 @@ void tst_QCalendarWidget::buttonClickCheck()
QTest::qWait(500);
QWidget *widget = qFindChild<QWidget *>(&object, "qt_calendar_calendarview");
QTest::mouseMove(widget);
- QTest::mouseClick(widget, Qt::LeftButton, 0, QPoint(), 50);
+ QTest::mouseClick(widget, Qt::LeftButton);
QCOMPARE(2006, object.yearShown());
object.setSelectedDate(selectedDate);
object.showSelectedDate();
diff --git a/tests/auto/qchar/qchar.pro b/tests/auto/qchar/qchar.pro
index d8c5326..fca4ef6 100644
--- a/tests/auto/qchar/qchar.pro
+++ b/tests/auto/qchar/qchar.pro
@@ -3,7 +3,7 @@ SOURCES += tst_qchar.cpp
QT = core
-wince*: {
+wince*|symbian*: {
deploy.sources += NormalizationTest.txt
DEPLOYMENT = deploy
}
diff --git a/tests/auto/qclipboard/test/test.pro b/tests/auto/qclipboard/test/test.pro
index ba70cff..508eba1 100644
--- a/tests/auto/qclipboard/test/test.pro
+++ b/tests/auto/qclipboard/test/test.pro
@@ -10,7 +10,7 @@ win32 {
}
}
-wince*: {
+wince*|symbian*: {
copier.sources = ../copier/copier.exe
copier.path = copier
paster.sources = ../paster/paster.exe
diff --git a/tests/auto/qclipboard/tst_qclipboard.cpp b/tests/auto/qclipboard/tst_qclipboard.cpp
index e87ce3a..827272b 100644
--- a/tests/auto/qclipboard/tst_qclipboard.cpp
+++ b/tests/auto/qclipboard/tst_qclipboard.cpp
@@ -108,7 +108,7 @@ void tst_QClipboard::modes()
if (!nativeClipboardWorking())
QSKIP("Native clipboard not working in this setup", SkipAll);
- const QString defaultMode = "deafult mode text;";
+ const QString defaultMode = "default mode text;";
clipboard->setText(defaultMode);
QCOMPARE(clipboard->text(), defaultMode);
@@ -196,6 +196,8 @@ void tst_QClipboard::copy_exit_paste()
#if defined Q_WS_X11 || defined Q_WS_QWS
QSKIP("This test does not make sense on X11 and embedded, copied data disappears from the clipboard when the application exits ", SkipAll);
// ### It's still possible to test copy/paste - just keep the apps running
+#elif defined (Q_OS_SYMBIAN) && defined (Q_CC_NOKIAX86)
+ QSKIP("emulator cannot launch multiple processes",SkipAll);
#endif
if (!nativeClipboardWorking())
QSKIP("Native clipboard not working in this setup", SkipAll);
@@ -240,7 +242,7 @@ void tst_QClipboard::setMimeData()
QApplication::clipboard()->setMimeData(data, QClipboard::Clipboard);
QApplication::clipboard()->setMimeData(data, QClipboard::Selection);
QApplication::clipboard()->setMimeData(data, QClipboard::FindBuffer);
-
+
QSignalSpy spySelection(QApplication::clipboard(), SIGNAL(selectionChanged()));
QSignalSpy spyData(QApplication::clipboard(), SIGNAL(dataChanged()));
QSignalSpy spyFindBuffer(QApplication::clipboard(), SIGNAL(findBufferChanged()));
@@ -277,7 +279,7 @@ void tst_QClipboard::setMimeData()
spySelection.clear();
spyData.clear();
spyFindBuffer.clear();
-
+
QApplication::clipboard()->setMimeData(newData, QClipboard::Clipboard);
QApplication::clipboard()->setMimeData(newData, QClipboard::Selection); // used to crash on X11
QApplication::clipboard()->setMimeData(newData, QClipboard::FindBuffer);
diff --git a/tests/auto/qcolumnview/tst_qcolumnview.cpp b/tests/auto/qcolumnview/tst_qcolumnview.cpp
index f6fadb8..82913fb 100644
--- a/tests/auto/qcolumnview/tst_qcolumnview.cpp
+++ b/tests/auto/qcolumnview/tst_qcolumnview.cpp
@@ -45,7 +45,9 @@
#include <qitemdelegate.h>
#include <qcolumnview.h>
#include "../../../src/gui/itemviews/qcolumnviewgrip_p.h"
+#ifndef Q_OS_SYMBIAN
#include "../../../src/gui/dialogs/qfilesystemmodel_p.h"
+#endif
#include <qdirmodel.h>
#include <qstringlistmodel.h>
#include <qdebug.h>
diff --git a/tests/auto/qcombobox/qcombobox.pro b/tests/auto/qcombobox/qcombobox.pro
index 60bf1c8..f36a6fe 100644
--- a/tests/auto/qcombobox/qcombobox.pro
+++ b/tests/auto/qcombobox/qcombobox.pro
@@ -2,5 +2,3 @@ load(qttest_p4)
SOURCES += tst_qcombobox.cpp
contains(QT_CONFIG, qt3support): QT += qt3support
-
-
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index 84217a8..b568c60 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -1234,7 +1234,6 @@ void tst_QComboBox::insertItem()
testWidget->setEditable(true);
if (editable)
testWidget->setEditText("FOO");
-
#if defined (QT3_SUPPORT)
if (testQt3Support)
testWidget->insertItem(itemLabel, insertIndex);
@@ -1895,10 +1894,10 @@ void tst_QComboBox::itemListPosition()
//tests that the list is not out of the screen boundaries
//put the QApplication layout back
- qApp->setLayoutDirection(Qt::LeftToRight);
+ QApplication::setLayoutDirection(Qt::LeftToRight);
//we test QFontComboBox because it has the specific behaviour to set a fixed size
- //the the list view
+ //to the list view
QFontComboBox combo;
//the code to get the avaialbe screen space is copied from QComboBox code
@@ -1915,13 +1914,17 @@ void tst_QComboBox::itemListPosition()
screen = QApplication::desktop()->availableGeometry(scrNumber);
#endif
- combo.move(screen.width()-combo.sizeHint().width(), 0); //puts the combo the the top-right corner
+ combo.move(screen.width()-combo.sizeHint().width(), 0); //puts the combo to the top-right corner
combo.show();
QTest::qWait(100); //wait because the window manager can move the window if there is a right panel
combo.showPopup();
QTest::qWait(100);
+#if defined(Q_WS_S60)
+ // Assuming that QtS60 style is used, here. But other ones would certainly also fail
+ QEXPECT_FAIL("", "QtS60Style does not yet position the combobox popup correctly", Continue);
+#endif
QVERIFY( combo.view()->window()->x() + combo.view()->window()->width() <= screen.x() + screen.width() );
}
@@ -2257,7 +2260,11 @@ void tst_QComboBox::setItemDelegate()
QComboBox comboBox;
QStyledItemDelegate *itemDelegate = new QStyledItemDelegate;
comboBox.setItemDelegate(itemDelegate);
+#ifdef Q_CC_MWERKS
+ QCOMPARE(static_cast<QStyledItemDelegate *>(comboBox.itemDelegate()), itemDelegate);
+#else
QCOMPARE(comboBox.itemDelegate(), itemDelegate);
+#endif
}
void tst_QComboBox::task253944_itemDelegateIsReset()
@@ -2267,10 +2274,18 @@ void tst_QComboBox::task253944_itemDelegateIsReset()
comboBox.setItemDelegate(itemDelegate);
comboBox.setEditable(true);
+#ifdef Q_CC_MWERKS
+ QCOMPARE(static_cast<QStyledItemDelegate *>(comboBox.itemDelegate()), itemDelegate);
+#else
QCOMPARE(comboBox.itemDelegate(), itemDelegate);
+#endif
comboBox.setStyleSheet("QComboBox { border: 1px solid gray; }");
+#ifdef Q_CC_MWERKS
+ QCOMPARE(static_cast<QStyledItemDelegate *>(comboBox.itemDelegate()), itemDelegate);
+#else
QCOMPARE(comboBox.itemDelegate(), itemDelegate);
+#endif
}
diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp
index f3e902b..e29b64d 100644
--- a/tests/auto/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/qcompleter/tst_qcompleter.cpp
@@ -575,6 +575,9 @@ void tst_QCompleter::directoryModel_data()
#elif defined(Q_OS_WIN)
QTest::newRow("()") << "C" << "" << "C:" << "C:";
QTest::newRow("()") << "C:\\Program" << "" << "Program Files" << "C:\\Program Files";
+#elif defined(Q_OS_SYMBIAN)
+ QTest::newRow("()") << "C" << "" << "C:" << "C:";
+ QTest::newRow("()") << "C:\\re" << "" << "resource" << "C:\\resource";
#elif defined (Q_OS_MAC)
QTest::newRow("()") << "" << "" << "/" << "/";
QTest::newRow("(/a)") << "/a" << "" << "Applications" << "/Applications";
diff --git a/tests/auto/qcoreapplication/qcoreapplication.pro b/tests/auto/qcoreapplication/qcoreapplication.pro
index 64a4ad4..27f5e58 100644
--- a/tests/auto/qcoreapplication/qcoreapplication.pro
+++ b/tests/auto/qcoreapplication/qcoreapplication.pro
@@ -1,6 +1,3 @@
load(qttest_p4)
SOURCES += tst_qcoreapplication.cpp
-
QT = core
-
-
diff --git a/tests/auto/qcryptographichash/qcryptographichash.pro b/tests/auto/qcryptographichash/qcryptographichash.pro
index 07d8857..aa9a7c4 100644
--- a/tests/auto/qcryptographichash/qcryptographichash.pro
+++ b/tests/auto/qcryptographichash/qcryptographichash.pro
@@ -1,6 +1,8 @@
load(qttest_p4)
-
SOURCES += tst_qcryptographichash.cpp
QT = core
-
+symbian*: {
+TARGET.EPOCSTACKSIZE =0x5000
+TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb"
+}
diff --git a/tests/auto/qcssparser/qcssparser.pro b/tests/auto/qcssparser/qcssparser.pro
index fb1f17e..ce1281f 100644
--- a/tests/auto/qcssparser/qcssparser.pro
+++ b/tests/auto/qcssparser/qcssparser.pro
@@ -1,11 +1,14 @@
load(qttest_p4)
SOURCES += tst_qcssparser.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
QT += xml
requires(contains(QT_CONFIG,private_tests))
-wince*: {
+!symbian: {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+}
+
+wince*|symbian: {
addFiles.sources = testdata
addFiles.path = .
DEPLOYMENT += addFiles
diff --git a/tests/auto/qcssparser/tst_qcssparser.cpp b/tests/auto/qcssparser/tst_qcssparser.cpp
index a294059..4ec6d51 100644
--- a/tests/auto/qcssparser/tst_qcssparser.cpp
+++ b/tests/auto/qcssparser/tst_qcssparser.cpp
@@ -98,7 +98,7 @@ void tst_QCssParser::scanner_data()
QTest::addColumn<QString>("input");
QTest::addColumn<QString>("output");
-#if !defined(Q_OS_IRIX) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_IRIX) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QDir d(SRCDIR);
#else
QDir d(QDir::current());
@@ -884,7 +884,7 @@ private:
QDomDocument doc;
};
-Q_DECLARE_METATYPE(QDomDocument);
+Q_DECLARE_METATYPE(QDomDocument)
void tst_QCssParser::marginValue_data()
{
diff --git a/tests/auto/qdatastream/qdatastream.pro b/tests/auto/qdatastream/qdatastream.pro
index 40231ea..5b90357 100644
--- a/tests/auto/qdatastream/qdatastream.pro
+++ b/tests/auto/qdatastream/qdatastream.pro
@@ -1,8 +1,10 @@
load(qttest_p4)
SOURCES += tst_qdatastream.cpp
+!symbian: {
cross_compile: DEFINES += SVGFILE=\\\"tests2.svg\\\"
else: DEFINES += SVGFILE=\\\"gearflowers.svg\\\"
+}
# for qpaintdevicemetrics.h
contains(QT_CONFIG, qt3support):QT += qt3support
@@ -14,7 +16,15 @@ wince*: {
addFiles.path = .
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\"\\\"
-} else {
+} else:symbian {
+ # SRCDIR and SVGFILE defined in code in symbian
+ addFiles.sources = datastream.q42 tests2.svg
+ addFiles.path = .
+ DEPLOYMENT += addFiles
+ TARGET.EPOCHEAPSIZE = 1000000 10000000
+ TARGET.UID3 = 0xE0340001
+ DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x",""))
+}else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qdatastream/tst_qdatastream.cpp b/tests/auto/qdatastream/tst_qdatastream.cpp
index 8971e01..eaae3ea 100644
--- a/tests/auto/qdatastream/tst_qdatastream.cpp
+++ b/tests/auto/qdatastream/tst_qdatastream.cpp
@@ -47,6 +47,13 @@
#endif
#include <QtSvg/QtSvg>
+#if defined(Q_OS_SYMBIAN)
+# define STRINGIFY(x) #x
+# define TOSTRING(x) STRINGIFY(x)
+# define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/"
+#define SVGFILE "tests2.svg"
+#endif
+
Q_DECLARE_METATYPE(QBitArray)
Q_DECLARE_METATYPE(qint64)
@@ -2056,7 +2063,7 @@ static QRegion qRegionData(int index)
case 4: return QRegion(100, -100, 2048, 4096, QRegion::Rectangle);
case 5: return QRegion(-100, 100, 4096, 2048, QRegion::Rectangle);
case 6: return QRegion(0, 0, 0, 0, QRegion::Ellipse);
-#if !defined(Q_OS_UNIX) && !defined(Q_OS_WINCE) // all our Unix platforms use X regions.
+#if defined(Q_OS_SYMBIAN) || (!defined(Q_OS_UNIX) && !defined(Q_OS_WINCE)) // all our Unix platforms use X regions.
case 7: return QRegion(1, 2, 300, 400, QRegion::Ellipse);
case 8: return QRegion(100, 100, 1024, 768, QRegion::Ellipse);
case 9: return QRegion(-100, -100, 1024, 1024, QRegion::Ellipse);
@@ -2707,7 +2714,7 @@ void tst_QDataStream::status_charptr_QByteArray_data()
QTest::addColumn<int>("expectedStatus");
QTest::addColumn<QByteArray>("expectedString");
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
#ifdef QT3_SUPPORT
QByteArray oneMbMinus1(1024 * 1024 - 1);
#else
@@ -2725,7 +2732,7 @@ void tst_QDataStream::status_charptr_QByteArray_data()
QTest::newRow("size 3") << QByteArray("\x00\x00\x00\x03jkl", 7) << (int) QDataStream::Ok << QByteArray("jkl");
QTest::newRow("size 4") << QByteArray("\x00\x00\x00\x04jklm", 8) << (int) QDataStream::Ok << QByteArray("jklm");
QTest::newRow("size 4j") << QByteArray("\x00\x00\x00\x04jklmj", 8) << (int) QDataStream::Ok << QByteArray("jklm");
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QTest::newRow("size 1MB-1") << QByteArray("\x00\x0f\xff\xff", 4) + oneMbMinus1 + QByteArray("j") << (int) QDataStream::Ok << oneMbMinus1;
QTest::newRow("size 1MB") << QByteArray("\x00\x10\x00\x00", 4) + oneMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << oneMbMinus1 + "j";
QTest::newRow("size 1MB+1") << QByteArray("\x00\x10\x00\x01", 4) + oneMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << oneMbMinus1 + "jk";
@@ -2745,7 +2752,7 @@ void tst_QDataStream::status_charptr_QByteArray_data()
QTest::newRow("badsize 2") << QByteArray("\x00\x00\x00\x02j", 5) << (int) QDataStream::ReadPastEnd << QByteArray();
QTest::newRow("badsize 3") << QByteArray("\x00\x00\x00\x03jk", 6) << (int) QDataStream::ReadPastEnd << QByteArray();
QTest::newRow("badsize 4") << QByteArray("\x00\x00\x00\x04jkl", 7) << (int) QDataStream::ReadPastEnd << QByteArray();
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QTest::newRow("badsize 1MB") << QByteArray("\x00\x10\x00\x00", 4) + oneMbMinus1 << (int) QDataStream::ReadPastEnd << QByteArray();
QTest::newRow("badsize 1MB+1") << QByteArray("\x00\x10\x00\x01", 4) + oneMbMinus1 + QByteArray("j") << (int) QDataStream::ReadPastEnd << QByteArray();
QTest::newRow("badsize 3MB") << QByteArray("\x00\x30\x00\x00", 4) + threeMbMinus1 << (int) QDataStream::ReadPastEnd << QByteArray();
@@ -2819,7 +2826,7 @@ void tst_QDataStream::status_QString_data()
QTest::addColumn<int>("expectedStatus");
QTest::addColumn<QString>("expectedString");
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QString oneMbMinus1;
oneMbMinus1.resize(1024 * 1024 - 1);
for (int i = 0; i < oneMbMinus1.size(); ++i)
@@ -2837,7 +2844,7 @@ void tst_QDataStream::status_QString_data()
QTest::newRow("size 3") << QByteArray("\x00\x00\x00\x06\x00j\x00k\x00l", 10) << (int) QDataStream::Ok << QString("jkl");
QTest::newRow("size 4") << QByteArray("\x00\x00\x00\x08\x00j\x00k\x00l\x00m", 12) << (int) QDataStream::Ok << QString("jklm");
QTest::newRow("size 4j") << QByteArray("\x00\x00\x00\x08\x00j\x00k\x00l\x00mjj", 14) << (int) QDataStream::Ok << QString("jklm");
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QTest::newRow("size 1MB-1") << QByteArray("\x00\x1f\xff\xfe", 4) + oneMbMinus1Data + QByteArray("jj") << (int) QDataStream::Ok << oneMbMinus1;
QTest::newRow("size 1MB") << QByteArray("\x00\x20\x00\x00", 4) + oneMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << oneMbMinus1 + "j";
QTest::newRow("size 1MB+1") << QByteArray("\x00\x20\x00\x02", 4) + oneMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << oneMbMinus1 + "jk";
@@ -2857,7 +2864,7 @@ void tst_QDataStream::status_QString_data()
QTest::newRow("badsize 2") << QByteArray("\x00\x00\x00\x04jj", 6) << (int) QDataStream::ReadPastEnd << QString();
QTest::newRow("badsize 3") << QByteArray("\x00\x00\x00\x06jjkk", 8) << (int) QDataStream::ReadPastEnd << QString();
QTest::newRow("badsize 4") << QByteArray("\x00\x00\x00\x08jjkkll", 10) << (int) QDataStream::ReadPastEnd << QString();
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QTest::newRow("badsize 1MB") << QByteArray("\x00\x20\x00\x00", 4) + oneMbMinus1Data << (int) QDataStream::ReadPastEnd << QString();
QTest::newRow("badsize 1MB+1") << QByteArray("\x00\x20\x00\x02", 4) + oneMbMinus1Data + QByteArray("j") << (int) QDataStream::ReadPastEnd << QString();
QTest::newRow("badsize 3MB") << QByteArray("\x00\x60\x00\x00", 4) + threeMbMinus1Data << (int) QDataStream::ReadPastEnd << QString();
@@ -3086,9 +3093,22 @@ void tst_QDataStream::streamToAndFromQByteArray()
void tst_QDataStream::streamRealDataTypes()
{
-#ifdef Q_OS_WINCE
+#if defined(Q_OS_WINCE)
+ // Note: Probably actually same 'qreal being typedeffed as float instead of double' issue as in Symbian
+ // instead of what CE skip message says.
QSKIP("Skipped on CE as it demands too much memory and fragments", SkipAll);
+#elif defined(Q_OS_SYMBIAN)
+ // qreal is typedeffed float in symbian instead of double like in most platforms, so reference stream
+ // gets corrupted. Basically this test is flawed, as one shouldn't use naked typedeffed types in
+ // streams that are meant to work cross-platform.
+ // As this test also tests other floating point using classes, we do not simply skip it, but work around
+ // the qreal issue by redefining qreal as double for the duration of this function.
+ // Note that streaming classes works because they do explicitly use double instead of qreal when
+ // writing/reading to/from stream.
+# define qreal double
+ qWarning("Note: streamRealDataTypes test redefines qreal as double in symbian!!!");
#endif
+
// Generate QPicture from SVG.
QSvgRenderer renderer(svgFile);
QVERIFY(renderer.isValid());
@@ -3206,6 +3226,9 @@ void tst_QDataStream::streamRealDataTypes()
QCOMPARE(cGrad, conicalBrush);
QCOMPARE(pen.widthF(), qreal(1.5));
}
+#if defined(Q_OS_SYMBIAN)
+ #undef qreal
+#endif
}
#ifdef QT3_SUPPORT
diff --git a/tests/auto/qdate/qdate.pro b/tests/auto/qdate/qdate.pro
index ea61c59..6e2781b3 100644
--- a/tests/auto/qdate/qdate.pro
+++ b/tests/auto/qdate/qdate.pro
@@ -1,7 +1,3 @@
load(qttest_p4)
SOURCES += tst_qdate.cpp
-
-
QT = core
-
-
diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp
index c46394b..cbd6ede 100644
--- a/tests/auto/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/qdatetime/tst_qdatetime.cpp
@@ -877,13 +877,13 @@ void tst_QDateTime::toTime_t_data()
QTest::addColumn<QString>("dateTimeStr");
QTest::addColumn<bool>("res");
- QTest::newRow( "data1" ) << str( 1800, 1, 1, 12, 0, 0 ) << FALSE;
- QTest::newRow( "data2" ) << str( 1969, 1, 1, 12, 0, 0 ) << FALSE;
- QTest::newRow( "data3" ) << str( 2002, 1, 1, 12, 0, 0 ) << TRUE;
- QTest::newRow( "data4" ) << str( 2002, 6, 1, 12, 0, 0 ) << TRUE;
- QTest::newRow( "data5" ) << QString("INVALID") << FALSE;
- QTest::newRow( "data6" ) << str( 2038, 1, 1, 12, 0, 0 ) << TRUE;
- QTest::newRow( "data7" ) << str( 2063, 4, 5, 12, 0, 0 ) << TRUE; // the day of First Contact
+ QTest::newRow( "data1" ) << str( 1800, 1, 1, 12, 0, 0 ) << false;
+ QTest::newRow( "data2" ) << str( 1969, 1, 1, 12, 0, 0 ) << false;
+ QTest::newRow( "data3" ) << str( 2002, 1, 1, 12, 0, 0 ) << true;
+ QTest::newRow( "data4" ) << str( 2002, 6, 1, 12, 0, 0 ) << true;
+ QTest::newRow( "data5" ) << QString("INVALID") << false;
+ QTest::newRow( "data6" ) << str( 2038, 1, 1, 12, 0, 0 ) << true;
+ QTest::newRow( "data7" ) << str( 2063, 4, 5, 12, 0, 0 ) << true; // the day of First Contact
QTest::newRow( "data8" ) << str( 2107, 1, 1, 12, 0, 0 )
<< bool( sizeof(uint) > 32 && sizeof(time_t) > 32 );
}
diff --git a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp
index a290568..3f2c63e 100644
--- a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -2213,21 +2213,16 @@ void tst_QDateTimeEdit::mousePress()
testWidget->setDate(QDate(2004, 6, 23));
testWidget->setCurrentSection(QDateTimeEdit::YearSection);
QCOMPARE(testWidget->currentSection(), QDateTimeEdit::YearSection);
- int offset = 10;
-#if defined(Q_OS_WINCE)
- offset = 20;
- if (qt_wince_is_pocket_pc()) {
- // depending on wether the display is double-pixeld, we need
- // to click at a different position
- bool doubledSize = false;
- int dpi = GetDeviceCaps(GetDC(0), LOGPIXELSX);
- if ((dpi < 1000) && (dpi > 0))
- doubledSize = true;
- offset = doubledSize ? 50 : 25; // On CE buttons are aligned horizontal
- }
-#endif
- QTest::mouseClick(testWidget, Qt::LeftButton, 0, QPoint(testWidget->width() - offset, 5));
+
+ // Ask the SC_SpinBoxUp button location from style
+ QStyleOptionSpinBox so;
+ so.rect = testWidget->rect();
+ QRect rectUp = testWidget->style()->subControlRect(QStyle::CC_SpinBox, &so, QStyle::SC_SpinBoxUp, testWidget);
+
+ // Send mouseClick to center of SC_SpinBoxUp
+ QTest::mouseClick(testWidget, Qt::LeftButton, 0, rectUp.center());
QCOMPARE(testWidget->date().year(), 2005);
+
}
void tst_QDateTimeEdit::stepHourAMPM_data()
diff --git a/tests/auto/qdebug/qdebug.pro b/tests/auto/qdebug/qdebug.pro
index 57aac48..6e75a09 100644
--- a/tests/auto/qdebug/qdebug.pro
+++ b/tests/auto/qdebug/qdebug.pro
@@ -1,7 +1,3 @@
load(qttest_p4)
SOURCES += tst_qdebug.cpp
-
QT = core
-
-
-
diff --git a/tests/auto/qdesktopservices/qdesktopservices.pro b/tests/auto/qdesktopservices/qdesktopservices.pro
index 05110bb..9ef557d 100644
--- a/tests/auto/qdesktopservices/qdesktopservices.pro
+++ b/tests/auto/qdesktopservices/qdesktopservices.pro
@@ -2,3 +2,28 @@ CONFIG += qttest_p4
SOURCES += tst_qdesktopservices.cpp
TARGET = tst_qdesktopservices
+symbian: {
+ dummy.sources = text\testfile.txt
+ dummy.path = .
+
+ text.sources = text\*
+ text.path = \data\others\
+
+ image.sources = image\*
+ image.path = \data\images\
+
+ audio.sources = audio\*
+ audio.path = \data\sounds\
+
+ video.sources = video\*
+ video.path = \data\videos\
+
+ install.sources = install\*
+ install.path = \data\installs\
+
+ DEPLOYMENT += image audio video install
+
+ # These are only needed for manual tests
+ #DEPLOYMENT += dummy text
+ }
+
diff --git a/tests/auto/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/qdesktopservices/tst_qdesktopservices.cpp
index 0d65102..2d5a28c 100644
--- a/tests/auto/qdesktopservices/tst_qdesktopservices.cpp
+++ b/tests/auto/qdesktopservices/tst_qdesktopservices.cpp
@@ -45,6 +45,7 @@
#include <qdebug.h>
#include <qdesktopservices.h>
+//#define RUN_MANUAL_TESTS
//TESTED_CLASS=
//TESTED_FILES=
@@ -59,6 +60,17 @@ private slots:
void init();
void cleanup();
void openUrl();
+#ifdef Q_OS_SYMBIAN
+ // These test are manual ones, you need to check from device that
+ // correct system application is started with correct content
+ // When you want to run these test, uncomment //#define RUN_MANUAL_TESTS
+ void openHttpUrl_data();
+ void openHttpUrl();
+ void openMailtoUrl_data();
+ void openMailtoUrl();
+ void openFileUrl_data();
+ void openFileUrl();
+#endif
void handlers();
void storageLocation_data();
void storageLocation();
@@ -92,11 +104,146 @@ void tst_qdesktopservices::openUrl()
// At the bare minimum check that they return false for invalid url's
QCOMPARE(QDesktopServices::openUrl(QUrl()), false);
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- // this test is only valid on windows on other systems it might mean open a new document in the application handling .file
+ // this test is only valid on windows on other systems it might mean open a new document in the application handling .file
QCOMPARE(QDesktopServices::openUrl(QUrl("file://invalid.file")), false);
#endif
}
+#ifdef Q_OS_SYMBIAN
+void tst_qdesktopservices::openHttpUrl_data()
+{
+ QTest::addColumn<QUrl>("url");
+ QTest::addColumn<bool>("result");
+ QTest::newRow("BasicWithHttp") << QUrl("http://www.google.fi") << true;
+ QTest::newRow("BasicWithoutHttp") << QUrl("www.nokia.fi") << true;
+ QTest::newRow("BasicWithUserAndPw") << QUrl("http://s60prereleases:oslofjord@pepper.troll.no/s60prereleases/patches/") << true;
+ QTest::newRow("URL with space") << QUrl("http://www.manataka.org/Contents Page.html") << true;
+
+}
+
+void tst_qdesktopservices::openHttpUrl()
+{
+#ifndef RUN_MANUAL_TESTS
+ QSKIP("Test disabled -- only for manual purposes", SkipAll);
+#endif
+
+ QFETCH(QUrl, url);
+ QFETCH(bool, result);
+ QCOMPARE(QDesktopServices::openUrl(url), result);
+ QTest::qWait(30000);
+}
+
+void tst_qdesktopservices::openMailtoUrl_data()
+{
+ QTest::addColumn<QUrl>("url");
+ QTest::addColumn<bool>("result");
+
+ // http://en.wikipedia.org/wiki/E-mail_address
+ // RFC Valid e-mail addresses
+ QTest::newRow("Wiki valid email 1") << QUrl("mailto:abc@example.com") << true;
+ QTest::newRow("Wiki valid email 2") << QUrl("mailto:Abc@example.com") << true;
+ QTest::newRow("Wiki valid email 3") << QUrl("mailto:aBC@example.com") << true;
+ QTest::newRow("Wiki valid email 4") << QUrl("mailto:abc.123@example.com") << true;
+ QTest::newRow("Wiki valid email 5") << QUrl("mailto:1234567890@example.com") << true;
+ QTest::newRow("Wiki valid email 6") << QUrl("mailto:_______@example.com") << true;
+ QTest::newRow("Wiki valid email 7") << QUrl("mailto:abc+mailbox/department=shipping@example.com") << true;
+ // S60 email client considers the next URL invalid, even ity should be valid
+ QTest::newRow("Wiki valid email 8") << QUrl("mailto:!#$%&'*+-/=?^_`.{|}~@example.com") << true; // all of these characters are allowed
+ QTest::newRow("Wiki valid email 9") << QUrl("mailto:\"abc@def\"@example.com") << true; // anything goes inside quotation marks
+ QTest::newRow("Wiki valid email 10") << QUrl("mailto:\"Fred \\\"quota\\\" Bloggs\"@example.com") << true; // however, quotes need escaping
+
+ // RFC invalid e-mail addresses
+ // These return true even though they are invalid, but check that user is notified about invalid URL in mail application
+ QTest::newRow("Wiki invalid email 1") << QUrl("mailto:Abc.example.com") << true; // character @ is missing
+ QTest::newRow("Wiki invalid email 2") << QUrl("mailto:Abc.@example.com") << true; // character dot(.) is last in local part
+ QTest::newRow("Wiki invalid email 3") << QUrl("mailto:Abc..123@example.com") << true; // character dot(.) is double
+ QTest::newRow("Wiki invalid email 4") << QUrl("mailto:A@b@c@example.com") << true; // only one @ is allowed outside quotations marks
+ QTest::newRow("Wiki invalid email 5") << QUrl("mailto:()[]\\;:,<>@example.com") << true; // none of the characters before the @ is allowed outside quotation marks
+
+ QTest::newRow("Basic") << QUrl("mailto:test@nokia.com") << true;
+ QTest::newRow("BasicSeveralAddr") << QUrl("mailto:test@nokia.com,test2@nokia.com,test3@nokia.com") << true;
+ QTest::newRow("BasicAndSubject") << QUrl("mailto:test@nokia.com?subject=hello nokia") << true;
+ QTest::newRow("BasicAndTo") << QUrl("mailto:test@nokia.com?to=test2@nokia.com") << true;
+
+ QTest::newRow("BasicAndCc") << QUrl("mailto:test@nokia.com?cc=mycc@address.com") << true;
+ QTest::newRow("BasicAndBcc") << QUrl("mailto:test@nokia.com?bcc=mybcc@address.com") << true;
+ QTest::newRow("BasicAndBody") << QUrl("mailto:test@nokia.com?body=Test email message body") << true;
+
+ // RFC examples, these are actually invalid because there is not host defined
+ // Check that user is notified about invalid URL in mail application
+ QTest::newRow("RFC2368 Example 1") << QUrl::fromEncoded("mailto:addr1%2C%20addr2") << true;
+ QTest::newRow("RFC2368 Example 2") << QUrl::fromEncoded("mailto:?to=addr1%2C%20addr2") << true;
+ QTest::newRow("RFC2368 Example 3") << QUrl("mailto:addr1?to=addr2") << true;
+
+ QTest::newRow("RFC2368 Example 4") << QUrl("mailto:joe@example.com?cc=bob@example.com&body=hello") << true;
+ QTest::newRow("RFC2368 Example 5") << QUrl("mailto:?to=joe@example.com&cc=bob@example.com&body=hello") << true;
+ QTest::newRow("RFC2368 Example 6") << QUrl("mailto:foobar@example.com?In-Reply-To=%3c3469A91.D10AF4C@example.com") << true; // OpaqueData
+ QTest::newRow("RFC2368 Example 7") << QUrl::fromEncoded("mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index") << true;
+ QTest::newRow("RFC2368 Example 8") << QUrl::fromEncoded("mailto:infobot@example.com?body=send%20current-issue") << true;
+ QTest::newRow("RFC2368 Example 9") << QUrl("mailto:infobot@example.com?subject=current-issue") << true;
+ QTest::newRow("RFC2368 Example 10") << QUrl("mailto:chris@example.com") << true;
+
+ //QTest::newRow("RFC2368 Example 11 - illegal chars") << QUrl("mailto:joe@example.com?cc=bob@example.com?body=hello") << false;
+ QTest::newRow("RFC2368 Example 12") << QUrl::fromEncoded("mailto:gorby%25kremvax@example.com") << true; // encoded reserved chars '%'
+ QTest::newRow("RFC2368 Example 13") << QUrl::fromEncoded("mailto:unlikely%3Faddress@example.com?blat=foop") << true; // encoded reserved chars `?'
+}
+
+void tst_qdesktopservices::openMailtoUrl()
+{
+#ifndef RUN_MANUAL_TESTS
+ QSKIP("Test disabled -- only for manual purposes", SkipAll);
+#endif
+
+ QFETCH(QUrl, url);
+ QFETCH(bool, result);
+ QCOMPARE(QDesktopServices::openUrl(url), result);
+}
+
+void tst_qdesktopservices::openFileUrl_data()
+{
+ QTest::addColumn<QUrl>("url");
+ QTest::addColumn<bool>("result");
+
+ // Text files
+ QTest::newRow("DOS text file") << QUrl("file:///c:/data/others/dosfile.txt") << true;
+ QTest::newRow("No EOF text file") << QUrl("file:///c:/data/others/noendofline.txt") << true;
+ QTest::newRow("text file") << QUrl("file:///c:/data/others/testfile.txt") << true;
+ QTest::newRow("text file with space") << QUrl("file:///c:/data/others/test file.txt") << true;
+
+ // Images
+ QTest::newRow("BMP image") << QUrl("file:///c:/data/images/image.bmp") << true;
+ QTest::newRow("GIF image") << QUrl("file:///c:/data/images/image.gif") << true;
+ QTest::newRow("JPG image") << QUrl("file:///c:/data/images/image.jpg") << true;
+ QTest::newRow("PNG image") << QUrl("file:///c:/data/images/image.png") << true;
+
+ // Audio
+ QTest::newRow("MP4 audio") << QUrl("file:///c:/data/sounds/aac-only.mp4") << true;
+ QTest::newRow("3GP audio") << QUrl("file:///c:/data/sounds/audio_3gpp.3gp") << true;
+
+ // Video
+ QTest::newRow("MP4 video") << QUrl("file:///c:/data/videos/vid-mpeg4-22k.mp4") << true;
+
+ // Installs
+ QTest::newRow("SISX") << QUrl("file:///c:/data/installs/ErrRd.sisx") << true;
+
+ // Errors
+ QTest::newRow("File does not exist") << QUrl("file:///c:/thisfileneverexists.txt") << false;
+}
+
+void tst_qdesktopservices::openFileUrl()
+{
+#ifndef RUN_MANUAL_TESTS
+ QSKIP("Test disabled -- only for manual purposes", SkipAll);
+#endif
+
+ QFETCH(QUrl, url);
+ QFETCH(bool, result);
+ QCOMPARE(QDesktopServices::openUrl(url), result);
+ QTest::qWait(15000);
+}
+#endif
+
+
class MyUrlHandler : public QObject
{
Q_OBJECT
@@ -146,8 +293,64 @@ void tst_qdesktopservices::storageLocation_data()
void tst_qdesktopservices::storageLocation()
{
QFETCH(QDesktopServices::StandardLocation, location);
+#ifdef Q_OS_SYMBIAN
+ QString storageLocation = QDesktopServices::storageLocation(location);
+ QString displayName = QDesktopServices::displayName(location);
+ //qDebug( "displayName: %s", displayName );
+
+ storageLocation = storageLocation.toLower();
+ displayName = displayName.toLower();
+
+ QString drive = QDir::currentPath().left(2).toLower();
+ if( drive == "z:" )
+ drive = "c:";
+
+ switch(location) {
+ case QDesktopServices::DesktopLocation:
+ QCOMPARE( storageLocation, drive + QString("/data") );
+ break;
+ case QDesktopServices::DocumentsLocation:
+ QCOMPARE( storageLocation, drive + QString("/data") );
+ break;
+ case QDesktopServices::FontsLocation:
+ // Currently point always to ROM
+ QCOMPARE( storageLocation, QString("z:/resource/fonts") );
+ break;
+ case QDesktopServices::ApplicationsLocation:
+#ifdef Q_CC_NOKIAX86
+ QCOMPARE( storageLocation, QString("z:/sys/bin") );
+#else
+ QCOMPARE( storageLocation, drive + QString("/sys/bin") );
+#endif
+ break;
+ case QDesktopServices::MusicLocation:
+ QCOMPARE( storageLocation, drive + QString("/data/sounds") );
+ break;
+ case QDesktopServices::MoviesLocation:
+ QCOMPARE( storageLocation, drive + QString("/data/videos") );
+ break;
+ case QDesktopServices::PicturesLocation:
+ QCOMPARE( storageLocation, drive + QString("/data/images") );
+ break;
+ case QDesktopServices::TempLocation:
+ QCOMPARE( storageLocation, QDir::tempPath().toLower());
+ break;
+ case QDesktopServices::HomeLocation:
+ QCOMPARE( storageLocation, QDir::homePath().toLower());
+ break;
+ case QDesktopServices::DataLocation:
+ // Just check the folder not the drive
+ QCOMPARE( storageLocation.mid(2), QDir::currentPath().mid(2).toLower());
+ break;
+ default:
+ QCOMPARE( storageLocation, QString() );
+ break;
+ }
+
+#else
QDesktopServices::storageLocation(location);
QDesktopServices::displayName(location);
+#endif
}
diff --git a/tests/auto/qdir/qdir.pro b/tests/auto/qdir/qdir.pro
index 404a137..0111672 100644
--- a/tests/auto/qdir/qdir.pro
+++ b/tests/auto/qdir/qdir.pro
@@ -8,6 +8,16 @@ wince*:{
QT = core
DEFINES += SRCDIR=\\\"\\\"
+} symbian:{
+ DirFiles.sources = testdir testdata searchdir resources entrylist types tst_qdir.cpp
+ DirFiles.path = .
+ DEPLOYMENT += DirFiles
+
+ QT = core
+ TARGET.CAPABILITY += AllFiles
+
+ TARGET.UID3 = 0xE0340002
+ DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x",""))
} else {
QT = core
contains(QT_CONFIG, qt3support):QT += qt3support
diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp
index a07f548..13e8c95 100644
--- a/tests/auto/qdir/tst_qdir.cpp
+++ b/tests/auto/qdir/tst_qdir.cpp
@@ -48,13 +48,24 @@
#include <qfileinfo.h>
#include <qregexp.h>
#include <qstringlist.h>
-
#include "../network-settings.h"
+#if defined(Q_OS_SYMBIAN)
+# define STRINGIFY(x) #x
+# define TOSTRING(x) STRINGIFY(x)
+# define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/"
+#endif
+
#if defined(Q_OS_VXWORKS)
#define Q_NO_SYMLINKS
#endif
+#if defined(Q_OS_SYMBIAN)
+// Open C in Symbian doesn't support symbolic links to directories
+#define Q_NO_SYMLINKS_TO_DIRS
+#endif
+
+
//TESTED_CLASS=
//TESTED_FILES=
@@ -178,11 +189,20 @@ void tst_QDir::getSetCheck()
tst_QDir::tst_QDir()
{
+#ifdef Q_OS_SYMBIAN
+ // Can't deploy empty test dir, so create it here
+ QDir dir(SRCDIR);
+ dir.mkdir("testData");
+#endif
}
tst_QDir::~tst_QDir()
{
-
+#ifdef Q_OS_SYMBIAN
+ // Remove created test dir
+ QDir dir(SRCDIR);
+ dir.rmdir("testData");
+#endif
}
void tst_QDir::construction()
@@ -198,7 +218,7 @@ void tst_QDir::setPath_data()
QTest::addColumn<QString>("dir2");
QTest::newRow("data0") << QString(".") << QString("..");
-#if defined(Q_WS_WIN) && !defined(Q_OS_WINCE)
+#if (defined(Q_WS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
QTest::newRow("data1") << QString("c:/") << QDir::currentPath();
#endif
}
@@ -295,7 +315,7 @@ void tst_QDir::exists_data()
QTest::newRow("simple dir") << SRCDIR "resources" << true;
QTest::newRow("simple dir with slash") << SRCDIR "resources/" << true;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
QTest::newRow("unc 1") << "//" + QtNetworkSettings::winServerName() << true;
QTest::newRow("unc 2") << "//" + QtNetworkSettings::winServerName() + "/" << true;
QTest::newRow("unc 3") << "//" + QtNetworkSettings::winServerName() + "/testshare" << true;
@@ -305,7 +325,8 @@ void tst_QDir::exists_data()
QTest::newRow("unc 7") << "//" + QtNetworkSettings::winServerName() + "/testshare/adirthatshouldnotexist" << false;
QTest::newRow("unc 8") << "//" + QtNetworkSettings::winServerName() + "/asharethatshouldnotexist" << false;
QTest::newRow("unc 9") << "//ahostthatshouldnotexist" << false;
-
+#endif
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
QTest::newRow("This drive should exist") << "C:/" << true;
// find a non-existing drive and check if it does not exist
QFileInfoList drives = QFSFileEngine::drives();
@@ -341,7 +362,7 @@ void tst_QDir::isRelativePath_data()
QTest::addColumn<bool>("relative");
QTest::newRow("data0") << "../somedir" << true;
-#if defined(Q_WS_WIN) && !defined(Q_OS_WINCE)
+#if (defined(Q_WS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
QTest::newRow("data1") << "C:/sOmedir" << false;
#endif
QTest::newRow("data2") << "somedir" << true;
@@ -394,20 +415,20 @@ void tst_QDir::entryList_data()
QTest::addColumn<int>("sortspec");
QTest::addColumn<QStringList>("expected");
QTest::newRow("spaces1") << SRCDIR "testdir/spaces" << QStringList("*. bar")
- << (int)(QDir::NoFilter) << (int)(QDir::NoSort)
- << QStringList("foo. bar"); // notice how spaces5 works
+ << (int)(QDir::NoFilter) << (int)(QDir::NoSort)
+ << QStringList("foo. bar"); // notice how spaces5 works
QTest::newRow("spaces2") << SRCDIR "testdir/spaces" << QStringList("*.bar")
- << (int)(QDir::NoFilter) << (int)(QDir::NoSort)
- << QStringList("foo.bar");
+ << (int)(QDir::NoFilter) << (int)(QDir::NoSort)
+ << QStringList("foo.bar");
QTest::newRow("spaces3") << SRCDIR "testdir/spaces" << QStringList("foo.*")
- << (int)(QDir::NoFilter) << (int)(QDir::NoSort)
- << QString("foo. bar,foo.bar").split(',');
+ << (int)(QDir::NoFilter) << (int)(QDir::NoSort)
+ << QString("foo. bar,foo.bar").split(',');
QTest::newRow("files1") << SRCDIR "testdir/dir" << QString("*r.cpp *.pro").split(" ")
- << (int)(QDir::NoFilter) << (int)(QDir::NoSort)
- << QString("qdir.pro,qrc_qdir.cpp,tst_qdir.cpp").split(',');
+ << (int)(QDir::NoFilter) << (int)(QDir::NoSort)
+ << QString("qdir.pro,qrc_qdir.cpp,tst_qdir.cpp").split(',');
QTest::newRow("testdir1") << SRCDIR "testdir" << QStringList()
- << (int)(QDir::AllDirs) << (int)(QDir::NoSort)
- << QString(".,..,dir,spaces").split(',');
+ << (int)(QDir::AllDirs) << (int)(QDir::NoSort)
+ << QString(".,..,dir,spaces").split(',');
// #### this test uses filenames that cannot be represented on all filesystems we test, in
// particular HFS+ on the Mac. When checking out the files with perforce it silently ignores the
// error that it cannot represent the file names stored in the repository and the test fails. That
@@ -416,8 +437,8 @@ void tst_QDir::entryList_data()
// ignored but git reports an error. The test only tried to prevent QDir from _hanging_ when listing
// the directory.
// QTest::newRow("unprintablenames") << SRCDIR "unprintablenames" << QStringList("*")
-// << (int)(QDir::NoFilter) << (int)(QDir::NoSort)
-// << QString(".,..").split(",");
+// << (int)(QDir::NoFilter) << (int)(QDir::NoSort)
+// << QString(".,..").split(",");
QTest::newRow("resources1") << QString(":/tst_qdir/resources/entryList") << QStringList("*.data")
<< (int)(QDir::NoFilter) << (int)(QDir::NoSort)
<< QString("file1.data,file2.data,file3.data").split(',');
@@ -553,17 +574,61 @@ void tst_QDir::entryList()
QFile::remove(SRCDIR "entrylist/brokenlink.lnk");
QFile::remove(SRCDIR "entrylist/brokenlink");
- // WinCE does not have . and .. in the directory listing
-#ifdef Q_OS_WINCE
- expected.removeAll(".");
- expected.removeAll("..");
+ // WinCE/Symbian does not have . and .. in the directory listing
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+ expected.removeAll(".");
+ expected.removeAll("..");
#endif
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN)
// ### Sadly, this is a platform difference right now.
QFile::link(SRCDIR "entryList/file", SRCDIR "entrylist/linktofile.lnk");
QFile::link(SRCDIR "entryList/directory", SRCDIR "entrylist/linktodirectory.lnk");
QFile::link(SRCDIR "entryList/nothing", SRCDIR "entrylist/brokenlink.lnk");
+#elif defined(Q_OS_SYMBIAN)
+ // Symbian doesn't support links to directories
+ expected.removeAll("linktodirectory.lnk");
+
+ // Expecting failures from a couple of OpenC bugs. Do checks only once.
+ static int xFailChecked = false;
+ static int expectedFail1 = false;
+ static int expectedFail2 = false;
+
+ if (!expectedFail1) {
+ // Can't create link if file doesn't exist in symbian, so create file temporarily,
+ // But only if testing for
+ QFile tempFile(SRCDIR "entryList/nothing");
+ tempFile.open(QIODevice::WriteOnly);
+ tempFile.link(SRCDIR "entryList/brokenlink.lnk");
+ tempFile.remove();
+ }
+
+ if (!expectedFail2) {
+ QFile::link(SRCDIR "entryList/file", SRCDIR "entrylist/linktofile.lnk");
+ }
+
+ if (!xFailChecked) {
+ // ### Until OpenC supports stat correctly for symbolic links, expect them to fail.
+ expectedFail1 = QFileInfo(SRCDIR "entryList/brokenlink.lnk").exists();
+ expectedFail2 = !(QFileInfo(SRCDIR "entryList/linktofile.lnk").isFile());
+
+ QEXPECT_FAIL("", "OpenC bug, stat for broken links returns normally, when it should return error.", Continue);
+ QVERIFY(!expectedFail1);
+
+ QEXPECT_FAIL("", "OpenC bug, stat for file links doesn't indicate them as such.", Continue);
+ QVERIFY(!expectedFail2);
+ xFailChecked = true;
+ }
+
+ if (expectedFail1) {
+ expected.removeAll("brokenlink.lnk");
+ QFile::remove(SRCDIR "entrylist/brokenlink.lnk");
+ }
+
+ if (expectedFail2) {
+ expected.removeAll("linktofile.lnk");
+ QFile::remove(SRCDIR "entrylist/linktofile.lnk");
+ }
#else
QFile::link("file", SRCDIR "entrylist/linktofile.lnk");
QFile::link("directory", SRCDIR "entrylist/linktodirectory.lnk");
@@ -587,9 +652,8 @@ void tst_QDir::entryList()
// lock up. The actual result depends on the file system.
return;
}
-
bool doContentCheck = true;
-#ifdef Q_OS_UNIX
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
if (qstrcmp(QTest::currentDataTag(), "QDir::AllEntries | QDir::Writable") == 0) {
// for root, everything is writeable
if (::getuid() == 0)
@@ -604,6 +668,11 @@ void tst_QDir::entryList()
QCOMPARE(actual.count(), expected.count());
}
+#if defined(Q_OS_SYMBIAN)
+ // Test cleanup on device requires setting the permissions back to normal
+ QFile(SRCDIR "entrylist/file").setPermissions(QFile::WriteUser | QFile::ReadUser);
+#endif
+
QFile::remove(SRCDIR "entrylist/writable");
QFile::remove(SRCDIR "entrylist/linktofile");
QFile::remove(SRCDIR "entrylist/linktodirectory");
@@ -619,7 +688,7 @@ void tst_QDir::entryListSimple_data()
QTest::addColumn<int>("countMin");
QTest::newRow("data2") << "do_not_expect_this_path_to_exist/" << 0;
-#if defined(Q_OS_WINCE)
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QTest::newRow("simple dir") << SRCDIR "resources" << 0;
QTest::newRow("simple dir with slash") << SRCDIR "resources/" << 0;
#else
@@ -653,25 +722,36 @@ void tst_QDir::entryListSimple()
void tst_QDir::entryListWithSymLinks()
{
#ifndef Q_NO_SYMLINKS
+# ifndef Q_NO_SYMLINKS_TO_DIRS
QFile::remove("myLinkToDir.lnk");
+# endif
QFile::remove("myLinkToFile.lnk");
QFile::remove("testfile.cpp");
QDir dir;
dir.mkdir("myDir");
QFile("testfile.cpp").open(QIODevice::WriteOnly);
+# ifndef Q_NO_SYMLINKS_TO_DIRS
QVERIFY(QFile::link("myDir", "myLinkToDir.lnk"));
+# endif
QVERIFY(QFile::link("testfile.cpp", "myLinkToFile.lnk"));
{
QStringList entryList = QDir().entryList();
QVERIFY(entryList.contains("myDir"));
+# ifndef Q_NO_SYMLINKS_TO_DIRS
QVERIFY(entryList.contains("myLinkToDir.lnk"));
+#endif
QVERIFY(entryList.contains("myLinkToFile.lnk"));
}
{
QStringList entryList = QDir().entryList(QDir::Dirs);
QVERIFY(entryList.contains("myDir"));
+# ifndef Q_NO_SYMLINKS_TO_DIRS
QVERIFY(entryList.contains("myLinkToDir.lnk"));
+#endif
+#if defined(Q_OS_SYMBIAN)
+ QEXPECT_FAIL("", "OpenC stat for symlinks is buggy.", Continue);
+#endif
QVERIFY(!entryList.contains("myLinkToFile.lnk"));
}
{
@@ -706,7 +786,7 @@ void tst_QDir::canonicalPath_data()
}
#endif
- QTest::newRow("relative") << "." << appPath;
+ QTest::newRow("relative") << "." << appPath;
QTest::newRow("relativeSubDir") << "./testData/../testData" << appPath + "/testData";
#ifndef Q_WS_WIN
@@ -734,7 +814,7 @@ void tst_QDir::canonicalPath()
QFETCH(QString, canonicalPath);
QDir dir(path);
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
QCOMPARE(dir.canonicalPath().toLower(), canonicalPath.toLower());
#else
QCOMPARE(dir.canonicalPath(), canonicalPath);
@@ -753,10 +833,10 @@ void tst_QDir::current_data()
else
appPath.chop(1); // remove the ending slash
#if defined Q_WS_WIN
- if (appPath.endsWith("release", Qt::CaseInsensitive))
- appPath = appPath.left(appPath.length()-8);
+ if (appPath.endsWith("release", Qt::CaseInsensitive))
+ appPath = appPath.left(appPath.length()-8);
else if (appPath.endsWith("debug", Qt::CaseInsensitive))
- appPath = appPath.left(appPath.length()-6);
+ appPath = appPath.left(appPath.length()-6);
#endif
QTest::newRow("startup") << QString() << appPath;
@@ -789,10 +869,10 @@ void tst_QDir::current()
if (!currentDir.isEmpty()) {
QDir newCurrent = QDir::current();
QDir::setCurrent(oldDir);
-#ifdef Q_OS_WIN
- QCOMPARE(newCurrent.absolutePath().toLower(), currentDir.toLower());
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ QCOMPARE(newCurrent.absolutePath().toLower(), currentDir.toLower());
#else
- QCOMPARE(newCurrent.absolutePath(), currentDir);
+ QCOMPARE(newCurrent.absolutePath(), currentDir);
#endif
}
@@ -807,10 +887,10 @@ void tst_QDir::cd_data()
QTest::addColumn<QString>("newDir");
QString appPath = QDir::currentPath();
- int index = appPath.lastIndexOf("/");
- QTest::newRow("cdUp") << QDir::currentPath() << ".." << true << appPath.left(index==0?1:index);
+ int index = appPath.lastIndexOf("/");
+ QTest::newRow("cdUp") << QDir::currentPath() << ".." << true << appPath.left(index==0?1:index);
QTest::newRow("noChange") << QDir::currentPath() << "." << true << appPath;
-#ifdef Q_OS_WIN // on windows QDir::root() is usually c:/ but cd "/" will not force it to be root
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) // on windows QDir::root() is usually c:/ but cd "/" will not force it to be root
QTest::newRow("absolute") << QDir::currentPath() << "/" << true << "/";
#else
QTest::newRow("absolute") << QDir::currentPath() << "/" << true << QDir::root().absolutePath();
@@ -850,11 +930,11 @@ void tst_QDir::setNameFilters_data()
QTest::newRow("spaces1") << appPath + "testdir/spaces" << QStringList("*. bar")
<< QStringList("foo. bar");
QTest::newRow("spaces2") << appPath + "testdir/spaces" << QStringList("*.bar")
- << QStringList("foo.bar");
+ << QStringList("foo.bar");
QTest::newRow("spaces3") << appPath + "testdir/spaces" << QStringList("foo.*")
- << QString("foo. bar,foo.bar").split(",");
+ << QString("foo. bar,foo.bar").split(",");
QTest::newRow("files1") << appPath + "testdir/dir" << QString("*r.cpp *.pro").split(" ")
- << QString("qdir.pro,qrc_qdir.cpp,tst_qdir.cpp").split(",");
+ << QString("qdir.pro,qrc_qdir.cpp,tst_qdir.cpp").split(",");
QTest::newRow("resources1") << QString(":/tst_qdir/resources/entryList") << QStringList("*.data")
<< QString("file1.data,file2.data,file3.data").split(',');
}
@@ -889,7 +969,7 @@ tst_QDir::cleanPath_data()
QTest::newRow("data3") << QDir::cleanPath("../.") << "..";
QTest::newRow("data4") << QDir::cleanPath("../..") << "../..";
#if !defined(Q_OS_WINCE)
-#if defined Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
QTest::newRow("data5") << "d:\\a\\bc\\def\\.." << "d:/a/bc";
QTest::newRow("data6") << "d:\\a\\bc\\def\\../../.." << "d:/";
#else
@@ -942,10 +1022,12 @@ void tst_QDir::absolutePath_data()
QTest::addColumn<QString>("expectedPath");
QTest::newRow("0") << "/machine/share/dir1" << "/machine/share/dir1";
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
QTest::newRow("1") << "\\machine\\share\\dir1" << "/machine/share/dir1";
+# if !defined(Q_OS_SYMBIAN)
QTest::newRow("2") << "//machine/share/dir1" << "//machine/share/dir1";
QTest::newRow("3") << "\\\\machine\\share\\dir1" << "//machine/share/dir1";
+# endif
QTest::newRow("4") << "c:/machine/share/dir1" << "c:/machine/share/dir1";
QTest::newRow("5") << "c:\\machine\\share\\dir1" << "c:/machine/share/dir1";
#endif
@@ -982,7 +1064,7 @@ void tst_QDir::relativeFilePath_data()
QTest::newRow("11") << "" << "" << "";
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
QTest::newRow("12") << "C:/foo/bar" << "ding" << "ding";
QTest::newRow("13") << "C:/foo/bar" << "C:/ding/dong" << "../../ding/dong";
QTest::newRow("14") << "C:/foo/bar" << "/ding/dong" << "../../ding/dong";
@@ -1001,10 +1083,12 @@ void tst_QDir::relativeFilePath_data()
QTest::newRow("22") << "C:" << "D:/" << "D:/";
QTest::newRow("23") << "C:/" << "D:" << "D:";
QTest::newRow("24") << "C:/" << "D:/" << "D:/";
+# if !defined(Q_OS_SYMBIAN)
QTest::newRow("25") << "C:/foo/bar" << "//anotherHost/foo/bar" << "//anotherHost/foo/bar";
QTest::newRow("26") << "//anotherHost/foo" << "//anotherHost/foo/bar" << "bar";
QTest::newRow("27") << "//anotherHost/foo" << "bar" << "bar";
QTest::newRow("28") << "//anotherHost/foo" << "C:/foo/bar" << "C:/foo/bar";
+# endif
#endif
}
@@ -1061,7 +1145,8 @@ void tst_QDir::rename()
QVERIFY(dir.rename("rename-test-renamed", "rename-test"));
#if defined(Q_OS_MAC)
QVERIFY(!dir.rename("rename-test", "/etc/rename-test-renamed"));
-#elif !defined(Q_OS_WIN) // on windows this is possible maybe make the test a bit better
+#elif !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN)
+ // on windows/symbian this is possible - maybe make the test a bit better
QVERIFY(!dir.rename("rename-test", "/rename-test-renamed"));
#endif
QVERIFY(dir.remove("rename-test"));
@@ -1110,7 +1195,7 @@ void tst_QDir::dirName_data()
QTest::newRow("slash0") << "c:/winnt/system32" << "system32";
QTest::newRow("slash1") << "/winnt/system32" << "system32";
QTest::newRow("slash2") << "c:/winnt/system32/kernel32.dll" << "kernel32.dll";
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
QTest::newRow("bslash0") << "c:\\winnt\\system32" << "system32";
QTest::newRow("bslash1") << "\\winnt\\system32" << "system32";
QTest::newRow("bslash2") << "c:\\winnt\\system32\\kernel32.dll" << "kernel32.dll";
@@ -1135,8 +1220,8 @@ void tst_QDir::operator_eq()
void tst_QDir::dotAndDotDot()
{
-#ifdef Q_OS_WINCE
- QSKIP("WinCE does not have . nor ..", SkipAll);
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+ QSKIP("WinCE and Symbian do not have . nor ..", SkipAll);
#endif
QDir dir(QString(SRCDIR "testdir/"));
QStringList entryList = dir.entryList(QDir::Dirs);
@@ -1177,7 +1262,7 @@ void tst_QDir::homePath()
#ifdef Q_OS_UNIX
if (strHome.length() > 1) // root dir = "/"
QVERIFY(!strHome.endsWith('/'));
-#elif defined(Q_OS_WIN)
+#elif defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
if (strHome.length() > 3) // root dir = "c:/"; "//" is not really valid...
QVERIFY(!strHome.endsWith('/'));
#endif
@@ -1201,7 +1286,7 @@ void tst_QDir::tempPath()
#ifdef Q_OS_UNIX
if (path.length() > 1) // root dir = "/"
QVERIFY(!path.endsWith('/'));
-#elif defined(Q_OS_WIN)
+#elif defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
if (path.length() > 3) // root dir = "c:/"; "//" is not really valid...
QVERIFY(!path.endsWith('/'));
#endif
@@ -1216,14 +1301,14 @@ void tst_QDir::rootPath()
QCOMPARE(path, dir.absolutePath());
QVERIFY(QDir::isAbsolutePath(path));
-#ifdef Q_OS_UNIX
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
QCOMPARE(path, QString("/"));
#endif
}
void tst_QDir::nativeSeparators()
{
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
QCOMPARE(QDir::toNativeSeparators(QLatin1String("/")), QString("\\"));
QCOMPARE(QDir::toNativeSeparators(QLatin1String("\\")), QString("\\"));
QCOMPARE(QDir::fromNativeSeparators(QLatin1String("/")), QString("/"));
diff --git a/tests/auto/qdiriterator/qdiriterator.pro b/tests/auto/qdiriterator/qdiriterator.pro
index 2db6617..ece886c 100644
--- a/tests/auto/qdiriterator/qdiriterator.pro
+++ b/tests/auto/qdiriterator/qdiriterator.pro
@@ -3,7 +3,7 @@ SOURCES += tst_qdiriterator.cpp
RESOURCES += qdiriterator.qrc
QT = core
-wince*: {
+wince*|symbian*: {
addFiles.sources = entrylist recursiveDirs foo
addFiles.path = .
DEPLOYMENT += addFiles
diff --git a/tests/auto/qdiriterator/tst_qdiriterator.cpp b/tests/auto/qdiriterator/tst_qdiriterator.cpp
index 6efbc77..b0f7000 100644
--- a/tests/auto/qdiriterator/tst_qdiriterator.cpp
+++ b/tests/auto/qdiriterator/tst_qdiriterator.cpp
@@ -52,6 +52,11 @@
#define Q_NO_SYMLINKS
#endif
+#if defined(Q_OS_SYMBIAN)
+// Open C in Symbian doesn't support symbolic links to directories
+#define Q_NO_SYMLINKS_TO_DIRS
+#endif
+
Q_DECLARE_METATYPE(QDirIterator::IteratorFlags)
Q_DECLARE_METATYPE(QDir::Filters)
@@ -92,16 +97,20 @@ tst_QDirIterator::tst_QDirIterator()
QFile::remove("entrylist/directory/entrylist4.lnk");
#ifndef Q_NO_SYMLINKS
-#ifdef Q_OS_WIN
+# if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
// ### Sadly, this is a platform difference right now.
QFile::link("entrylist/file", "entrylist/linktofile.lnk");
+# ifndef Q_NO_SYMLINKS_TO_DIRS
QFile::link("entrylist/directory", "entrylist/linktodirectory.lnk");
+# endif
QFile::link("entrylist/nothing", "entrylist/brokenlink.lnk");
-#else
+# else
QFile::link("file", "entrylist/linktofile.lnk");
+# ifndef Q_NO_SYMLINKS_TO_DIRS
QFile::link("directory", "entrylist/linktodirectory.lnk");
+# endif
QFile::link("nothing", "entrylist/brokenlink.lnk");
-#endif
+# endif
#endif
QFile("entrylist/writable").open(QIODevice::ReadWrite);
}
@@ -136,7 +145,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
<< QString("entrylist") << QDirIterator::IteratorFlags(0)
<< QDir::Filters(QDir::NoFilter) << QStringList("*")
<< QString(
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
"entrylist/.,"
"entrylist/..,"
#endif
@@ -145,7 +154,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
"entrylist/linktofile.lnk,"
#endif
"entrylist/directory,"
-#ifndef Q_NO_SYMLINKS
+#if !defined(Q_NO_SYMLINKS) && !defined(Q_NO_SYMLINKS_TO_DIRS)
"entrylist/linktodirectory.lnk,"
#endif
"entrylist/writable").split(',');
@@ -154,7 +163,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
<< QString("entrylist") << QDirIterator::IteratorFlags(QDirIterator::Subdirectories | QDirIterator::FollowSymlinks)
<< QDir::Filters(QDir::NoFilter) << QStringList("*")
<< QString(
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
"entrylist/.,"
"entrylist/..,"
"entrylist/directory/.,"
@@ -166,7 +175,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
#endif
"entrylist/directory,"
"entrylist/directory/dummy,"
-#ifndef Q_NO_SYMLINKS
+#if !defined(Q_NO_SYMLINKS) && !defined(Q_NO_SYMLINKS_TO_DIRS)
"entrylist/linktodirectory.lnk,"
#endif
"entrylist/writable").split(',');
diff --git a/tests/auto/qdirmodel/qdirmodel.pro b/tests/auto/qdirmodel/qdirmodel.pro
index 2bf0773..19ec231 100644
--- a/tests/auto/qdirmodel/qdirmodel.pro
+++ b/tests/auto/qdirmodel/qdirmodel.pro
@@ -1,7 +1,7 @@
load(qttest_p4)
SOURCES += tst_qdirmodel.cpp
-wince*: {
+wince*|symbian: {
addit.sources = dirtest\test1\*
addit.path = dirtest\test1
tests.sources = test\*
@@ -9,8 +9,14 @@ wince*: {
sourceFile.sources = tst_qdirmodel.cpp
sourceFile.path = .
DEPLOYMENT += addit tests sourceFile
- DEFINES += SRCDIR=\\\"./\\\"
+}
+
+wince*: {
+ DEFINES += SRCDIR=\\\"./\\\"
+} symbian: {
+ TARGET.UID3 = 0xE0340003
+ DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x",""))
} else {
- DEFINES += SRCDIR=\\\"$$PWD/\\\"
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qdirmodel/tst_qdirmodel.cpp b/tests/auto/qdirmodel/tst_qdirmodel.cpp
index 57621ac..3514147 100644
--- a/tests/auto/qdirmodel/tst_qdirmodel.cpp
+++ b/tests/auto/qdirmodel/tst_qdirmodel.cpp
@@ -50,6 +50,12 @@
//TESTED_CLASS=
//TESTED_FILES=
+#if defined(Q_OS_SYMBIAN)
+# define STRINGIFY(x) #x
+# define TOSTRING(x) STRINGIFY(x)
+# define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/"
+#endif
+
class tst_QDirModel : public QObject
{
Q_OBJECT
@@ -89,7 +95,7 @@ private slots:
void rmdir_data();
void rmdir();
-
+
void filePath();
void hidden();
@@ -292,7 +298,7 @@ void tst_QDirModel::mkdir_data()
QTest::newRow("nameWithSpace") << QString("ab cd") << true << 2;
QTest::newRow("emptyDirName") << QString("") << false << 1;
QTest::newRow("nullDirName") << QString() << false << 1;
-
+
/*
QTest::newRow("recursiveDirName") << QString("test2/test3") << false << false;
QTest::newRow("singleDotDirName") << QString("./test3") << true << true;
@@ -449,7 +455,7 @@ bool tst_QDirModel::rowsAboutToBeRemoved_cleanup(const QString &test_path)
QString path = QDir::currentPath() + "/" + test_path;
QDir dir(path, "*", QDir::SortFlags(QDir::Name|QDir::IgnoreCase), QDir::Files);
QStringList files = dir.entryList();
-
+
for (int i = 0; i < files.count(); ++i) {
if (!dir.remove(files.at(i))) {
qDebug() << "failed to remove file" << files.at(i);
@@ -481,14 +487,14 @@ void tst_QDirModel::rowsAboutToBeRemoved()
qRegisterMetaType<QModelIndex>("QModelIndex");
- // NOTE: QDirModel will call refres() when a file is removed. refresh() will reread the entire directory,
+ // NOTE: QDirModel will call refresh() when a file is removed. refresh() will reread the entire directory,
// and emit layoutAboutToBeChanged and layoutChange. So, instead of checking for
// rowsAboutToBeRemoved/rowsRemoved we check for layoutAboutToBeChanged/layoutChanged
QSignalSpy spy(&model, SIGNAL(layoutAboutToBeChanged()));
QModelIndex parent = model.index(test_path);
QVERIFY(parent.isValid());
-
+
// remove the file
{
QModelIndex index = model.index(remove_row, 0, parent);
@@ -580,6 +586,13 @@ void tst_QDirModel::filePath()
model.setResolveSymlinks(false);
QModelIndex index = model.index(SRCDIR "test.lnk");
QVERIFY(index.isValid());
+#if defined(Q_OS_SYMBIAN)
+ // Since model will force lowercase path in Symbian, make case insensitive compare
+ // Note: Windows should fail this, too, if test path has any uppercase letters.
+ QCOMPARE(model.filePath(index).toLower(), QString(SRCDIR).toLower() + "test.lnk");
+ model.setResolveSymlinks(true);
+ QCOMPARE(model.filePath(index).toLower(), QString(SRCDIR).toLower() + "tst_qdirmodel.cpp");
+#else
#ifndef Q_OS_WINCE
QString path = SRCDIR;
#else
@@ -588,6 +601,7 @@ void tst_QDirModel::filePath()
QCOMPARE(model.filePath(index), path + QString( "test.lnk"));
model.setResolveSymlinks(true);
QCOMPARE(model.filePath(index), path + QString( "tst_qdirmodel.cpp"));
+#endif
QFile::remove(SRCDIR "test.lnk");
}
@@ -596,14 +610,14 @@ void tst_QDirModel::task196768_sorting()
//this task showed that the persistent model indexes got corrupted when sorting
QString path = SRCDIR;
- QDirModel model;
+ QDirModel model;
QTreeView view;
QPersistentModelIndex index = model.index(path);
view.setModel(&model);
QModelIndex index2 = model.index(path);
QCOMPARE(index.data(), index2.data());
- view.setRootIndex(index);
+ view.setRootIndex(index);
index2 = model.index(path);
QCOMPARE(index.data(), index2.data());
view.setCurrentIndex(index);
diff --git a/tests/auto/qdom/qdom.pro b/tests/auto/qdom/qdom.pro
index 7738fb7..61914b5 100644
--- a/tests/auto/qdom/qdom.pro
+++ b/tests/auto/qdom/qdom.pro
@@ -4,14 +4,16 @@ SOURCES += tst_qdom.cpp
QT = core xml
QT -= gui
-wince*: {
+wince*|symbian*: {
addFiles.sources = testdata doubleNamespaces.xml umlaut.xml
addFiles.path = .
DEPLOYMENT += addFiles
DEPLOYMENT_PLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs
- DEFINES += SRCDIR=\\\"\\\"
+ !symbian:DEFINES += SRCDIR=\\\"\\\"
}
else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
+
+symbian: TARGET.EPOCHEAPSIZE="0x100000 0x1000000"
diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp
index 025882b..cb2a045 100644
--- a/tests/auto/qdom/tst_qdom.cpp
+++ b/tests/auto/qdom/tst_qdom.cpp
@@ -52,6 +52,10 @@
#include <QtXml>
#include <QVariant>
+#if defined(Q_OS_SYMBIAN)
+# define SRCDIR ""
+#endif
+
//TESTED_CLASS=
//TESTED_FILES=
diff --git a/tests/auto/qevent/qevent.pro b/tests/auto/qevent/qevent.pro
index 219f97e..5c14299 100644
--- a/tests/auto/qevent/qevent.pro
+++ b/tests/auto/qevent/qevent.pro
@@ -1,6 +1,3 @@
load(qttest_p4)
SOURCES += tst_qevent.cpp
QT = core
-
-
-
diff --git a/tests/auto/qeventloop/tst_qeventloop.cpp b/tests/auto/qeventloop/tst_qeventloop.cpp
index 3fec3a9..347de36 100644
--- a/tests/auto/qeventloop/tst_qeventloop.cpp
+++ b/tests/auto/qeventloop/tst_qeventloop.cpp
@@ -54,6 +54,11 @@
#include <QTcpServer>
#include <QTcpSocket>
+#ifdef Q_OS_SYMBIAN
+#include <e32base.h>
+#include <unistd.h>
+#endif
+
//TESTED_CLASS=
//TESTED_FILES=
@@ -186,6 +191,10 @@ public slots:
void init();
void cleanup();
private slots:
+ // This test *must* run first. See the definition for why.
+ void onlySymbianActiveScheduler();
+ void symbianNestedActiveSchedulerLoop_data();
+ void symbianNestedActiveSchedulerLoop();
void processEvents();
void exec();
void exit();
@@ -213,6 +222,101 @@ void tst_QEventLoop::init()
void tst_QEventLoop::cleanup()
{ }
+#ifdef Q_OS_SYMBIAN
+class OnlySymbianActiveScheduler_helper : public QObject
+{
+ Q_OBJECT
+
+public:
+ OnlySymbianActiveScheduler_helper(int fd, QTimer *zeroTimer)
+ : fd(fd),
+ timerCount(0),
+ zeroTimer(zeroTimer),
+ zeroTimerCount(0),
+ notifierCount(0)
+ {
+ }
+ ~OnlySymbianActiveScheduler_helper() {}
+
+public slots:
+ void timerSlot()
+ {
+ // Let all the events occur twice so we know they reactivated after
+ // each occurrence.
+ if (++timerCount >= 2) {
+ // This will hopefully run last, so stop the active scheduler.
+ CActiveScheduler::Stop();
+ }
+ }
+ void zeroTimerSlot()
+ {
+ if (++zeroTimerCount >= 2) {
+ zeroTimer->stop();
+ }
+ }
+ void notifierSlot()
+ {
+ if (++notifierCount >= 2) {
+ char dummy;
+ ::read(fd, &dummy, 1);
+ }
+ }
+
+private:
+ int fd;
+ int timerCount;
+ QTimer *zeroTimer;
+ int zeroTimerCount;
+ int notifierCount;
+};
+#endif
+
+void tst_QEventLoop::onlySymbianActiveScheduler() {
+#ifndef Q_OS_SYMBIAN
+ QSKIP("This is a Symbian-only test.", SkipAll);
+#else
+ // In here we try to use timers and sockets exclusively using the Symbian
+ // active scheduler and no processEvents().
+ // This test should therefore be run first, so that we can verify that
+ // the first occurrence of processEvents does not do any initalization that
+ // we depend on.
+
+ // Open up a pipe so we can test socket notifiers.
+ int pipeEnds[2];
+ if (::pipe(pipeEnds) != 0) {
+ QFAIL("Could not open pipe");
+ }
+ QSocketNotifier notifier(pipeEnds[0], QSocketNotifier::Read);
+ QSignalSpy notifierSpy(&notifier, SIGNAL(activated(int)));
+ char dummy = 1;
+ ::write(pipeEnds[1], &dummy, 1);
+
+ QTimer zeroTimer;
+ QSignalSpy zeroTimerSpy(&zeroTimer, SIGNAL(timeout()));
+ zeroTimer.setInterval(0);
+ zeroTimer.start();
+
+ QTimer timer;
+ QSignalSpy timerSpy(&timer, SIGNAL(timeout()));
+ timer.setInterval(2000); // Generous timeout or this test will fail if there is high load
+ timer.start();
+
+ OnlySymbianActiveScheduler_helper helper(pipeEnds[0], &zeroTimer);
+ connect(&notifier, SIGNAL(activated(int)), &helper, SLOT(notifierSlot()));
+ connect(&zeroTimer, SIGNAL(timeout()), &helper, SLOT(zeroTimerSlot()));
+ connect(&timer, SIGNAL(timeout()), &helper, SLOT(timerSlot()));
+
+ CActiveScheduler::Start();
+
+ ::close(pipeEnds[1]);
+ ::close(pipeEnds[0]);
+
+ QCOMPARE(notifierSpy.count(), 2);
+ QCOMPARE(zeroTimerSpy.count(), 2);
+ QCOMPARE(timerSpy.count(), 2);
+#endif
+}
+
void tst_QEventLoop::processEvents()
{
QSignalSpy spy1(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()));
@@ -265,6 +369,14 @@ void tst_QEventLoop::processEvents()
killTimer(timerId);
}
+#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
+// Symbian needs bit longer timeout for emulator, as emulator startup causes additional delay
+# define EXEC_TIMEOUT 1000
+#else
+# define EXEC_TIMEOUT 100
+#endif
+
+
void tst_QEventLoop::exec()
{
{
@@ -272,15 +384,15 @@ void tst_QEventLoop::exec()
EventLoopExiter exiter(&eventLoop);
int returnCode;
- QTimer::singleShot(100, &exiter, SLOT(exit()));
+ QTimer::singleShot(EXEC_TIMEOUT, &exiter, SLOT(exit()));
returnCode = eventLoop.exec();
QCOMPARE(returnCode, 0);
- QTimer::singleShot(100, &exiter, SLOT(exit1()));
+ QTimer::singleShot(EXEC_TIMEOUT, &exiter, SLOT(exit1()));
returnCode = eventLoop.exec();
QCOMPARE(returnCode, 1);
- QTimer::singleShot(100, &exiter, SLOT(exit2()));
+ QTimer::singleShot(EXEC_TIMEOUT, &exiter, SLOT(exit2()));
returnCode = eventLoop.exec();
QCOMPARE(returnCode, 2);
}
@@ -313,16 +425,19 @@ void tst_QEventLoop::exec()
QEventLoop eventLoop;
EventLoopExecutor executor(&eventLoop);
- QTimer::singleShot(100, &executor, SLOT(exec()));
+ QTimer::singleShot(EXEC_TIMEOUT, &executor, SLOT(exec()));
int returnCode = eventLoop.exec();
QCOMPARE(returnCode, 0);
QCOMPARE(executor.returnCode, -1);
}
-#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM)
+#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM) && !defined(Q_OS_SYMBIAN)
// Windows Mobile cannot handle cross library exceptions
// qobject.cpp will try to rethrow the exception after handling
// which causes gwes.exe to crash
+
+ // Symbian doesn't propagate exceptions from eventloop, but converts them to
+ // CActiveScheduler errors instead -> this test will hang.
{
// QEventLoop::exec() is exception safe
QEventLoop eventLoop;
@@ -330,14 +445,14 @@ void tst_QEventLoop::exec()
try {
ExceptionThrower exceptionThrower;
- QTimer::singleShot(100, &exceptionThrower, SLOT(throwException()));
+ QTimer::singleShot(EXEC_TIMEOUT, &exceptionThrower, SLOT(throwException()));
(void) eventLoop.exec();
} catch (...) {
++caughtExceptions;
}
try {
ExceptionThrower exceptionThrower;
- QTimer::singleShot(100, &exceptionThrower, SLOT(throwException()));
+ QTimer::singleShot(EXEC_TIMEOUT, &exceptionThrower, SLOT(throwException()));
(void) eventLoop.exec();
} catch (...) {
++caughtExceptions;
@@ -512,7 +627,7 @@ void tst_QEventLoop::processEventsExcludeTimers()
// normal process events will send timers
eventLoop.processEvents(QEventLoop::X11ExcludeTimers);
-#ifndef Q_OS_UNIX
+#if !defined(Q_OS_UNIX) || defined(Q_OS_SYMBIAN)
QEXPECT_FAIL("", "X11ExcludeTimers only works on UN*X", Continue);
#endif
QCOMPARE(timerReceiver.gotTimerEvent, -1);
@@ -524,210 +639,163 @@ void tst_QEventLoop::processEventsExcludeTimers()
timerReceiver.gotTimerEvent = -1;
}
-QTEST_MAIN(tst_QEventLoop)
-#include "tst_qeventloop.moc"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+#ifdef Q_OS_SYMBIAN
+class DummyActiveObject : public CActive
+{
+public:
+ DummyActiveObject(int levels);
+ ~DummyActiveObject();
+ void Start();
+protected:
+ void DoCancel();
+ void RunL();
+public:
+ bool succeeded;
+private:
+ RTimer m_rTimer;
+ int remainingLevels;
+};
+class ActiveSchedulerLoop : public QObject
+{
+public:
+ ActiveSchedulerLoop(int levels) : succeeded(false), timerId(-1), remainingLevels(levels) {}
+ ~ActiveSchedulerLoop() {}
+ void timerEvent(QTimerEvent *e);
+public:
+ bool succeeded;
+ int timerId;
+ int remainingLevels;
+};
+DummyActiveObject::DummyActiveObject(int levels)
+ : CActive(CActive::EPriorityStandard),
+ succeeded(false),
+ remainingLevels(levels)
+{
+ m_rTimer.CreateLocal();
+}
+DummyActiveObject::~DummyActiveObject()
+{
+ Cancel();
+ m_rTimer.Close();
+}
+void DummyActiveObject::DoCancel()
+{
+ m_rTimer.Cancel();
+}
+void DummyActiveObject::RunL()
+{
+ if (remainingLevels - 1 <= 0) {
+ ActiveSchedulerLoop loop(remainingLevels - 1);
+ loop.timerId = loop.startTimer(0);
+ QCoreApplication::processEvents();
+ succeeded = loop.succeeded;
+ } else {
+ succeeded = true;
+ }
+ CActiveScheduler::Stop();
+}
-// previous test
+void DummyActiveObject::Start()
+{
+ m_rTimer.After(iStatus, 100000); // 100 ms
+ SetActive();
+}
-#if 0
+void ActiveSchedulerLoop::timerEvent(QTimerEvent *e)
+{
+ Q_UNUSED(e);
+ DummyActiveObject *dummy = new(ELeave) DummyActiveObject(remainingLevels);
+ CActiveScheduler::Add(dummy);
-#include <qwidget.h>
+ dummy->Start();
-#ifdef Q_WS_WIN
-#include <windows.h>
-#endif
+ CActiveScheduler::Start();
+ succeeded = dummy->succeeded;
+ delete dummy;
-//TESTED_CLASS=
-//TESTED_FILES=
+ killTimer(timerId);
+}
-class EventHandlerWidget : public QWidget
+// We cannot trap panics when the test case fails, so run it in a different thread instead.
+class ActiveSchedulerThread : public QThread
{
public:
- EventHandlerWidget( QWidget* parent = 0, const char* name = 0 ) : QWidget( parent, name )
- {
- installEventFilter( this );
- recievedPaintEvent = FALSE;
- recievedMouseEvent = FALSE;
- }
- ~EventHandlerWidget() {}
-
- bool recievedPaintEvent;
- bool recievedMouseEvent;
+ ActiveSchedulerThread(QEventLoop::ProcessEventsFlag flags);
+ ~ActiveSchedulerThread();
protected:
- bool eventFilter( QObject* o, QEvent* e )
- {
- if ( e->type() == QEvent::Paint )
- recievedPaintEvent = TRUE;
- else if ( e->type() == QEvent::MouseButtonPress )
- recievedMouseEvent = TRUE;
- return QWidget::eventFilter( o, e );
- }
-};
+ void run();
-class InBetweenObject : public QObject
-{
- Q_OBJECT
public:
- InBetweenObject(QObject *parent, QObject *child)
- : QObject(parent), childObject(child)
- {
- childObject->setParent(this);
- ++instanceCounter;
- }
-
- ~InBetweenObject()
- {
- --instanceCounter;
- }
-
- static int instanceCounter;
-
-protected:
- void childEvent(QChildEvent *e)
- {
- if (e->removed() && e->child() == childObject) {
- deleteLater();
- }
- }
+ volatile bool succeeded;
private:
- QObject *childObject;
+ QEventLoop::ProcessEventsFlag m_flags;
};
-class ObjectContainer : public QObject
-{
-public:
- ObjectContainer(QObject *parent = 0)
- : QObject(parent)
- {
- }
-
-protected:
- void childEvent(QChildEvent *e)
- {
- if (e->inserted() && !::qobject_cast<InBetweenObject*>(e->child())) {
- InBetweenObject *inBetween = new InBetweenObject(this, e->child());
- }
- }
-};
-
-class tst_QEventLoop : public QObject
-{
- Q_OBJECT
-public:
- tst_QEventLoop();
- ~tst_QEventLoop();
-public slots:
- void init();
- void cleanup();
-private slots:
- void processEvents();
- void eventHandlerPostsEvent();
-};
-
-tst_QEventLoop::tst_QEventLoop()
+ActiveSchedulerThread::ActiveSchedulerThread(QEventLoop::ProcessEventsFlag flags)
+ : succeeded(false),
+ m_flags(flags)
{
}
-tst_QEventLoop::~tst_QEventLoop()
+ActiveSchedulerThread::~ActiveSchedulerThread()
{
}
-void tst_QEventLoop::init()
+void ActiveSchedulerThread::run()
{
-}
+ ActiveSchedulerLoop loop(2);
+ loop.timerId = loop.startTimer(0);
+ // It may panic in here if the active scheduler and the Qt loop don't go together.
+ QCoreApplication::processEvents(m_flags);
-void tst_QEventLoop::cleanup()
-{
+ succeeded = loop.succeeded;
}
+#endif // ifdef Q_OS_SYMBIAN
-
-void tst_QEventLoop::processEvents()
+void tst_QEventLoop::symbianNestedActiveSchedulerLoop_data()
{
- EventHandlerWidget *mainWidget = new EventHandlerWidget( 0 );
- mainWidget->show();
- qApp->setMainWidget( mainWidget );
-
-#ifdef Q_WS_WIN
- QEventLoop* eventLoop = qApp->eventLoop();
- eventLoop->processEvents( QEventLoop::AllEvents );
- QVERIFY( !eventLoop->hasPendingEvents() );
+ QTest::addColumn<int>("processEventFlags");
- // Make sure the flag is cleared first
- mainWidget->recievedPaintEvent = FALSE;
-#ifdef Q_WS_WIN
- InvalidateRect( mainWidget->winId(), 0, TRUE );
-#endif
- QVERIFY( !mainWidget->recievedPaintEvent );
- eventLoop->processEvents( QEventLoop::AllEvents );
- QVERIFY( mainWidget->recievedPaintEvent );
-
-#ifdef Q_WS_WIN
- // TODO: Hardcoded for now...
- LPARAM lParam = MAKELPARAM( 10, 10 );
- PostMessage( mainWidget->winId(), WM_LBUTTONDOWN, 0, lParam );
-#endif
-
- mainWidget->recievedMouseEvent = FALSE;
- eventLoop->processEvents( QEventLoop::ExcludeUserInput );
- QVERIFY( !mainWidget->recievedMouseEvent );
-#else
- QSKIP( "QEventLoop test is not implememented on X11 yet", SkipAll);
-#endif
+ QTest::newRow("AllEvents") << (int)QEventLoop::AllEvents;
+ QTest::newRow("WaitForMoreEvents") << (int)QEventLoop::WaitForMoreEvents;
}
-int InBetweenObject::instanceCounter = 0;
-
-void tst_QEventLoop::eventHandlerPostsEvent()
+/*
+ Before you start fiddling with this test, you should have a good understanding of how
+ Symbian active objects work. What the test does is to try to screw up the semaphore count
+ in the active scheduler to cause stray signals, by running the Qt event loop and the
+ active scheduler inside each other. Naturally, its attempts to do this should be futile!
+*/
+void tst_QEventLoop::symbianNestedActiveSchedulerLoop()
{
- ObjectContainer container;
-
- QObject *object = new QObject(&container);
- qApp->processEvents();
- qApp->processEvents();
-
- QCOMPARE(InBetweenObject::instanceCounter, 1);
+#ifndef Q_OS_SYMBIAN
+ QSKIP("This is a Symbian only test.", SkipAll);
+#else
+ QFETCH(int, processEventFlags);
- object->deleteLater();
+ ActiveSchedulerThread thread((QEventLoop::ProcessEventsFlag)processEventFlags);
+ thread.start();
+ thread.wait(2000);
- qApp->processEvents();
- QCOMPARE(InBetweenObject::instanceCounter, 0);
-};
+ QVERIFY(thread.succeeded);
+#endif
+}
QTEST_MAIN(tst_QEventLoop)
#include "tst_qeventloop.moc"
-
-#endif
diff --git a/tests/auto/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro b/tests/auto/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro
index 3a22199..8a45aa2 100644
--- a/tests/auto/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro
+++ b/tests/auto/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro
@@ -1,3 +1,3 @@
load(qttest_p4)
SOURCES += tst_qexplicitlyshareddatapointer.cpp
-QT-=gui
+QT = core
diff --git a/tests/auto/qfile/test/test.pro b/tests/auto/qfile/test/test.pro
index 8d26f5e..80102f0 100644
--- a/tests/auto/qfile/test/test.pro
+++ b/tests/auto/qfile/test/test.pro
@@ -1,20 +1,26 @@
load(qttest_p4)
SOURCES += ../tst_qfile.cpp
+wince*|symbian:{
+ QT = core gui
+ files.sources += ..\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.path = resources
+
+ DEPLOYMENT = files resour
+}
+
wince*:{
-QT = core gui
-files.sources += ..\dosfile.txt ..\noendofline.txt ..\testfile.txt \
- ..\testlog.txt ..\two.dots.file ..\tst_qfile.cpp \
- ..\Makefile ..\forCopying.txt ..\forRenaming.txt
-files.path = .
-resour.sources += ..\resources
-resour.path = .
-
-DEPLOYMENT = files resour
-DEFINES += SRCDIR=\\\"\\\"
+ DEFINES += SRCDIR=\\\"\\\"
+} symbian: {
+ # don't define SRCDIR at all
+ TARGET.EPOCHEAPSIZE = 0x100000 0x3000000
} else {
-QT = core network
-DEFINES += SRCDIR=\\\"$$PWD/../\\\"
+ QT = core network
+ DEFINES += SRCDIR=\\\"$$PWD/../\\\"
}
RESOURCES += ../qfile.qrc ../rename-fallback.qrc ../copy-fallback.qrc
@@ -22,12 +28,12 @@ RESOURCES += ../qfile.qrc ../rename-fallback.qrc ../copy-fallback.qrc
TARGET = ../tst_qfile
win32 {
- CONFIG(debug, debug|release) {
- TARGET = ../../debug/tst_qfile
-} else {
- TARGET = ../../release/tst_qfile
- }
- LIBS+=-lole32 -luuid
+ CONFIG(debug, debug|release) {
+ TARGET = ../../debug/tst_qfile
+ } else {
+ TARGET = ../../release/tst_qfile
+ }
+ LIBS+=-lole32 -luuid
}
diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp
index ba7252d..c4195f4 100644
--- a/tests/auto/qfile/tst_qfile.cpp
+++ b/tests/auto/qfile/tst_qfile.cpp
@@ -50,7 +50,7 @@
#include <QDir>
#include <QFile>
#include <QFileInfo>
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
#include <QHostInfo>
#endif
#include <QProcess>
@@ -73,9 +73,12 @@
#endif
#include <stdio.h>
-
#include "../network-settings.h"
+#if defined(Q_OS_SYMBIAN)
+# define SRCDIR ""
+#endif
+
Q_DECLARE_METATYPE(QFile::FileError)
//TESTED_CLASS=
@@ -382,7 +385,10 @@ void tst_QFile::open()
QFETCH( bool, ok );
-#ifdef Q_OS_UNIX
+#if defined(Q_OS_SYMBIAN)
+ if (qstrcmp(QTest::currentDataTag(), "noreadfile") == 0)
+ QSKIP("Symbian does not support non-readable files", SkipSingle);
+#elif defined(Q_OS_UNIX)
if (::getuid() == 0)
// root and Chuck Norris don't care for file permissions. Skip.
QSKIP("Running this test as root doesn't make sense", SkipAll);
@@ -599,8 +605,8 @@ void tst_QFile::readLineNullInLine()
void tst_QFile::readAllStdin()
{
-#if defined(Q_OS_WINCE)
- QSKIP("Currently no stdin/out supported for Windows CE", SkipAll);
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+ QSKIP("Currently no stdin/out supported for Windows CE or Symbian", SkipAll);
#endif
#if defined(QT_NO_PROCESS)
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
@@ -625,8 +631,8 @@ void tst_QFile::readAllStdin()
void tst_QFile::readLineStdin()
{
-#if defined(Q_OS_WINCE)
- QSKIP("Currently no stdin/out supported for Windows CE", SkipAll);
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+ QSKIP("Currently no stdin/out supported for Windows CE or Symbian", SkipAll);
#endif
#if defined(QT_NO_PROCESS)
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
@@ -668,7 +674,7 @@ void tst_QFile::readLineStdin()
void tst_QFile::readLineStdin_lineByLine()
{
-#if defined(Q_OS_WINCE)
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QSKIP("Currently no stdin/out supported for Windows CE", SkipAll);
#endif
#if defined(QT_NO_PROCESS)
@@ -796,7 +802,7 @@ void tst_QFile::ungetChar()
void tst_QFile::invalidFile_data()
{
QTest::addColumn<QString>("fileName");
-#ifndef Q_WS_WIN
+#if !defined(Q_WS_WIN) && !defined(Q_OS_SYMBIAN)
QTest::newRow( "x11" ) << QString( "qwe//" );
#else
QTest::newRow( "colon1" ) << QString( "fail:invalid" );
@@ -866,6 +872,10 @@ void tst_QFile::permissions_data()
void tst_QFile::permissions()
{
+#if defined(Q_OS_SYMBIAN)
+ if (qstrcmp(QTest::currentDataTag(), "data0") == 0)
+ QSKIP("Symbian does not have execution permissions", SkipSingle);
+#endif
QFETCH(QString, file);
QFETCH(uint, perms);
QFETCH(bool, expected);
@@ -957,7 +967,11 @@ void tst_QFile::copyShouldntOverwrite()
QFile::remove("tst_qfile.cpy");
QFile file(SRCDIR "tst_qfile.cpp");
QVERIFY(file.copy("tst_qfile.cpy"));
+#if defined(Q_OS_SYMBIAN)
+ bool ok = QFile::setPermissions("tst_qfile.cpy", QFile::WriteUser);
+#else
bool ok = QFile::setPermissions("tst_qfile.cpy", QFile::WriteOther);
+#endif
QVERIFY(ok);
QVERIFY(!file.copy("tst_qfile.cpy"));
QFile::remove("tst_qfile.cpy");
@@ -1042,11 +1056,7 @@ void tst_QFile::link()
QVERIFY(QFile::link("tst_qfile.cpp", "myLink.lnk"));
QFileInfo info2("myLink.lnk");
QVERIFY(info2.isSymLink());
-#ifdef Q_OS_WIN // on windows links are always absolute
QCOMPARE(info2.symLinkTarget(), info1.absoluteFilePath());
-#else
- QCOMPARE(info2.symLinkTarget(), info1.absoluteFilePath());
-#endif
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
QString wd = getWorkingDirectoryForLink(info2.absoluteFilePath());
@@ -1057,6 +1067,9 @@ void tst_QFile::link()
void tst_QFile::linkToDir()
{
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Symbian does not support linking to directories", SkipAll);
+#endif
QFile::remove("myLinkToDir.lnk");
QDir dir;
dir.mkdir("myDir");
@@ -1069,11 +1082,7 @@ void tst_QFile::linkToDir()
// later fail...
QVERIFY(info2.isSymLink());
#endif
-#ifdef Q_OS_WIN // on windows links are alway absolute
QCOMPARE(info2.symLinkTarget(), info1.absoluteFilePath());
-#else
- QCOMPARE(info2.symLinkTarget(), info1.absoluteFilePath());
-#endif
QVERIFY(QFile::remove(info2.absoluteFilePath()));
QFile::remove("myLinkToDir.lnk");
dir.rmdir("myDir");
@@ -1092,8 +1101,7 @@ void tst_QFile::absolutePathLinkToRelativePath()
#else
QVERIFY(QFile::link("myDir/test.txt", "myDir/myLink.lnk"));
#endif
-
- QEXPECT_FAIL("", "Symlinking using relative paths is currently different on Windows and Unix", Continue);
+ QEXPECT_FAIL("", "Symlinking using relative paths is currently different on Windows and Unix/Symbian", Continue);
QCOMPARE(QFileInfo(QFile(QFileInfo("myDir/myLink.lnk").absoluteFilePath()).symLinkTarget()).absoluteFilePath(),
QFileInfo("myDir/test.txt").absoluteFilePath());
@@ -1106,18 +1114,24 @@ void tst_QFile::readBrokenLink()
{
QFile::remove("myLink2.lnk");
QFileInfo info1("file12");
+#if defined(Q_OS_SYMBIAN)
+ // In Symbian can't link to nonexisting file directly, so create the file temporarily
+ QFile tempFile("file12");
+ tempFile.open(QIODevice::WriteOnly);
+ tempFile.link("myLink2.lnk");
+ tempFile.remove();
+#else
QVERIFY(QFile::link("file12", "myLink2.lnk"));
+#endif
QFileInfo info2("myLink2.lnk");
QVERIFY(info2.isSymLink());
-#ifdef Q_OS_WIN // on windows links are alway absolute
- QCOMPARE(info2.symLinkTarget(), info1.absoluteFilePath());
-#else
QCOMPARE(info2.symLinkTarget(), info1.absoluteFilePath());
-#endif
QVERIFY(QFile::remove(info2.absoluteFilePath()));
+#if !defined(Q_OS_SYMBIAN)
QVERIFY(QFile::link("ole/..", "myLink2.lnk"));
QCOMPARE(QFileInfo("myLink2.lnk").symLinkTarget(), QDir::currentPath());
+#endif
}
void tst_QFile::readTextFile_data()
@@ -1330,7 +1344,7 @@ void tst_QFile::bufferedRead()
void tst_QFile::isSequential()
{
-#if defined (Q_OS_WIN)
+#if defined (Q_OS_WIN) || defined(Q_OS_SYMBIAN)
QSKIP("Unix only test.", SkipAll);
#endif
@@ -1639,7 +1653,7 @@ void tst_QFile::longFileName()
}
{
QFile file(fileName);
-#if defined(Q_OS_WINCE)
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QEXPECT_FAIL("244 chars", "Full pathname must be less than 260 chars", Abort);
QEXPECT_FAIL("244 chars to absolutepath", "Full pathname must be less than 260 chars", Abort);
#endif
@@ -1912,8 +1926,8 @@ void tst_QFile::writeLargeDataBlock()
// Generate a 64MB array with well defined contents.
QByteArray array;
-#if defined(Q_OS_WINCE)
- int resizeSize = 1024 * 1024; // WinCE does not have much space
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+ int resizeSize = 1024 * 1024; // WinCE and Symbian do not have much space
#else
int resizeSize = 64 * 1024 * 1024;
#endif
@@ -2050,7 +2064,7 @@ void tst_QFile::rename_data()
QTest::newRow("a -> .") << QString("a") << QString(".") << false;
QTest::newRow("renamefile -> renamefile") << QString("renamefile") << QString("renamefile") << false;
QTest::newRow("renamefile -> Makefile") << QString("renamefile") << QString("Makefile") << false;
-#ifdef Q_OS_UNIX
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
QTest::newRow("renamefile -> /etc/renamefile") << QString("renamefile") << QString("/etc/renamefile") << false;
#endif
QTest::newRow("renamefile -> renamedfile") << QString("renamefile") << QString("renamedfile") << true;
@@ -2278,7 +2292,7 @@ void tst_QFile::readEof_data()
QTest::newRow("buffered") << SRCDIR "testfile.txt" << 0;
QTest::newRow("unbuffered") << SRCDIR "testfile.txt" << int(QIODevice::Unbuffered);
-#ifdef Q_OS_UNIX
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
QTest::newRow("sequential,buffered") << "/dev/null" << 0;
QTest::newRow("sequential,unbuffered") << "/dev/null" << int(QIODevice::Unbuffered);
#endif
@@ -2461,9 +2475,11 @@ void tst_QFile::map()
QVERIFY(file.open(QFile::ReadWrite));
memory = file.map(offset, size);
if (error != QFile::NoError) {
+
QVERIFY(file.error() != QFile::NoError);
return;
}
+
QCOMPARE(file.error(), error);
QVERIFY(memory);
memory[0] = 'Q';
@@ -2500,7 +2516,9 @@ void tst_QFile::map()
file.close();
-#ifdef Q_OS_UNIX
+#if defined(Q_OS_SYMBIAN)
+ if (false) // No permissions for user makes no sense in Symbian
+#elif defined(Q_OS_UNIX)
if (::getuid() != 0)
// root always has permissions
#endif
diff --git a/tests/auto/qfiledialog/qfiledialog.pro b/tests/auto/qfiledialog/qfiledialog.pro
index 28a11ba..bea7716 100644
--- a/tests/auto/qfiledialog/qfiledialog.pro
+++ b/tests/auto/qfiledialog/qfiledialog.pro
@@ -6,10 +6,13 @@ load(qttest_p4)
SOURCES += tst_qfiledialog.cpp
-wince*: {
+wince*|symbian: {
addFiles.sources = *.cpp
addFiles.path = .
filesInDir.sources = *.pro
filesInDir.path = someDir
DEPLOYMENT += addFiles filesInDir
}
+
+symbian:TARGET.EPOCHEAPSIZE="0x100 0x1000000"
+symbian:HEADERS += ../../../include/qtgui/private/qfileinfogatherer_p.h
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp
index a50bcfe..a6d8235 100644
--- a/tests/auto/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp
@@ -306,6 +306,7 @@ void tst_QFiledialog::filesSelectedSignal()
QTest::qWait(500);
QListView *listView = qFindChild<QListView*>(&fd, "listView");
QVERIFY(listView);
+
QModelIndex root = listView->rootIndex();
QTRY_COMPARE(listView->model()->rowCount(root) > 0, true);
QModelIndex file;
@@ -473,10 +474,11 @@ void tst_QFiledialog::completer()
if (!tmp.exists(tempPath))
QVERIFY(tmp.mkdir("QFileDialogTestDir"));
QList<QTemporaryFile*> files;
+ QT_TRY {
for (int i = 0; i < 10; ++i) {
- QTemporaryFile *file = new QTemporaryFile(tempPath + "/rXXXXXX");
+ QScopedPointer<QTemporaryFile> file(new QTemporaryFile(tempPath + "/rXXXXXX"));
file->open();
- files.append(file);
+ files.append(file.take());
}
// ### flesh this out more
@@ -541,14 +543,14 @@ void tst_QFiledialog::completer()
if (input.startsWith(".."))
input.clear();
for (int ii = 0; ii < expectedFiles.count(); ++ii) {
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
if (expectedFiles.at(ii).startsWith(input,Qt::CaseInsensitive))
#else
if (expectedFiles.at(ii).startsWith(input))
#endif
++expected;
}
-#ifndef Q_OS_WIN
+#if !defined(Q_OS_WIN)
if (inputStartsWithRootPath)
expected++;
#endif
@@ -563,7 +565,14 @@ void tst_QFiledialog::completer()
//qDebug() << expectedFiles;
}
+
+ // ### FIXME: This will fail on Symbian on some tests and some environments until the file engine and QFileSystemModel
+ // are fixed to properly capitalize paths, so that some folders are not duplicated in QFileSystemModel.
QTRY_COMPARE(cModel->rowCount(), expected);
+ } QT_CATCH(...) {
+ qDeleteAll(files);
+ QT_RETHROW;
+ }
qDeleteAll(files);
}
@@ -926,8 +935,8 @@ void tst_QFiledialog::selectFiles()
QVERIFY(listView);
for (int i = 0; i < list.count(); ++i) {
fd.selectFile(fd.directory().path() + "/" + list.at(i));
-#if defined(Q_WS_MAC) || defined(Q_WS_WIN)
- QEXPECT_FAIL("", "This test does not work on Mac or Windows", Abort);
+#if defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN)
+ QEXPECT_FAIL("", "This test does not work on Mac, Windows, or Symbian", Abort);
#endif
QTRY_VERIFY(!listView->selectionModel()->selectedRows().isEmpty());
toSelect.append(listView->selectionModel()->selectedRows().last());
@@ -1232,6 +1241,9 @@ void tst_QFiledialog::clearLineEdit()
fd.setDirectory(QDir::home());
QTest::qWait(1000);
+#ifdef QT_KEYPAD_NAVIGATION
+ list->setEditFocus(true);
+#endif
QTest::keyClick(list, Qt::Key_Down);
#ifndef Q_WS_MAC
QTest::keyClick(list, Qt::Key_Return);
@@ -1705,6 +1717,9 @@ void tst_QFiledialog::task233037_selectingDirectory()
fd.show();
QListView *list = qFindChild<QListView*>(&fd, "listView");
QTest::qWait(3000); // Wait for sort to settle (I need a signal).
+#ifdef QT_KEYPAD_NAVIGATION
+ list->setEditFocus(true);
+#endif
QTest::keyClick(list, Qt::Key_Down);
QTest::qWait(100);
QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(&fd, "buttonBox");
diff --git a/tests/auto/qfileinfo/qfileinfo.pro b/tests/auto/qfileinfo/qfileinfo.pro
index 91b630d..c3be825 100644
--- a/tests/auto/qfileinfo/qfileinfo.pro
+++ b/tests/auto/qfileinfo/qfileinfo.pro
@@ -6,10 +6,14 @@ QT = core
RESOURCES += qfileinfo.qrc
-wince*: {
+wince*:|symbian*: {
deploy.sources += qfileinfo.qrc tst_qfileinfo.cpp
res.sources = resources\file1 resources\file1.ext1 resources\file1.ext1.ext2
res.path = resources
DEPLOYMENT = deploy res
}
+symbian {
+ TARGET.CAPABILITY=AllFiles
+ LIBS *= -lefsrv
+ }
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index 6c94ebf..9184def 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -59,7 +59,10 @@
#endif
#include <qplatformdefs.h>
#include <qdebug.h>
-
+#ifdef Q_OS_SYMBIAN
+#include <f32file.h>
+#include <private/qcore_symbian_p.h>
+#endif
#include "../network-settings.h"
#include <private/qfileinfo_p.h>
@@ -171,6 +174,11 @@ tst_QFileInfo::~tst_QFileInfo()
QFile::remove("brokenlink.lnk");
QFile::remove("link.lnk");
QFile::remove("file1");
+ QFile::remove("dummyfile");
+#ifdef Q_OS_SYMBIAN
+ QFile::remove("hidden.txt");
+ QFile::remove("nothidden.txt");
+#endif
}
// Testing get/set functions
@@ -267,6 +275,7 @@ void tst_QFileInfo::isDir_data()
{
// create a broken symlink
QFile::remove("brokenlink.lnk");
+ QFile::remove("dummyfile");
QFile file3("dummyfile");
file3.open(QIODevice::WriteOnly);
if (file3.link("brokenlink.lnk")) {
@@ -289,10 +298,12 @@ void tst_QFileInfo::isDir_data()
QTest::newRow("broken link") << "brokenlink.lnk" << false;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
QTest::newRow("drive 1") << "c:" << true;
QTest::newRow("drive 2") << "c:/" << true;
//QTest::newRow("drive 2") << "t:s" << false;
+#endif
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
QTest::newRow("unc 1") << "//" + QtNetworkSettings::winServerName() << true;
QTest::newRow("unc 2") << "//" + QtNetworkSettings::winServerName() + "/" << true;
QTest::newRow("unc 3") << "//" + QtNetworkSettings::winServerName() + "/testshare" << true;
@@ -316,7 +327,6 @@ void tst_QFileInfo::isRoot_data()
{
QTest::addColumn<QString>("path");
QTest::addColumn<bool>("expected");
-
QTest::newRow("data0") << QDir::currentPath() << false;
QTest::newRow("data1") << "/" << true;
QTest::newRow("data2") << "*" << false;
@@ -326,11 +336,13 @@ void tst_QFileInfo::isRoot_data()
QTest::newRow("simple dir") << "resources" << false;
QTest::newRow("simple dir with slash") << "resources/" << false;
-
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
QTest::newRow("drive 1") << "c:" << false;
QTest::newRow("drive 2") << "c:/" << true;
QTest::newRow("drive 3") << "p:/" << false;
+#endif
+
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
QTest::newRow("unc 1") << "//" + QtNetworkSettings::winServerName() << true;
QTest::newRow("unc 2") << "//" + QtNetworkSettings::winServerName() + "/" << true;
QTest::newRow("unc 3") << "//" + QtNetworkSettings::winServerName() + "/testshare" << false;
@@ -398,7 +410,7 @@ void tst_QFileInfo::absolutePath_data()
QTest::addColumn<QString>("filename");
QString drivePrefix;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
drivePrefix = QDir::currentPath().left(2);
#endif
QTest::newRow("0") << "/machine/share/dir1/" << drivePrefix + "/machine/share/dir1" << "";
@@ -433,7 +445,7 @@ void tst_QFileInfo::absFilePath_data()
QTest::newRow("relativeFile") << "tmp.txt" << QDir::currentPath() + "/tmp.txt";
QTest::newRow("relativeFileInSubDir") << "temp/tmp.txt" << QDir::currentPath() + "/" + "temp/tmp.txt";
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
QString curr = QDir::currentPath();
curr.remove(0, 2); // Make it a absolute path with no drive specifier: \depot\qt-4.2\tests\auto\qfileinfo
QTest::newRow(".") << curr << QDir::currentPath();
@@ -485,6 +497,8 @@ void tst_QFileInfo::canonicalFilePath()
QCOMPARE(info1.canonicalFilePath(), info2.canonicalFilePath());
}
}
+# if !defined(Q_OS_SYMBIAN)
+ // Symbian doesn't support links to directories
{
const QString link(QDir::tempPath() + QDir::separator() + "tst_qfileinfo");
QFile::remove(link);
@@ -492,6 +506,9 @@ void tst_QFileInfo::canonicalFilePath()
if (file.link(link)) {
QFileInfo info1("tst_qfileinfo.cpp");
QFileInfo info2(link + QDir::separator() + "tst_qfileinfo.cpp");
+
+ QVERIFY2(info1.exists(), "If this fails, one reason might be the test system has failed to copy the files.");
+ QVERIFY2(info2.exists(), "If this fails, one reason might be the test system has failed to copy the files.");
QCOMPARE(info1.canonicalFilePath(), info2.canonicalFilePath());
QFileInfo info3(link + QDir::separator() + "link.lnk");
@@ -513,6 +530,7 @@ void tst_QFileInfo::canonicalFilePath()
QCOMPARE(info1.canonicalFilePath(), info2.canonicalFilePath());
}
}
+# endif
#endif
}
@@ -524,7 +542,7 @@ void tst_QFileInfo::fileName_data()
QTest::newRow("relativeFile") << "tmp.txt" << "tmp.txt";
QTest::newRow("relativeFileInSubDir") << "temp/tmp.txt" << "tmp.txt";
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
QTest::newRow("absFilePath") << "c:\\home\\andy\\tmp.txt" << "tmp.txt";
#else
QTest::newRow("absFilePath") << "/home/andy/tmp.txt" << "tmp.txt";
@@ -722,8 +740,11 @@ void tst_QFileInfo::permission()
QFETCH(QString, file);
QFETCH(int, perms);
QFETCH(bool, expected);
+#ifdef Q_OS_SYMBIAN
+ QSKIP("No user based rights in Symbian OS - SOS needs platform security tests instead", SkipAll);
+#endif
QFileInfo fi(file);
- QCOMPARE(fi.permission((QFile::Permissions)perms), expected);
+ QCOMPARE(fi.permission(QFile::Permissions(perms)), expected);
}
void tst_QFileInfo::size_data()
@@ -773,7 +794,7 @@ void tst_QFileInfo::compare_data()
<< QDir::currentPath() + QString::fromLatin1("/tst_qfileinfo.cpp") << true;
QTest::newRow("casesense1") << QString::fromLatin1("tst_qfileInfo.cpp")
<< QDir::currentPath() + QString::fromLatin1("/tst_qfileinfo.cpp")
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
<< true;
#else
<< false;
@@ -794,7 +815,7 @@ void tst_QFileInfo::consistent_data()
QTest::addColumn<QString>("file");
QTest::addColumn<QString>("expected");
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
QTest::newRow("slashes") << QString::fromLatin1("\\a\\a\\a\\a") << QString::fromLatin1("/a/a/a/a");
#endif
QTest::newRow("ending slash") << QString::fromLatin1("/a/somedir/") << QString::fromLatin1("/a/somedir/");
@@ -845,6 +866,9 @@ void tst_QFileInfo::fileTimes()
#if defined(Q_OS_WINCE)
QEXPECT_FAIL("longfile", "No long filenames on WinCE", Abort);
QEXPECT_FAIL("longfile absolutepath", "No long filenames on WinCE", Abort);
+#elif defined(Q_OS_SYMBIAN)
+ QEXPECT_FAIL("longfile", "Maximum total filepath cannot exceed 256 characters in Symbian", Abort);
+ QEXPECT_FAIL("longfile absolutepath", "Maximum total filepath cannot exceed 256 characters in Symbian", Abort);
#endif
QVERIFY(file.open(QFile::WriteOnly | QFile::Text));
QTextStream ts(&file);
@@ -888,6 +912,9 @@ void tst_QFileInfo::fileTimes()
#ifdef Q_OS_WINCE
QEXPECT_FAIL("simple", "WinCE only stores date of access data, not the time", Continue);
#endif
+#ifdef Q_OS_SYMBIAN
+ QEXPECT_FAIL("simple", "Symbian implementation of stat doesn't return read time right", Abort);
+#endif
QVERIFY(fileInfo.lastRead() > beforeRead);
QVERIFY(fileInfo.lastModified() > beforeWrite);
QVERIFY(fileInfo.lastModified() < beforeRead);
@@ -950,6 +977,7 @@ void tst_QFileInfo::isSymLink()
{
QFile::remove("link.lnk");
QFile::remove("brokenlink.lnk");
+ QFile::remove("dummyfile");
QFileInfo info1("tst_qfileinfo.cpp");
QVERIFY( !info1.isSymLink() );
@@ -963,11 +991,13 @@ void tst_QFileInfo::isSymLink()
QFile file3("dummyfile");
file3.open(QIODevice::WriteOnly);
if (file3.link("brokenlink.lnk")) {
+ // In Symbian ARMV5 builds, this will panic with KERN-EXEC 3 inside OpenC fclose() call
+ // in QFSFileEnginePrivate::closeFdFh(), if "dummyfile" exists prior calling to isSymLink
+ // and is not deleted at the beginning of isSymLink.
file3.remove();
QFileInfo info3("brokenlink.lnk");
QVERIFY( info3.isSymLink() );
}
-
}
void tst_QFileInfo::isHidden_data()
@@ -983,13 +1013,13 @@ void tst_QFileInfo::isHidden_data()
QTest::newRow("C:/RECYCLER/.") << QString::fromLatin1("C:/RECYCLER/.") << false;
QTest::newRow("C:/RECYCLER/..") << QString::fromLatin1("C:/RECYCLER/..") << false;
#endif
-#if defined(Q_OS_UNIX)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
QTest::newRow("~/.qt") << QDir::homePath() + QString("/.qt") << true;
QTest::newRow("~/.qt/.") << QDir::homePath() + QString("/.qt/.") << false;
QTest::newRow("~/.qt/..") << QDir::homePath() + QString("/.qt/..") << false;
#endif
-#if !defined(Q_OS_WIN)
+#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN)
QTest::newRow("/bin/") << QString::fromLatin1("/bin/") << false;
#endif
@@ -998,6 +1028,45 @@ void tst_QFileInfo::isHidden_data()
QTest::newRow("mac_private_etc") << QString::fromLatin1("/private/etc") << false;
QTest::newRow("mac_Applications") << QString::fromLatin1("/Applications") << false;
#endif
+
+#ifdef Q_OS_SYMBIAN
+ // No guaranteed hidden file knows to exist in Symbian filesystem, so make one.
+ QString hiddenFileName("hidden.txt");
+ QString notHiddenFileName("nothidden.txt");
+ QTest::newRow("hidden file") << hiddenFileName << true;
+ QTest::newRow("non-hidden file") << notHiddenFileName << false;
+
+ {
+ QFile file(hiddenFileName);
+ if (file.open(QIODevice::WriteOnly)) {
+ QTextStream t(&file);
+ t << "foobar";
+ } else {
+ qWarning("Failed to create hidden file");
+ }
+ QFile file2(notHiddenFileName);
+ if (file2.open(QIODevice::WriteOnly)) {
+ QTextStream t(&file);
+ t << "foobar";
+ } else {
+ qWarning("Failed to create non-hidden file");
+ }
+ }
+
+ RFs rfs;
+ TInt err = rfs.Connect();
+ if (err == KErrNone) {
+ HBufC* symFile = qt_QString2HBufC(hiddenFileName);
+ err = rfs.SetAtt(*symFile, KEntryAttHidden, 0);
+ rfs.Close();
+ delete symFile;
+ if (err != KErrNone) {
+ qWarning("Failed to set hidden attribute for test file");
+ }
+ } else {
+ qWarning("Failed to open RFs session");
+ }
+#endif
}
void tst_QFileInfo::isHidden()
@@ -1117,6 +1186,10 @@ void tst_QFileInfo::brokenShortcut()
void tst_QFileInfo::isWritable()
{
+#ifdef Q_OS_SYMBIAN
+ QSKIP("Currently skipped on Symbian OS, but surely there is a writeable file somewhere???", SkipAll);
+#endif
+
QVERIFY(QFileInfo("tst_qfileinfo.cpp").isWritable());
#ifdef Q_OS_WIN
#ifdef Q_OS_WINCE
@@ -1137,10 +1210,17 @@ void tst_QFileInfo::isWritable()
void tst_QFileInfo::isExecutable()
{
+#ifdef Q_OS_SYMBIAN
+# if defined(Q_CC_NOKIAX86)
+ QSKIP("Impossible to implement reading/touching of application binaries in Symbian emulator", SkipAll);
+# endif
+ QString appPath = "c:/sys/bin/tst_qfileinfo.exe";
+#else
QString appPath = QCoreApplication::applicationDirPath();
appPath += "/tst_qfileinfo";
-#if defined(Q_OS_WIN)
+# if defined(Q_OS_WIN)
appPath += ".exe";
+# endif
#endif
QFileInfo fi(appPath);
QCOMPARE(fi.isExecutable(), true);
diff --git a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro
index 1daae04..eac16ee 100644
--- a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro
+++ b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro
@@ -2,7 +2,14 @@ CONFIG += qttest_p4
QT = core gui
-SOURCES += tst_qfilesystemmodel.cpp
+SOURCES += tst_qfilesystemmodel.cpp
TARGET = tst_qfilesystemmodel
+symbian: {
+ HEADERS += ../../../include/qtgui/private/qfileinfogatherer_p.h
+ # need to deploy something to create the private directory
+ dummyDeploy.sources = tst_qfilesystemmodel.cpp
+ dummyDeploy.path = .
+ DEPLOYMENT += dummyDeploy
+}
diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
index fc67df1..796add5 100644
--- a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -48,7 +48,9 @@
#include <QTime>
#include <QStyle>
#include <QtGlobal>
-
+#if defined(Q_OS_SYMBIAN)
+# include <f32file.h>
+#endif
//TESTED_CLASS=
//TESTED_FILES=
@@ -64,6 +66,23 @@
} \
} while(0)
+#if defined(Q_OS_SYMBIAN)
+static HBufC* qt_QString2HBufCNewL(const QString& aString)
+{
+ HBufC *buffer;
+#ifdef QT_NO_UNICODE
+ TPtrC8 ptr(reinterpret_cast<const TUint8*>(aString.toLocal8Bit().constData()));
+ buffer = HBufC8::NewL(ptr.Length());
+ buffer->Des().Copy(ptr);
+#else
+ TPtrC16 ptr(reinterpret_cast<const TUint16*>(aString.utf16()));
+ buffer = HBufC16::NewL(ptr.Length());
+ buffer->Des().Copy(ptr);
+#endif
+ return buffer;
+}
+#endif
+
class tst_QFileSystemModel : public QObject {
Q_OBJECT
@@ -123,6 +142,9 @@ protected:
private:
QFileSystemModel *model;
QString flatDirTestPath;
+#if defined(Q_OS_SYMBIAN)
+ RFs rfs;
+#endif
};
tst_QFileSystemModel::tst_QFileSystemModel() : model(0)
@@ -133,10 +155,16 @@ tst_QFileSystemModel::tst_QFileSystemModel() : model(0)
qsrand(midnight.secsTo(QTime::currentTime()));
// generating unique temporary directory name
flatDirTestPath = QDir::temp().path() + '/' + QString("flatdirtest.") + QString::number(qrand());
+#if defined(Q_OS_SYMBIAN)
+ rfs.Connect();
+#endif
}
tst_QFileSystemModel::~tst_QFileSystemModel()
{
+#if defined(Q_OS_SYMBIAN)
+ rfs.Close();
+#endif
QString tmp = flatDirTestPath;
QDir dir(tmp);
if (dir.exists() && !dir.rmdir(tmp))
@@ -176,7 +204,7 @@ void tst_QFileSystemModel::cleanup()
void tst_QFileSystemModel::indexPath()
{
-#ifndef Q_OS_WIN
+#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN)
int depth = QDir::currentPath().count('/');
model->setRootPath(QDir::currentPath());
QTest::qWait(WAITTIME);
@@ -380,6 +408,12 @@ bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringLi
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
if (initial_files.at(i)[0] == '.')
QProcess::execute(QString("attrib +h %1").arg(file.fileName()));
+#elif defined(Q_OS_SYMBIAN)
+ if (initial_files.at(i)[0] == '.') {
+ HBufC* buffer = qt_QString2HBufCNewL(QDir::toNativeSeparators(file.fileName()));
+ rfs.SetAtt(*buffer, KEntryAttHidden, 0);
+ delete buffer;
+ }
#endif
//qDebug() << test_path + '/' + initial_files.at(i) << (QFile::exists(test_path + '/' + initial_files.at(i)));
}
@@ -568,7 +602,7 @@ void tst_QFileSystemModel::filters_data()
QTest::addColumn<int>("dirFilters");
QTest::addColumn<QStringList>("nameFilters");
QTest::addColumn<int>("rowCount");
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QTest::newRow("no dirs") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs) << QStringList() << 2;
QTest::newRow("one dir - dotdot") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs | QDir::NoDotAndDotDot) << QStringList() << 1;
QTest::newRow("one dir") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs) << QStringList() << 3;
@@ -593,7 +627,12 @@ void tst_QFileSystemModel::filters_data()
QTest::newRow("no dir + hidden") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::Hidden) << QStringList() << 0;
QTest::newRow("dir+hid+files") << (QStringList() << "a" << "b" << "c") << QStringList() <<
(int)(QDir::Dirs | QDir::Files | QDir::Hidden) << QStringList() << 3;
+#if defined(Q_OS_SYMBIAN)
+ // Some symbian envs have a bug that causes "A" and ".A" to be considered same name in file system.
+ QTest::newRow("dir+file+hid-dot .D") << (QStringList() << "a" << "b" << "c") << (QStringList() << ".D") <<
+#else
QTest::newRow("dir+file+hid-dot .A") << (QStringList() << "a" << "b" << "c") << (QStringList() << ".A") <<
+#endif
(int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot) << QStringList() << 4;
QTest::newRow("dir+files+hid+dot A") << (QStringList() << "a" << "b" << "c") << (QStringList() << "AFolder") <<
(int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot) << (QStringList() << "A*") << 2;
@@ -910,7 +949,7 @@ void tst_QFileSystemModel::dirsBeforeFiles()
#endif
}
}
-
+
QTEST_MAIN(tst_QFileSystemModel)
#include "tst_qfilesystemmodel.moc"
diff --git a/tests/auto/qfilesystemwatcher/qfilesystemwatcher.pro b/tests/auto/qfilesystemwatcher/qfilesystemwatcher.pro
index c4d1d6f..8b8616a 100644
--- a/tests/auto/qfilesystemwatcher/qfilesystemwatcher.pro
+++ b/tests/auto/qfilesystemwatcher/qfilesystemwatcher.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qfilesystemwatcher.cpp
QT = core
-
-
diff --git a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index b1e8c09..a3dab07 100644
--- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -73,9 +73,11 @@ private slots:
void removePath();
void addPaths();
void removePaths();
- void watchFileAndItsDirectory();
+
void watchFileAndItsDirectory_data() { basicTest_data(); }
+ void watchFileAndItsDirectory();
+ void cleanup();
private:
QStringList do_force_engines;
bool do_force_native;
@@ -96,7 +98,7 @@ tst_QFileSystemWatcher::tst_QFileSystemWatcher()
if (inotify_init() != -1)
do_force_engines << "inotify";
#endif
-#elif defined(Q_OS_WIN) || defined(Q_OS_DARWIN) || defined(Q_OS_FREEBSD)
+#elif defined(Q_OS_WIN) || defined(Q_OS_DARWIN) || defined(Q_OS_FREEBSD) || defined(Q_OS_SYMBIAN)
// we have native engines for win32, macosx and freebsd
do_force_engines << "native";
#endif
@@ -314,6 +316,9 @@ void tst_QFileSystemWatcher::watchDirectory()
#ifdef Q_OS_WINCE
QEXPECT_FAIL("poller", "Directory does not get updated on file removal(See #137910)", Abort);
+#elif defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT)
+ // Since native watcher is always used in real devices, this poller issue is irrelevant
+ QEXPECT_FAIL("poller", "Poller doesn't detect directory removal in RVCT builds", Abort);
#endif
QCOMPARE(changedSpy.count(), 2);
QCOMPARE(changedSpy.at(0).count(), 1);
@@ -456,12 +461,22 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
timer.start(3000);
eventLoop.exec();
QVERIFY(fileChangedSpy.count() > 0);
- QCOMPARE(dirChangedSpy.count(), 0);
+ //according to Qt 4 documentation:
+ //void QFileSystemWatcher::directoryChanged ( const QString & path ) [signal]
+ //This signal is emitted when the directory at a specified path, is modified
+ //(e.g., when a file is added, -->modified<-- or deleted) or removed from disk.
+ //Note that if there are several changes during a short period of time, some
+ //of the changes might not emit this signal. However, the last change in the
+ //sequence of changes will always generate this signal.
+ //Symbian behaves as documented (and can't be filtered), but the other platforms don't
+ //so test should not assert this
+ QVERIFY(dirChangedSpy.count() < 2);
if (backend == "dnotify")
QSKIP("dnotify is broken, skipping the rest of the test.", SkipSingle);
fileChangedSpy.clear();
+ dirChangedSpy.clear();
QFile secondFile(secondFileName);
secondFile.open(QIODevice::WriteOnly | QIODevice::Truncate);
secondFile.write("Foo");
@@ -470,6 +485,11 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
timer.start(3000);
eventLoop.exec();
QCOMPARE(fileChangedSpy.count(), 0);
+#if defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT)
+ // Since native watcher is always used in real devices, this poller issue is irrelevant
+ // Symbian file system does not change modification time on a directory when a file inside is changed
+ QEXPECT_FAIL("poller", "Poller doesn't detect directory changes in RVCT builds", Abort);
+#endif
QCOMPARE(dirChangedSpy.count(), 1);
dirChangedSpy.clear();
@@ -495,5 +515,15 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
QVERIFY(QDir().rmdir("testDir"));
}
+void tst_QFileSystemWatcher::cleanup()
+{
+ QDir testDir("testDir");
+ QString testFileName = testDir.filePath("testFile.txt");
+ QString secondFileName = testDir.filePath("testFile2.txt");
+ QFile::remove(testFileName);
+ QFile::remove(secondFileName);
+ QDir().rmdir("testDir");
+}
+
QTEST_MAIN(tst_QFileSystemWatcher)
#include "tst_qfilesystemwatcher.moc"
diff --git a/tests/auto/qflags/qflags.pro b/tests/auto/qflags/qflags.pro
index 1e62db1..cd7f759 100644
--- a/tests/auto/qflags/qflags.pro
+++ b/tests/auto/qflags/qflags.pro
@@ -1,6 +1,3 @@
load(qttest_p4)
SOURCES += tst_qflags.cpp
-
QT = core
-
-
diff --git a/tests/auto/qfontdatabase/qfontdatabase.pro b/tests/auto/qfontdatabase/qfontdatabase.pro
index cee6839..35811f1 100644
--- a/tests/auto/qfontdatabase/qfontdatabase.pro
+++ b/tests/auto/qfontdatabase/qfontdatabase.pro
@@ -1,8 +1,8 @@
load(qttest_p4)
SOURCES += tst_qfontdatabase.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\"
-wince* {
+wince*|symbian {
additionalFiles.sources = FreeMono.ttf
additionalFiles.path = .
DEPLOYMENT += additionalFiles
diff --git a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp
index 5e813f3..2358d31 100644
--- a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp
+++ b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp
@@ -45,9 +45,9 @@
#include <qfontdatabase.h>
-
-
-
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR "."
+#endif
//TESTED_CLASS=
//TESTED_FILES=
@@ -191,6 +191,9 @@ void tst_QFontDatabase::addAppFont_data()
void tst_QFontDatabase::addAppFont()
{
+#ifdef Q_OS_SYMBIAN
+ QSKIP( "Symbian: Application fonts are not yet supported", SkipAll );
+#else
QFETCH(bool, useMemoryFont);
QSignalSpy fontDbChangedSpy(QApplication::instance(), SIGNAL(fontDatabaseChanged()));
@@ -240,6 +243,7 @@ void tst_QFontDatabase::addAppFont()
QCOMPARE(fontDbChangedSpy.count(), 2);
QVERIFY(db.families() == oldFamilies);
+#endif
}
QTEST_MAIN(tst_QFontDatabase)
diff --git a/tests/auto/qfontdialog/tst_qfontdialog.cpp b/tests/auto/qfontdialog/tst_qfontdialog.cpp
index 9605ab3..39b3f08 100644
--- a/tests/auto/qfontdialog/tst_qfontdialog.cpp
+++ b/tests/auto/qfontdialog/tst_qfontdialog.cpp
@@ -171,7 +171,7 @@ void tst_QFontDialog::task256466_wrongStyle()
QModelIndex currentFamily = familyList->model()->index(i, 0);
familyList->setCurrentIndex(currentFamily);
const QFont current = dialog.currentFont(),
- expected = fdb.font(currentFamily.data().toString(),
+ expected = fdb.font(currentFamily.data().toString(),
styleList->currentIndex().data().toString(), sizeList->currentIndex().data().toInt());
QCOMPARE(current.family(), expected.family());
QCOMPARE(current.style(), expected.style());
diff --git a/tests/auto/qftp/.gitattributes b/tests/auto/qftp/.gitattributes
index d220f58..e04709a 100644
--- a/tests/auto/qftp/.gitattributes
+++ b/tests/auto/qftp/.gitattributes
@@ -1 +1 @@
-rfc3252.txt -cflf Unset
+rfc3252.txt -crlf
diff --git a/tests/auto/qftp/qftp.pro b/tests/auto/qftp/qftp.pro
index 84d8c19..c060296 100644
--- a/tests/auto/qftp/qftp.pro
+++ b/tests/auto/qftp/qftp.pro
@@ -9,6 +9,11 @@ wince*: {
addFiles.path = .
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\"\\\"
+} else:symbian* {
+ addFiles.sources = rfc3252.txt
+ addFiles.path = .
+ DEPLOYMENT += addFiles
+ TARGET.EPOCHEAPSIZE="0x100 0x1000000"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp
index 7fa5601..34b42a9 100644
--- a/tests/auto/qftp/tst_qftp.cpp
+++ b/tests/auto/qftp/tst_qftp.cpp
@@ -51,11 +51,22 @@
#include <stdlib.h>
#include <QNetworkProxy>
+#ifndef TEST_QNETWORK_PROXY
+#define TEST_QNETWORK_PROXY
+#endif
#include "../network-settings.h"
//TESTED_CLASS=
//TESTED_FILES=
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+// Application private dir is default serach path for files, so SRCDIR can be set to empty
+#define SRCDIR ""
+#endif
+
+
+
class tst_QFtp : public QObject
{
Q_OBJECT
@@ -178,11 +189,11 @@ const int bytesDone_init = -10;
tst_QFtp::tst_QFtp()
{
+ Q_SET_DEFAULT_IAP
}
tst_QFtp::~tst_QFtp()
{
-
}
void tst_QFtp::initTestCase_data()
@@ -191,9 +202,11 @@ void tst_QFtp::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
+#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
//### doesn't work well yet.
//QTest::newRow("WithHttpProxy") << true << int(QNetworkProxy::HttpProxy);
+#endif
}
void tst_QFtp::initTestCase()
@@ -1144,7 +1157,7 @@ QDataStream &operator>>( QDataStream &s, FtpCommand &command )
}
Q_DECLARE_METATYPE(QList<FtpCommand>)
- void tst_QFtp::commandSequence_data()
+void tst_QFtp::commandSequence_data()
{
// some "constants"
QStringList argConnectToHost01;
@@ -1279,8 +1292,8 @@ void tst_QFtp::abort_data()
QTest::newRow( "get_fluke01" ) << QtNetworkSettings::serverName() << (uint)21 << QString("qtest/bigfile") << QByteArray();
QTest::newRow( "get_fluke02" ) << QtNetworkSettings::serverName() << (uint)21 << QString("qtest/rfc3252") << QByteArray();
- // Qt/CE test environment has to less memory for this test
-#if !defined(Q_OS_WINCE)
+ // Qt/CE and Symbian test environment has to less memory for this test
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QByteArray bigData( 10*1024*1024, 0 );
bigData.fill( 'B' );
@@ -1501,7 +1514,6 @@ void tst_QFtp::proxy()
void tst_QFtp::binaryAscii()
{
-
QString file = "asciifile%1.txt";
if(file.contains('%'))
@@ -1548,7 +1560,6 @@ void tst_QFtp::binaryAscii()
// (and do not remove the windows line ending), the -1 below could be
// deleted in the future
QVERIFY(getData.size() == putData.size()-1);
-
//////////////////////////////////////////////////////////////////
// cleanup (i.e. remove the file) -- this also tests the remove command
init();
@@ -2042,4 +2053,5 @@ void tst_QFtp::cdUpSlot(bool error)
}
QTEST_MAIN(tst_QFtp)
+
#include "tst_qftp.moc"
diff --git a/tests/auto/qgetputenv/qgetputenv.pro b/tests/auto/qgetputenv/qgetputenv.pro
index ed3eac9..cbde272 100644
--- a/tests/auto/qgetputenv/qgetputenv.pro
+++ b/tests/auto/qgetputenv/qgetputenv.pro
@@ -1,7 +1,3 @@
load(qttest_p4)
SOURCES += tst_qgetputenv.cpp
-
QT = core
-
-
-
diff --git a/tests/auto/qglobal/qglobal.pro b/tests/auto/qglobal/qglobal.pro
index 373061b..8f1e00a 100644
--- a/tests/auto/qglobal/qglobal.pro
+++ b/tests/auto/qglobal/qglobal.pro
@@ -1,6 +1,3 @@
load(qttest_p4)
-
SOURCES += tst_qglobal.cpp
QT = core
-
-
diff --git a/tests/auto/qglobal/tst_qglobal.cpp b/tests/auto/qglobal/tst_qglobal.cpp
index a299b13..58c7def 100644
--- a/tests/auto/qglobal/tst_qglobal.cpp
+++ b/tests/auto/qglobal/tst_qglobal.cpp
@@ -50,6 +50,8 @@ private slots:
void qInternalCallbacks();
void for_each();
void qassert();
+ void qtry();
+ void checkptr();
};
void tst_QGlobal::qIsNull()
@@ -190,5 +192,75 @@ void tst_QGlobal::qassert()
QVERIFY(passed);
}
+void tst_QGlobal::qtry()
+{
+ int i = 0;
+ QT_TRY {
+ i = 1;
+ QT_THROW(42);
+ i = 2;
+ } QT_CATCH(int) {
+ QCOMPARE(i, 1);
+ i = 7;
+ }
+#ifdef QT_NO_EXCEPTIONS
+ QCOMPARE(i, 2);
+#else
+ QCOMPARE(i, 7);
+#endif
+
+ // check propper if/else scoping
+ i = 0;
+ if (true)
+ QT_TRY {
+ i = 2;
+ QT_THROW(42);
+ i = 4;
+ } QT_CATCH(int) {
+ QCOMPARE(i, 2);
+ i = 4;
+ }
+ else
+ QCOMPARE(i, 0);
+ QCOMPARE(i, 4);
+
+ i = 0;
+ if (false)
+ QT_TRY {
+ i = 2;
+ QT_THROW(42);
+ i = 4;
+ } QT_CATCH(int) {
+ QCOMPARE(i, 2);
+ i = 2;
+ }
+ else
+ i = 8;
+ QCOMPARE(i, 8);
+
+ i = 0;
+ if (false)
+ i = 42;
+ else
+ QT_TRY {
+ i = 2;
+ QT_THROW(42);
+ i = 4;
+ } QT_CATCH(int) {
+ QCOMPARE(i, 2);
+ i = 4;
+ }
+ QCOMPARE(i, 4);
+}
+
+void tst_QGlobal::checkptr()
+{
+ int i;
+ QCOMPARE(q_check_ptr(&i), &i);
+
+ const char *c = "hello";
+ QCOMPARE(q_check_ptr(c), c);
+}
+
QTEST_MAIN(tst_QGlobal)
#include "tst_qglobal.moc"
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 10f0e42..7ff54f2 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -160,6 +160,7 @@ public slots:
void init();
private slots:
+ void explicitDeleteAutoFocusProxy();
void construction();
void constructionWithParent();
void destruction();
@@ -598,7 +599,7 @@ void tst_QGraphicsItem::destruction()
child->setParentItem(parent);
parent->setVisible(false);
scene->addItem(parent);
- QCOMPARE(child->parentItem(), parent);
+ QCOMPARE(child->parentItem(), static_cast<QGraphicsItem*>(parent));
delete scene;
QCOMPARE(itemDeleted, 110);
}
@@ -6669,7 +6670,7 @@ public:
QGraphicsRectItem::paint(painter, option, widget);
painter->drawText(boundingRect(), Qt::AlignCenter, QString("%1x%2\n%3x%4").arg(p.x()).arg(p.y()).arg(sp.x()).arg(sp.y()));
}
-
+
protected:
void hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
@@ -7020,7 +7021,7 @@ void tst_QGraphicsItem::setTransformProperties()
QCOMPARE_TRANSFORM(item1->sceneTransform(), item2->sceneTransform());
- QCOMPARE_TRANSFORM(item1->itemTransform(item2), QTransform());
+ QCOMPARE_TRANSFORM(item1->itemTransform(item2), QTransform());
QCOMPARE_TRANSFORM(item2->itemTransform(item1), QTransform());
}
}
@@ -7518,6 +7519,29 @@ void tst_QGraphicsItem::reverseCreateAutoFocusProxy()
QVERIFY(text2->hasFocus());
}
+void tst_QGraphicsItem::explicitDeleteAutoFocusProxy()
+{
+ QGraphicsTextItem *text = new QGraphicsTextItem;
+ text->setTextInteractionFlags(Qt::TextEditorInteraction);
+ text->setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy);
+
+ QGraphicsTextItem *text2 = new QGraphicsTextItem;
+ text2->setTextInteractionFlags(Qt::TextEditorInteraction);
+ text2->setFocus();
+ QVERIFY(!text2->hasFocus());
+ QCOMPARE(text->focusProxy(), (QGraphicsItem *)0);
+ text2->setParentItem(text);
+ QCOMPARE(text->focusProxy(), (QGraphicsItem *)text2);
+ QCOMPARE(text->focusItem(), (QGraphicsItem *)text2);
+
+ QGraphicsScene scene;
+ scene.addItem(text);
+ QVERIFY(text2->hasFocus());
+
+ delete text2;
+ QCOMPARE(text->focusProxy(), (QGraphicsItem *)0);
+}
+
void tst_QGraphicsItem::focusProxyDeletion()
{
QGraphicsRectItem *rect = new QGraphicsRectItem;
diff --git a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp
index 9bb615e..a2fdfd7 100644
--- a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp
+++ b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp
@@ -178,7 +178,7 @@ void tst_QGraphicsLayout::automaticReparenting()
QCOMPARE(w1->parentItem(), static_cast<QGraphicsItem*>(window));
QCOMPARE(w2->parentItem(), static_cast<QGraphicsItem*>(window));
- // Sublayouts
+ // Sublayouts
QGraphicsLinearLayout *l2 = new QGraphicsLinearLayout();
QGraphicsWidget *w3 = new QGraphicsWidget();
l2->addItem(w3);
@@ -212,7 +212,7 @@ void tst_QGraphicsLayout::automaticReparenting()
class TestLayout : public QGraphicsLinearLayout
{
public:
- TestLayout(QGraphicsLayoutItem *parent = 0)
+ TestLayout(QGraphicsLayoutItem *parent = 0)
: QGraphicsLinearLayout(parent)
{
m_count = 0;
@@ -224,7 +224,7 @@ class TestLayout : public QGraphicsLinearLayout
QGraphicsLinearLayout::setGeometry(rect);
}
-
+
int m_count;
};
@@ -320,9 +320,9 @@ public:
}
void setGeometry(const QRectF &geom);
-
+
QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const;
-
+
inline QGraphicsRectItem *rectItem() {
return static_cast<QGraphicsRectItem *>(graphicsItem());
}
@@ -354,20 +354,20 @@ QSizeF AnimatedLayoutItem::sizeHint(Qt::SizeHint which, const QSizeF &constraint
class AnimatedLayout : public QObject, public QGraphicsLinearLayout {
Q_OBJECT
public:
- AnimatedLayout(QGraphicsWidget *widget) : QGraphicsLinearLayout(widget), m_timeline(500, this)
+ AnimatedLayout(QGraphicsWidget *widget) : QGraphicsLinearLayout(widget), m_timeline(500, this)
{
connect(&m_timeline, SIGNAL(valueChanged(qreal)), this, SLOT(valueChanged(qreal)));
}
-
+
void setGeometry(const QRectF &geom) {
fromGeoms.clear();
toGeoms.clear();
for (int i = 0; i < count(); ++i) {
fromGeoms << itemAt(i)->geometry();
}
-
+
QGraphicsLinearLayout::setGeometry(geom);
-
+
for (int i = 0; i < count(); ++i) {
toGeoms << itemAt(i)->geometry();
}
@@ -380,13 +380,13 @@ private slots:
QGraphicsLayoutItem *li = itemAt(i);
QRectF from = fromGeoms.at(i);
QRectF to = toGeoms.at(i);
-
- QRectF geom(from.topLeft() + (to.topLeft() - from.topLeft()) * value,
+
+ QRectF geom(from.topLeft() + (to.topLeft() - from.topLeft()) * value,
from.size() + (to.size() - from.size()) * value);
static_cast<QGraphicsRectItem*>(li->graphicsItem())->setRect(geom);
}
}
-private:
+private:
QTimeLine m_timeline;
QVector<QRectF> fromGeoms;
QVector<QRectF> toGeoms;
@@ -407,7 +407,7 @@ void tst_QGraphicsLayout::alternativeLayoutItems()
QGraphicsRectItem *item1 = new QGraphicsRectItem;
AnimatedLayoutItem *li1 = new AnimatedLayoutItem(item1);
lout->addItem(li1);
-
+
QGraphicsRectItem *item2 = new QGraphicsRectItem;
AnimatedLayoutItem *li2 = new AnimatedLayoutItem(item2);
lout->addItem(li2);
@@ -417,7 +417,7 @@ void tst_QGraphicsLayout::alternativeLayoutItems()
lout->addItem(li3);
window->setLayout(lout);
-
+
window->setGeometry(0, 0, 99, 99);
view.setSceneRect(QRectF(-10, -10, 110, 110));
view.resize(150, 150);
@@ -426,11 +426,11 @@ void tst_QGraphicsLayout::alternativeLayoutItems()
QApplication::processEvents();
QTest::qWait(750);
QApplication::processEvents();
-
+
QCOMPARE(static_cast<QGraphicsRectItem*>(li1->graphicsItem())->rect(), QRectF( 0, 0, 33, 99));
QCOMPARE(static_cast<QGraphicsRectItem*>(li2->graphicsItem())->rect(), QRectF(33, 0, 33, 99));
QCOMPARE(static_cast<QGraphicsRectItem*>(li3->graphicsItem())->rect(), QRectF(66, 0, 33, 99));
-
+
lout->setOrientation(Qt::Vertical);
QApplication::processEvents();
@@ -439,7 +439,7 @@ void tst_QGraphicsLayout::alternativeLayoutItems()
QCOMPARE(static_cast<QGraphicsRectItem*>(li1->graphicsItem())->rect(), QRectF(0, 0, 99, 33));
QCOMPARE(static_cast<QGraphicsRectItem*>(li2->graphicsItem())->rect(), QRectF(0, 33, 99, 33));
QCOMPARE(static_cast<QGraphicsRectItem*>(li3->graphicsItem())->rect(), QRectF(0, 66, 99, 33));
-
+
}
class CustomLayoutItem : public QGraphicsLayoutItem {
@@ -451,8 +451,8 @@ public:
setOwnedByLayout(true);
}
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const;
-
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const;
+
~CustomLayoutItem() {
m_destructedSet->insert(this);
}
@@ -482,8 +482,8 @@ public:
m_destructedSet = destructedSet;
}
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const;
-
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const;
+
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget * = 0)
{
const QRect r = option->rect.adjusted(0, 0, -1, -1);
@@ -565,7 +565,7 @@ void insertItem(int index, QGraphicsLayoutItem *item)
QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item);
updateParentWidget(widget);
-
+
if (index == items.count()) {
items.append(item);
@@ -613,7 +613,7 @@ void tst_QGraphicsLayout::ownership()
CustomLayoutItem *li3 = new CustomLayoutItem(&destructedSet);
lay->addItem(li3);
destructedSet.clear();
-
+
delete lay;
QSet<QGraphicsLayoutItem*> expected;
expected << li1 << li2 << li3;
@@ -642,10 +642,10 @@ void tst_QGraphicsLayout::ownership()
{
QGraphicsWidget *window = new QGraphicsWidget(0, Qt::Window);
QGraphicsLinearLayout *lay = new QGraphicsLinearLayout;
-
+
CustomGraphicsWidget *li1 = new CustomGraphicsWidget;
lay->addItem(li1);
-
+
QGraphicsLinearLayout *li2 = new QGraphicsLinearLayout;
CustomGraphicsWidget *li2_1 = new CustomGraphicsWidget;
li2->addItem(li2_1);
@@ -654,25 +654,25 @@ void tst_QGraphicsLayout::ownership()
CustomGraphicsWidget *li2_3 = new CustomGraphicsWidget;
li2->addItem(li2_3);
lay->addItem(li2);
-
+
CustomGraphicsWidget *li3 = new CustomGraphicsWidget;
lay->addItem(li3);
-
+
window->setLayout(lay);
scene.addItem(window);
view.resize(500, 200);
view.show();
-
+
for (int i = li2->count(); i > 0; --i) {
QCOMPARE(li2->count(), i);
delete li2->itemAt(0);
}
-
+
for (int i = lay->count(); i > 0; --i) {
QCOMPARE(lay->count(), i);
delete lay->itemAt(0);
}
-
+
delete window;
}
diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index 5a1a83a..7536855 100644
--- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -3189,7 +3189,7 @@ void tst_QGraphicsProxyWidget::windowFlags()
QVERIFY((widget->windowFlags() & widgetWFlags) == widgetWFlags);
proxy.setWidget(widget);
-
+
if (resultingProxyFlags == 0)
QVERIFY(!proxy.windowFlags());
else
diff --git a/tests/auto/qgraphicsscene/qgraphicsscene.pro b/tests/auto/qgraphicsscene/qgraphicsscene.pro
index b8a5c8f..31bb769 100644
--- a/tests/auto/qgraphicsscene/qgraphicsscene.pro
+++ b/tests/auto/qgraphicsscene/qgraphicsscene.pro
@@ -3,15 +3,18 @@ SOURCES += tst_qgraphicsscene.cpp
RESOURCES += images.qrc
win32:!wince*: LIBS += -lUser32
-!wince*:DEFINES += SRCDIR=\\\"$$PWD\\\"
+!wince*:!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\"
DEFINES += QT_NO_CAST_TO_ASCII
-wince*: {
- DEFINES += SRCDIR=\\\".\\\"
+wince*|symbian*: {
rootFiles.sources = Ash_European.jpg graphicsScene_selection.data
rootFiles.path = .
renderFiles.sources = testData\render\*
renderFiles.path = testData\render
DEPLOYMENT += rootFiles renderFiles
}
+wince*:{
+ DEFINES += SRCDIR=\\\".\\\"
+}
+symbian:TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb"
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index 147bb2b..94f215d 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -58,6 +58,12 @@
#define Q_CHECK_PAINTEVENTS
#endif
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+// Current path (C:\private\<UID>) contains only ascii chars
+#define SRCDIR QDir::currentPath().append("\\").toAscii()
+#endif
+
//TESTED_CLASS=
//TESTED_FILES=
@@ -228,9 +234,11 @@ private slots:
void mouseEventPropagation_focus();
void mouseEventPropagation_doubleclick();
void mouseEventPropagation_mouseMove();
+#ifndef QT_NO_DRAGANDDROP
void dragAndDrop_simple();
void dragAndDrop_disabledOrInvisible();
void dragAndDrop_propagate();
+#endif
void render_data();
void render();
void contextMenuEvent();
@@ -2232,6 +2240,7 @@ private:
}
};
+#ifndef QT_NO_DRAGANDDROP
void tst_QGraphicsScene::dragAndDrop_simple()
{
DndTester *item = new DndTester(QRectF(-10, -10, 20, 20));
@@ -2521,6 +2530,7 @@ void tst_QGraphicsScene::dragAndDrop_propagate()
QDropEvent dropEvent(QPoint(0, 0), Qt::CopyAction, &mimeData, Qt::LeftButton, 0);
QApplication::sendEvent(view.viewport(), &dropEvent);
}
+#endif
void tst_QGraphicsScene::render_data()
{
diff --git a/tests/auto/qgraphicsview/qgraphicsview.pro b/tests/auto/qgraphicsview/qgraphicsview.pro
index 5562f19..5e7e53d 100644
--- a/tests/auto/qgraphicsview/qgraphicsview.pro
+++ b/tests/auto/qgraphicsview/qgraphicsview.pro
@@ -2,4 +2,4 @@ load(qttest_p4)
SOURCES += tst_qgraphicsview.cpp tst_qgraphicsview_2.cpp
DEFINES += QT_NO_CAST_TO_ASCII
-
+symbian:TARGET.EPOCHEAPSIZE = 1000000 10000000
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 2506e70..505f9a4 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -1362,7 +1362,7 @@ void tst_QGraphicsView::itemsInRect_cosmeticAdjust()
{
QFETCH(QRect, updateRect);
QFETCH(int, numPaints);
-
+
QGraphicsScene scene(-100, -100, 200, 200);
CountPaintItem *rect = new CountPaintItem(QRectF(-50, -50, 100, 100));
scene.addItem(rect);
@@ -2288,6 +2288,9 @@ void tst_QGraphicsView::viewportUpdateMode2()
void tst_QGraphicsView::acceptDrops()
{
+#ifdef QT_NO_DRAGANDDROP
+ QSKIP("Drag'n drop disabled in this build", SkipAll);
+#else
QGraphicsView view;
// Excepted default behavior.
@@ -2321,6 +2324,7 @@ void tst_QGraphicsView::acceptDrops()
// Switching the view to not accept drops.
view.setAcceptDrops(false);
QVERIFY(!view.viewport()->acceptDrops());
+#endif
}
void tst_QGraphicsView::optimizationFlags()
@@ -2389,7 +2393,7 @@ void tst_QGraphicsView::optimizationFlags_dontSavePainterState()
MessUpPainterItem *parent = new MessUpPainterItem(QRectF(0, 0, 100, 100));
MessUpPainterItem *child = new MessUpPainterItem(QRectF(0, 0, 100, 100));
child->setParentItem(parent);
-
+
QGraphicsScene scene;
scene.addItem(parent);
@@ -2528,7 +2532,7 @@ void tst_QGraphicsView::scrollBarRanges()
QSKIP("No Motif style compiled.", SkipSingle);
#endif
} else {
-#if defined(Q_OS_WINCE)
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
view.setStyle(new QWindowsStyle);
#elif !defined(QT_NO_STYLE_PLASTIQUE)
view.setStyle(new QPlastiqueStyle);
@@ -3261,7 +3265,9 @@ void tst_QGraphicsView::mouseTracking()
QGraphicsView view(&scene);
QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10);
+#ifndef QT_NO_CURSOR
item->setCursor(Qt::CrossCursor);
+#endif
scene.addItem(item);
QVERIFY(view.viewport()->hasMouseTracking());
}
@@ -3269,7 +3275,9 @@ void tst_QGraphicsView::mouseTracking()
// Adding an item to the scene before the scene is set on the view.
QGraphicsScene scene(-10000, -10000, 20000, 20000);
QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10);
+#ifndef QT_NO_CURSOR
item->setCursor(Qt::CrossCursor);
+#endif
scene.addItem(item);
QGraphicsView view(&scene);
@@ -3284,7 +3292,9 @@ void tst_QGraphicsView::mouseTracking()
QGraphicsView view3(&scene);
QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10);
+#ifndef QT_NO_CURSOR
item->setCursor(Qt::CrossCursor);
+#endif
scene.addItem(item);
QVERIFY(view1.viewport()->hasMouseTracking());
@@ -3334,7 +3344,7 @@ public:
QGraphicsRectItem::paint(painter, option, widget);
++paints;
}
-
+
int paints;
};
diff --git a/tests/auto/qgroupbox/tst_qgroupbox.cpp b/tests/auto/qgroupbox/tst_qgroupbox.cpp
index 632ffe1..f82fd38 100644
--- a/tests/auto/qgroupbox/tst_qgroupbox.cpp
+++ b/tests/auto/qgroupbox/tst_qgroupbox.cpp
@@ -119,8 +119,8 @@ void tst_QGroupBox::setCheckable_data()
{
QTest::addColumn<bool>("checkable");
QTest::addColumn<bool>("expectedCheckable");
- QTest::newRow( "checkable_true" ) << TRUE << TRUE;
- QTest::newRow( "checkable_false" ) << FALSE << FALSE;
+ QTest::newRow( "checkable_true" ) << true << true;
+ QTest::newRow( "checkable_false" ) << false << false;
}
void tst_QGroupBox::setChecked_data()
@@ -128,9 +128,9 @@ void tst_QGroupBox::setChecked_data()
QTest::addColumn<bool>("checkable");
QTest::addColumn<bool>("checked");
QTest::addColumn<bool>("expectedChecked");
- QTest::newRow( "checkable_false_checked_true" ) << FALSE << TRUE << FALSE;
- QTest::newRow( "checkable_true_checked_true" ) << TRUE << TRUE << TRUE;
- QTest::newRow( "checkable_true_checked_false" ) << TRUE << FALSE << FALSE;
+ QTest::newRow( "checkable_false_checked_true" ) << false << true << false;
+ QTest::newRow( "checkable_true_checked_true" ) << true << true << true;
+ QTest::newRow( "checkable_true_checked_false" ) << true << false << false;
}
void tst_QGroupBox::setTitle()
@@ -173,116 +173,116 @@ void tst_QGroupBox::setChecked()
void tst_QGroupBox::enabledPropagation()
{
QGroupBox *testWidget = new QGroupBox(0);
- testWidget->setCheckable(TRUE);
- testWidget->setChecked(TRUE);
+ testWidget->setCheckable(true);
+ testWidget->setChecked(true);
QWidget* childWidget = new QWidget( testWidget );
childWidget->show();
QVERIFY( testWidget->isEnabled() );
QVERIFY( childWidget->isEnabled() );
- testWidget->setEnabled( FALSE );
+ testWidget->setEnabled( false );
QVERIFY( !testWidget->isEnabled() );
QVERIFY( !childWidget->isEnabled() );
- testWidget->setDisabled( FALSE );
+ testWidget->setDisabled( false );
QVERIFY( testWidget->isEnabled() );
QVERIFY( childWidget->isEnabled() );
QWidget* grandChildWidget = new QWidget( childWidget );
QVERIFY( grandChildWidget->isEnabled() );
- testWidget->setDisabled( TRUE );
+ testWidget->setDisabled( true );
QVERIFY( !testWidget->isEnabled() );
QVERIFY( !childWidget->isEnabled() );
QVERIFY( !grandChildWidget->isEnabled() );
- grandChildWidget->setEnabled( FALSE );
- testWidget->setEnabled( TRUE );
+ grandChildWidget->setEnabled( false );
+ testWidget->setEnabled( true );
QVERIFY( testWidget->isEnabled() );
QVERIFY( childWidget->isEnabled() );
QVERIFY( !grandChildWidget->isEnabled() );
- grandChildWidget->setEnabled( TRUE );
- testWidget->setEnabled( FALSE );
- childWidget->setDisabled( TRUE );
- testWidget->setEnabled( TRUE );
+ grandChildWidget->setEnabled( true );
+ testWidget->setEnabled( false );
+ childWidget->setDisabled( true );
+ testWidget->setEnabled( true );
QVERIFY( testWidget->isEnabled() );
QVERIFY( !childWidget->isEnabled() );
QVERIFY( !grandChildWidget->isEnabled() );
// Reset state
- testWidget->setEnabled( TRUE );
- childWidget->setEnabled( TRUE );
- grandChildWidget->setEnabled( TRUE );
+ testWidget->setEnabled( true );
+ childWidget->setEnabled( true );
+ grandChildWidget->setEnabled( true );
// Now check when it's disabled
- testWidget->setChecked(FALSE);
+ testWidget->setChecked(false);
QVERIFY( testWidget->isEnabled() );
QVERIFY( !childWidget->isEnabled() );
- testWidget->setEnabled( FALSE );
+ testWidget->setEnabled( false );
QVERIFY( !testWidget->isEnabled() );
QVERIFY( !childWidget->isEnabled() );
- testWidget->setDisabled( FALSE );
+ testWidget->setDisabled( false );
QVERIFY( testWidget->isEnabled() );
QVERIFY( !childWidget->isEnabled() );
QVERIFY( !grandChildWidget->isEnabled() );
- testWidget->setDisabled( TRUE );
+ testWidget->setDisabled( true );
QVERIFY( !testWidget->isEnabled() );
QVERIFY( !childWidget->isEnabled() );
QVERIFY( !grandChildWidget->isEnabled() );
- grandChildWidget->setEnabled( FALSE );
- testWidget->setEnabled( TRUE );
+ grandChildWidget->setEnabled( false );
+ testWidget->setEnabled( true );
QVERIFY( testWidget->isEnabled() );
QVERIFY( !childWidget->isEnabled() );
QVERIFY( !grandChildWidget->isEnabled() );
- grandChildWidget->setEnabled( TRUE );
- testWidget->setEnabled( FALSE );
- childWidget->setDisabled( TRUE );
- testWidget->setEnabled( TRUE );
+ grandChildWidget->setEnabled( true );
+ testWidget->setEnabled( false );
+ childWidget->setDisabled( true );
+ testWidget->setEnabled( true );
QVERIFY( testWidget->isEnabled() );
QVERIFY( !childWidget->isEnabled() );
QVERIFY( !grandChildWidget->isEnabled() );
// Reset state
- testWidget->setEnabled( TRUE );
- childWidget->setEnabled( TRUE );
- grandChildWidget->setEnabled( TRUE );
+ testWidget->setEnabled( true );
+ childWidget->setEnabled( true );
+ grandChildWidget->setEnabled( true );
// Finally enable it again
- testWidget->setChecked(TRUE);
+ testWidget->setChecked(true);
QVERIFY( testWidget->isEnabled() );
QVERIFY( childWidget->isEnabled() );
- testWidget->setEnabled( FALSE );
+ testWidget->setEnabled( false );
QVERIFY( !testWidget->isEnabled() );
QVERIFY( !childWidget->isEnabled() );
- testWidget->setDisabled( FALSE );
+ testWidget->setDisabled( false );
QVERIFY( testWidget->isEnabled() );
QVERIFY( childWidget->isEnabled() );
QVERIFY( grandChildWidget->isEnabled() );
- testWidget->setDisabled( TRUE );
+ testWidget->setDisabled( true );
QVERIFY( !testWidget->isEnabled() );
QVERIFY( !childWidget->isEnabled() );
QVERIFY( !grandChildWidget->isEnabled() );
- grandChildWidget->setEnabled( FALSE );
- testWidget->setEnabled( TRUE );
+ grandChildWidget->setEnabled( false );
+ testWidget->setEnabled( true );
QVERIFY( testWidget->isEnabled() );
QVERIFY( childWidget->isEnabled() );
QVERIFY( !grandChildWidget->isEnabled() );
- grandChildWidget->setEnabled( TRUE );
- testWidget->setEnabled( FALSE );
- childWidget->setDisabled( TRUE );
- testWidget->setEnabled( TRUE );
+ grandChildWidget->setEnabled( true );
+ testWidget->setEnabled( false );
+ childWidget->setDisabled( true );
+ testWidget->setEnabled( true );
QVERIFY( testWidget->isEnabled() );
QVERIFY( !childWidget->isEnabled() );
QVERIFY( !grandChildWidget->isEnabled() );
@@ -467,7 +467,7 @@ void tst_QGroupBox::propagateFocus()
box.show();
box.setFocus();
QTest::qWait(250);
- QCOMPARE(qApp->focusWidget(), &lineEdit);
+ QCOMPARE(qApp->focusWidget(), static_cast<QWidget*>(&lineEdit));
}
QTEST_MAIN(tst_QGroupBox)
diff --git a/tests/auto/qhash/qhash.pro b/tests/auto/qhash/qhash.pro
index 1c60fc2..6fedb82 100644
--- a/tests/auto/qhash/qhash.pro
+++ b/tests/auto/qhash/qhash.pro
@@ -1,7 +1,8 @@
load(qttest_p4)
SOURCES += tst_qhash.cpp
-
-
QT = core
-
+symbian*: {
+TARGET.EPOCSTACKSIZE =0x5000
+TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb"
+}
diff --git a/tests/auto/qhash/tst_qhash.cpp b/tests/auto/qhash/tst_qhash.cpp
index 8ec6d1d..b5db59d 100644
--- a/tests/auto/qhash/tst_qhash.cpp
+++ b/tests/auto/qhash/tst_qhash.cpp
@@ -692,7 +692,7 @@ void tst_QHash::operator_eq()
QVERIFY(a == b);
QVERIFY(!(a != b));
-
+
a.insert(1,1);
b.insert(1,1);
QVERIFY(a == b);
@@ -714,7 +714,7 @@ void tst_QHash::operator_eq()
b.insert(-1, -1);
QVERIFY(a != b);
- QVERIFY(!(a == b));
+ QVERIFY(!(a == b));
}
{
@@ -760,7 +760,7 @@ void tst_QHash::operator_eq()
b.insert("willy", 1);
QVERIFY(a != b);
QVERIFY(!(a == b));
- }
+ }
}
void tst_QHash::compare()
@@ -974,7 +974,7 @@ void tst_QHash::rehash_isnt_quadratic()
// this test should be incredibly slow if rehash() is quadratic
for (int j = 0; j < 5; ++j) {
QHash<int, int> testHash;
-#if defined(Q_OS_WINCE)
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) // mobiles do not have infinite mem...
for (int i = 0; i < 50000; ++i)
#else
for (int i = 0; i < 500000; ++i)
diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp
index abe49df..1071f0b 100644
--- a/tests/auto/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp
@@ -87,11 +87,14 @@
# endif
#endif
+#include "../network-settings.h"
+
//TESTED_CLASS=
//TESTED_FILES=
const char * const lupinellaIp = "10.3.4.6";
+
class tst_QHostInfo : public QObject
{
Q_OBJECT
@@ -160,6 +163,7 @@ void tst_QHostInfo::staticInformation()
tst_QHostInfo::tst_QHostInfo()
{
+ Q_SET_DEFAULT_IAP
}
tst_QHostInfo::~tst_QHostInfo()
@@ -212,11 +216,18 @@ void tst_QHostInfo::lookupIPv4_data()
QTest::addColumn<QString>("addresses");
QTest::addColumn<int>("err");
+#ifdef Q_OS_SYMBIAN
+ // Test server lookup
+ QTest::newRow("lookup_01") << QtNetworkSettings::serverName() << QtNetworkSettings::serverIP().toString() << int(QHostInfo::NoError);
+ QTest::newRow("literal_ip4") << QtNetworkSettings::serverIP().toString() << QtNetworkSettings::serverIP().toString() << int(QHostInfo::NoError);
+ QTest::newRow("multiple_ip4") << "multi.dev.troll.no" << "1.2.3.4 1.2.3.5 10.3.3.31" << int(QHostInfo::NoError);
+#else
QTest::newRow("empty") << "" << "" << int(QHostInfo::HostNotFound);
QTest::newRow("single_ip4") << "lupinella.troll.no" << lupinellaIp << int(QHostInfo::NoError);
QTest::newRow("multiple_ip4") << "multi.dev.troll.no" << "1.2.3.4 1.2.3.5 10.3.3.31" << int(QHostInfo::NoError);
QTest::newRow("literal_ip4") << lupinellaIp << lupinellaIp << int(QHostInfo::NoError);
+#endif
QTest::newRow("notfound") << "this-name-does-not-exist-hopefully." << "" << int(QHostInfo::HostNotFound);
QTest::newRow("idn-ace") << "xn--alqualond-34a.troll.no" << "10.3.3.55" << int(QHostInfo::NoError);
@@ -302,7 +313,7 @@ void tst_QHostInfo::reverseLookup_data()
// ### Use internal DNS instead. Discussed with Andreas.
//QTest::newRow("classical.hexago.com") << QString("2001:5c0:0:2::24") << QStringList(QString("classical.hexago.com")) << 0;
- QTest::newRow("www.cisco.com") << QString("198.133.219.25") << QStringList(QString("origin-www.cisco.com")) << 0;
+ QTest::newRow("origin.cisco.com") << QString("12.159.148.94") << QStringList(QString("origin.cisco.com")) << 0;
QTest::newRow("bogus-name") << QString("1::2::3::4") << QStringList() << 1;
}
@@ -380,10 +391,10 @@ protected:
void tst_QHostInfo::threadSafety()
{
const int nattempts = 5;
-#if !defined(Q_OS_WINCE)
- const int runs = 100;
-#else
+#if defined(Q_OS_WINCE)
const int runs = 10;
+#else
+ const int runs = 100;
#endif
LookupThread thr[nattempts];
for (int j = 0; j < runs; ++j) {
diff --git a/tests/auto/qhttp/qhttp.pro b/tests/auto/qhttp/qhttp.pro
index 9c2f5cb..8678a19 100644
--- a/tests/auto/qhttp/qhttp.pro
+++ b/tests/auto/qhttp/qhttp.pro
@@ -13,6 +13,14 @@ wince*: {
addFiles.path = .
DEPLOYMENT = addFiles webFiles cgi
DEFINES += SRCDIR=\\\"\\\"
+} else:symbian* {
+ webFiles.sources = webserver/*
+ webFiles.path = webserver
+ cgi.sources = webserver/cgi-bin/*
+ cgi.path = webserver/cgi-bin
+ addFiles.sources = rfc3252.txt trolltech
+ addFiles.path = .
+ DEPLOYMENT = addFiles webFiles cgi
} else:vxworks*: {
DEFINES += SRCDIR=\\\"\\\"
} else {
diff --git a/tests/auto/qhttp/tst_qhttp.cpp b/tests/auto/qhttp/tst_qhttp.cpp
index 4fcf107..fcc80ab 100644
--- a/tests/auto/qhttp/tst_qhttp.cpp
+++ b/tests/auto/qhttp/tst_qhttp.cpp
@@ -57,11 +57,20 @@
# include <qsslsocket.h>
#endif
+#ifndef TEST_QNETWORK_PROXY
+#define TEST_QNETWORK_PROXY
+#endif
#include "../network-settings.h"
//TESTED_CLASS=
//TESTED_FILES=
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+// And underlying Open C have application private dir in default search path
+#define SRCDIR ""
+#endif
+
Q_DECLARE_METATYPE(QHttpResponseHeader)
class tst_QHttp : public QObject
@@ -140,9 +149,9 @@ private:
struct RequestResult
{
- QHttpRequestHeader req;
- QHttpResponseHeader resp;
- int success;
+ QHttpRequestHeader req;
+ QHttpResponseHeader resp;
+ int success;
};
QMap< int, RequestResult > resultMap;
typedef QMap<int,RequestResult>::Iterator ResMapIt;
@@ -176,6 +185,7 @@ const int bytesDone_init = -10;
tst_QHttp::tst_QHttp()
{
+ Q_SET_DEFAULT_IAP
}
tst_QHttp::~tst_QHttp()
@@ -188,7 +198,9 @@ void tst_QHttp::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
+#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
+#endif
}
void tst_QHttp::initTestCase()
@@ -344,47 +356,47 @@ void tst_QHttp::get()
addRequest( QHttpRequestHeader(), http->setHost( host, port ) );
if ( useIODevice ) {
- buf.open( QIODevice::WriteOnly );
- getId = http->get( path, &buf );
+ buf.open( QIODevice::WriteOnly );
+ getId = http->get( path, &buf );
} else {
- getId = http->get( path );
+ getId = http->get( path );
}
addRequest( QHttpRequestHeader(), getId );
QTestEventLoop::instance().enterLoop( 30 );
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( "Network operation timed out" );
ResMapIt res = resultMap.find( getId );
QVERIFY( res != resultMap.end() );
if ( res.value().success!=1 && host=="www.ietf.org" ) {
- // The nightly tests fail from time to time. In order to make them more
- // stable, add some debug output that might help locate the problem (I
- // can't reproduce the problem in the non-nightly builds).
- qDebug( "Error %d: %s", http->error(), http->errorString().toLatin1().constData() );
+ // The nightly tests fail from time to time. In order to make them more
+ // stable, add some debug output that might help locate the problem (I
+ // can't reproduce the problem in the non-nightly builds).
+ qDebug( "Error %d: %s", http->error(), http->errorString().toLatin1().constData() );
}
QTEST( res.value().success, "success" );
if ( res.value().success ) {
- QTEST( res.value().resp.statusCode(), "statusCode" );
-
- QFETCH( QByteArray, res );
- if ( res.count() > 0 ) {
- if ( useIODevice ) {
- QCOMPARE(buf_ba, res);
- if ( bytesDoneRead != bytesDone_init )
- QVERIFY( (int)buf_ba.size() == bytesDoneRead );
- } else {
- QCOMPARE(readyRead_ba, res);
- if ( bytesDoneRead != bytesDone_init )
- QVERIFY( (int)readyRead_ba.size() == bytesDoneRead );
- }
- }
- QVERIFY( bytesTotalRead != bytesTotal_init );
- if ( bytesTotalRead > 0 )
- QVERIFY( bytesDoneRead == bytesTotalRead );
+ QTEST( res.value().resp.statusCode(), "statusCode" );
+
+ QFETCH( QByteArray, res );
+ if ( res.count() > 0 ) {
+ if ( useIODevice ) {
+ QCOMPARE(buf_ba, res);
+ if ( bytesDoneRead != bytesDone_init )
+ QVERIFY( (int)buf_ba.size() == bytesDoneRead );
+ } else {
+ QCOMPARE(readyRead_ba, res);
+ if ( bytesDoneRead != bytesDone_init )
+ QVERIFY( (int)readyRead_ba.size() == bytesDoneRead );
+ }
+ }
+ QVERIFY( bytesTotalRead != bytesTotal_init );
+ if ( bytesTotalRead > 0 )
+ QVERIFY( bytesDoneRead == bytesTotalRead );
} else {
- QVERIFY( !res.value().resp.isValid() );
+ QVERIFY( !res.value().resp.isValid() );
}
}
@@ -399,19 +411,22 @@ void tst_QHttp::head_data()
QTest::newRow( "path_01" ) << QtNetworkSettings::serverName() << 80u
<< QString("/qtest/rfc3252.txt") << 1 << 200 << 25962u;
+
QTest::newRow( "path_02" ) << QString("www.ietf.org") << 80u
<< QString("/rfc/rfc3252.txt") << 1 << 200 << 25962u;
QTest::newRow( "uri_01" ) << QtNetworkSettings::serverName() << 80u
<< QString("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt") << 1 << 200 << 25962u;
+
QTest::newRow( "uri_02" ) << QString("www.ietf.org") << 80u
- << QString("http://www.ietf.org/rfc/rfc3252.txt") << 1 << 200 << 25962u;
+ << QString("http://www.ietf.org/rfc/rfc3252.txt") << 1 << 200 << 25962u;
QTest::newRow( "fail_01" ) << QString("this-host-will-not-exist.") << 80u
- << QString("/qtest/rfc3252.txt") << 0 << 0 << 0u;
+ << QString("/qtest/rfc3252.txt") << 0 << 0 << 0u;
QTest::newRow( "failprot_01" ) << QtNetworkSettings::serverName() << 80u
<< QString("/t") << 1 << 404 << 0u;
+
QTest::newRow( "failprot_02" ) << QtNetworkSettings::serverName() << 80u
<< QString("qtest/rfc3252.txt") << 1 << 400 << 0u;
@@ -464,7 +479,7 @@ void tst_QHttp::head()
void tst_QHttp::post_data()
{
- QTest::addColumn<QString>("source");
+ QTest::addColumn<QString>("source");
QTest::addColumn<bool>("useIODevice");
QTest::addColumn<bool>("useProxy");
QTest::addColumn<QString>("host");
@@ -505,7 +520,7 @@ void tst_QHttp::post_data()
void tst_QHttp::post()
{
- QFETCH(QString, source);
+ QFETCH(QString, source);
QFETCH(bool, useIODevice);
QFETCH(bool, useProxy);
QFETCH(QString, host);
@@ -543,7 +558,7 @@ void tst_QHttp::post()
QTestEventLoop::instance().enterLoop( 30 );
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( "Network operation timed out" );
ResMapIt res = resultMap.find(postId);
QVERIFY(res != resultMap.end());
@@ -602,7 +617,6 @@ void tst_QHttp::request_data()
QTest::newRow("proxy-post-data") << "rfc3252.txt" << false << true
<< QtNetworkSettings::serverName() << 80 << "POST" << "/qtest/cgi-bin/md5sum.cgi"
<< md5sum;
-
// the following test won't work. See task 185996
/*
QTest::newRow("proxy-post-device") << "rfc3252.txt" << true << true
@@ -667,7 +681,7 @@ void tst_QHttp::request()
QTestEventLoop::instance().enterLoop( 30 );
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( "Network operation timed out" );
ResMapIt res = resultMap.find(*theId);
QVERIFY(res != resultMap.end());
@@ -777,7 +791,7 @@ void tst_QHttp::proxy()
QTestEventLoop::instance().enterLoop(30);
if (QTestEventLoop::instance().timeout())
- QFAIL("Network operation timed out");
+ QFAIL("Network operation timed out");
ResMapIt res = resultMap.find(getId);
QVERIFY(res != resultMap.end());
@@ -847,17 +861,17 @@ void tst_QHttp::proxy3()
// test QHttp::currentId() and QHttp::currentRequest()
#define CURRENTREQUEST_TEST \
{ \
- ResMapIt res = resultMap.find( http->currentId() ); \
- QVERIFY( res != resultMap.end() ); \
- if ( http->currentId() == getId ) { \
- QCOMPARE( http->currentRequest().method(), QString("GET") ); \
- } else if ( http->currentId() == headId ) { \
- QCOMPARE( http->currentRequest().method(), QString("HEAD") ); \
+ ResMapIt res = resultMap.find( http->currentId() ); \
+ QVERIFY( res != resultMap.end() ); \
+ if ( http->currentId() == getId ) { \
+ QCOMPARE( http->currentRequest().method(), QString("GET") ); \
+ } else if ( http->currentId() == headId ) { \
+ QCOMPARE( http->currentRequest().method(), QString("HEAD") ); \
} else if ( http->currentId() == postId ) { \
QCOMPARE( http->currentRequest().method(), QString("POST") ); \
- } else { \
- QVERIFY( headerAreEqual( http->currentRequest(), res.value().req ) ); \
- } \
+ } else { \
+ QVERIFY( headerAreEqual( http->currentRequest(), res.value().req ) ); \
+ } \
}
void tst_QHttp::requestStarted( int id )
@@ -872,9 +886,9 @@ void tst_QHttp::requestStarted( int id )
QVERIFY( !ids.isEmpty() );
QVERIFY( ids.first() == id );
if ( ids.count() > 1 ) {
- QVERIFY( http->hasPendingRequests() );
+ QVERIFY( http->hasPendingRequests() );
} else {
- QVERIFY( !http->hasPendingRequests() );
+ QVERIFY( !http->hasPendingRequests() );
}
QVERIFY( http->currentId() == id );
@@ -892,7 +906,7 @@ void tst_QHttp::requestFinished( int id, bool error )
{
#if defined( DUMP_SIGNALS )
qDebug( "%d:requestFinished( %d, %d ) -- errorString: '%s'",
- http->currentId(), id, (int)error, http->errorString().latin1() );
+ http->currentId(), id, (int)error, http->errorString().toAscii().data() );
#endif
// make sure that the requestStarted and requestFinished are nested correctly
QVERIFY( current_id == id );
@@ -901,17 +915,17 @@ void tst_QHttp::requestFinished( int id, bool error )
QVERIFY( !ids.isEmpty() );
QVERIFY( ids.first() == id );
if ( ids.count() > 1 ) {
- QVERIFY( http->hasPendingRequests() );
+ QVERIFY( http->hasPendingRequests() );
} else {
- QVERIFY( !http->hasPendingRequests() );
+ QVERIFY( !http->hasPendingRequests() );
}
if ( error ) {
- QVERIFY( http->error() != QHttp::NoError );
- ids.clear();
+ QVERIFY( http->error() != QHttp::NoError );
+ ids.clear();
} else {
- QVERIFY( http->error() == QHttp::NoError );
- ids.pop_front();
+ QVERIFY( http->error() == QHttp::NoError );
+ ids.pop_front();
}
QVERIFY( http->currentId() == id );
@@ -922,9 +936,9 @@ void tst_QHttp::requestFinished( int id, bool error )
QVERIFY( res != resultMap.end() );
QVERIFY( res.value().success == -1 );
if ( error )
- res.value().success = 0;
+ res.value().success = 0;
else
- res.value().success = 1;
+ res.value().success = 1;
}
void tst_QHttp::done( bool error )
@@ -940,11 +954,11 @@ void tst_QHttp::done( bool error )
QVERIFY( done_success == -1 );
if ( error ) {
- QVERIFY( http->error() != QHttp::NoError );
- done_success = 0;
+ QVERIFY( http->error() != QHttp::NoError );
+ done_success = 0;
} else {
- QVERIFY( http->error() == QHttp::NoError );
- done_success = 1;
+ QVERIFY( http->error() == QHttp::NoError );
+ done_success = 1;
}
QTestEventLoop::instance().exitLoop();
}
@@ -956,14 +970,14 @@ void tst_QHttp::stateChanged( int state )
#endif
QCOMPARE( http->currentId(), current_id );
if ( ids.count() > 0 )
- CURRENTREQUEST_TEST;
+ CURRENTREQUEST_TEST;
QVERIFY( state != cur_state );
QVERIFY( state == http->state() );
if ( state != QHttp::Unconnected && !connectionWithAuth ) {
- // make sure that the states are always emitted in the right order (for
- // this, we assume an ordering on the enum values, which they have at
- // the moment)
+ // make sure that the states are always emitted in the right order (for
+ // this, we assume an ordering on the enum values, which they have at
+ // the moment)
// connections with authentication will possibly reconnect, so ignore them
QVERIFY( cur_state < state );
}
@@ -980,13 +994,13 @@ void tst_QHttp::stateChanged( int state )
void tst_QHttp::responseHeaderReceived( const QHttpResponseHeader &header )
{
#if defined( DUMP_SIGNALS )
- qDebug( "%d: responseHeaderReceived(\n---{\n%s}---)", http->currentId(), header.toString().latin1() );
+ qDebug( "%d: responseHeaderReceived(\n---{\n%s}---)", http->currentId(), header.toString().toAscii().data() );
#endif
QCOMPARE( http->currentId(), current_id );
if ( ids.count() > 1 ) {
- QVERIFY( http->hasPendingRequests() );
+ QVERIFY( http->hasPendingRequests() );
} else {
- QVERIFY( !http->hasPendingRequests() );
+ QVERIFY( !http->hasPendingRequests() );
}
CURRENTREQUEST_TEST;
@@ -1000,25 +1014,25 @@ void tst_QHttp::readyRead( const QHttpResponseHeader & )
#endif
QCOMPARE( http->currentId(), current_id );
if ( ids.count() > 1 ) {
- QVERIFY( http->hasPendingRequests() );
+ QVERIFY( http->hasPendingRequests() );
} else {
- QVERIFY( !http->hasPendingRequests() );
+ QVERIFY( !http->hasPendingRequests() );
}
QVERIFY( cur_state == http->state() );
CURRENTREQUEST_TEST;
if ( QTest::currentTestFunction() != QLatin1String("bytesAvailable") ) {
- int oldSize = readyRead_ba.size();
- quint64 bytesAvail = http->bytesAvailable();
- QByteArray ba = http->readAll();
- QVERIFY( (quint64) ba.size() == bytesAvail );
- readyRead_ba.resize( oldSize + ba.size() );
- memcpy( readyRead_ba.data()+oldSize, ba.data(), ba.size() );
-
- if ( bytesTotalRead > 0 ) {
- QVERIFY( (int)readyRead_ba.size() <= bytesTotalRead );
- }
- QVERIFY( (int)readyRead_ba.size() == bytesDoneRead );
+ int oldSize = readyRead_ba.size();
+ quint64 bytesAvail = http->bytesAvailable();
+ QByteArray ba = http->readAll();
+ QVERIFY( (quint64) ba.size() == bytesAvail );
+ readyRead_ba.resize( oldSize + ba.size() );
+ memcpy( readyRead_ba.data()+oldSize, ba.data(), ba.size() );
+
+ if ( bytesTotalRead > 0 ) {
+ QVERIFY( (int)readyRead_ba.size() <= bytesTotalRead );
+ }
+ QVERIFY( (int)readyRead_ba.size() == bytesDoneRead );
}
}
@@ -1029,38 +1043,38 @@ void tst_QHttp::dataSendProgress( int done, int total )
#endif
QCOMPARE( http->currentId(), current_id );
if ( ids.count() > 1 ) {
- QVERIFY( http->hasPendingRequests() );
+ QVERIFY( http->hasPendingRequests() );
} else {
- QVERIFY( !http->hasPendingRequests() );
+ QVERIFY( !http->hasPendingRequests() );
}
QVERIFY( cur_state == http->state() );
CURRENTREQUEST_TEST;
if ( bytesTotalSend == bytesTotal_init ) {
- bytesTotalSend = total;
+ bytesTotalSend = total;
} else {
- QCOMPARE( bytesTotalSend, total );
+ QCOMPARE( bytesTotalSend, total );
}
QVERIFY( bytesTotalSend != bytesTotal_init );
QVERIFY( bytesDoneSend <= done );
bytesDoneSend = done;
if ( bytesTotalSend > 0 ) {
- QVERIFY( bytesDoneSend <= bytesTotalSend );
+ QVERIFY( bytesDoneSend <= bytesTotalSend );
}
if ( QTest::currentTestFunction() == QLatin1String("abort") ) {
- // ### it would be nice if we could specify in our testdata when to do
- // the abort
- if ( done >= total/100000 ) {
- if ( ids.count() != 1 ) {
- // do abort only once
- int tmpId = ids.first();
- ids.clear();
- ids << tmpId;
- http->abort();
- }
- }
+ // ### it would be nice if we could specify in our testdata when to do
+ // the abort
+ if ( done >= total/100000 ) {
+ if ( ids.count() != 1 ) {
+ // do abort only once
+ int tmpId = ids.first();
+ ids.clear();
+ ids << tmpId;
+ http->abort();
+ }
+ }
}
}
@@ -1071,38 +1085,38 @@ void tst_QHttp::dataReadProgress( int done, int total )
#endif
QCOMPARE( http->currentId(), current_id );
if ( ids.count() > 1 ) {
- QVERIFY( http->hasPendingRequests() );
+ QVERIFY( http->hasPendingRequests() );
} else {
- QVERIFY( !http->hasPendingRequests() );
+ QVERIFY( !http->hasPendingRequests() );
}
QVERIFY( cur_state == http->state() );
CURRENTREQUEST_TEST;
if ( bytesTotalRead == bytesTotal_init )
- bytesTotalRead = total;
+ bytesTotalRead = total;
else {
- QVERIFY( bytesTotalRead == total );
+ QVERIFY( bytesTotalRead == total );
}
QVERIFY( bytesTotalRead != bytesTotal_init );
QVERIFY( bytesDoneRead <= done );
bytesDoneRead = done;
if ( bytesTotalRead > 0 ) {
- QVERIFY( bytesDoneRead <= bytesTotalRead );
+ QVERIFY( bytesDoneRead <= bytesTotalRead );
}
if ( QTest::currentTestFunction() == QLatin1String("abort") ) {
- // ### it would be nice if we could specify in our testdata when to do
- // the abort
- if ( done >= total/100000 ) {
- if ( ids.count() != 1 ) {
- // do abort only once
- int tmpId = ids.first();
- ids.clear();
- ids << tmpId;
- http->abort();
- }
- }
+ // ### it would be nice if we could specify in our testdata when to do
+ // the abort
+ if ( done >= total/100000 ) {
+ if ( ids.count() != 1 ) {
+ // do abort only once
+ int tmpId = ids.first();
+ ids.clear();
+ ids << tmpId;
+ http->abort();
+ }
+ }
}
}
@@ -1111,21 +1125,21 @@ QHttp *tst_QHttp::newHttp(bool withAuth)
{
QHttp *nHttp = new QHttp( 0 );
connect( nHttp, SIGNAL(requestStarted(int)),
- SLOT(requestStarted(int)) );
+ SLOT(requestStarted(int)) );
connect( nHttp, SIGNAL(requestFinished(int,bool)),
- SLOT(requestFinished(int,bool)) );
+ SLOT(requestFinished(int,bool)) );
connect( nHttp, SIGNAL(done(bool)),
- SLOT(done(bool)) );
+ SLOT(done(bool)) );
connect( nHttp, SIGNAL(stateChanged(int)),
- SLOT(stateChanged(int)) );
+ SLOT(stateChanged(int)) );
connect( nHttp, SIGNAL(responseHeaderReceived(const QHttpResponseHeader&)),
- SLOT(responseHeaderReceived(const QHttpResponseHeader&)) );
+ SLOT(responseHeaderReceived(const QHttpResponseHeader&)) );
connect( nHttp, SIGNAL(readyRead(const QHttpResponseHeader&)),
- SLOT(readyRead(const QHttpResponseHeader&)) );
+ SLOT(readyRead(const QHttpResponseHeader&)) );
connect( nHttp, SIGNAL(dataSendProgress(int,int)),
- SLOT(dataSendProgress(int,int)) );
+ SLOT(dataSendProgress(int,int)) );
connect( nHttp, SIGNAL(dataReadProgress(int,int)),
- SLOT(dataReadProgress(int,int)) );
+ SLOT(dataReadProgress(int,int)) );
connectionWithAuth = withAuth;
return nHttp;
@@ -1143,9 +1157,9 @@ void tst_QHttp::addRequest( QHttpRequestHeader header, int id )
bool tst_QHttp::headerAreEqual( const QHttpHeader &h1, const QHttpHeader &h2 )
{
if ( !h1.isValid() )
- return !h2.isValid();
+ return !h2.isValid();
if ( !h2.isValid() )
- return !h1.isValid();
+ return !h1.isValid();
return h1.toString() == h2.toString();
}
@@ -1165,13 +1179,13 @@ void tst_QHttp::reconnect()
QTestEventLoop::instance().enterLoop(60);
if (QTestEventLoop::instance().timeout())
- QFAIL("Network operation timed out");
+ QFAIL("Network operation timed out");
QCOMPARE(reconnect_state_connect_count, 1);
QTestEventLoop::instance().enterLoop(60);
if (QTestEventLoop::instance().timeout())
- QFAIL("Network operation timed out");
+ QFAIL("Network operation timed out");
QCOMPARE(reconnect_state_connect_count, 2);
}
@@ -1212,12 +1226,12 @@ private slots:
socket->write("HTTP/1.1 404 Not found\r\n"
"content-length: 4\r\n\r\nabcd");
socket->disconnectFromHost();
- }
+ };
};
void tst_QHttp::unexpectedRemoteClose()
{
- QFETCH_GLOBAL(int, proxyType);
+ QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
// This test doesn't make sense for SOCKS5
return;
@@ -1380,7 +1394,7 @@ void tst_QHttp::cachingProxyAndSsl()
void tst_QHttp::emptyBodyInReply()
{
// Note: if this test starts failing, please verify the date on the file
- // returned by Apache on http://fluke.troll.no/
+ // returned by Apache on http://netiks.troll.no/
// It is right now hard-coded to the date below
QHttp http;
http.setHost(QtNetworkSettings::serverName());
@@ -1458,8 +1472,9 @@ void tst_QHttp::connectionClose()
// Note: the servers might change too...
//
// This was added in response to bug 176822
+#ifndef Q_OS_SYMBIAN
QSKIP("This test is manual - read comments in the source code", SkipAll);
-
+#endif
QFETCH_GLOBAL(bool, setProxy);
if (setProxy)
return;
diff --git a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro
index e19d962..5ce3a2d 100644
--- a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro
+++ b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro
@@ -1,6 +1,6 @@
load(qttest_p4)
SOURCES += tst_qhttpnetworkconnection.cpp
-INCLUDEPATH += $$(QTDIR)/src/3rdparty/zlib
+INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/zlib
requires(contains(QT_CONFIG,private_tests))
diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
index c4c33d5..214ce02 100644
--- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
+++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
@@ -50,6 +50,10 @@
class tst_QHttpNetworkConnection: public QObject
{
Q_OBJECT
+
+public:
+ tst_QHttpNetworkConnection();
+
public Q_SLOTS:
void finishedReply();
void finishedWithError(QNetworkReply::NetworkError errorCode, const QString &detail);
@@ -104,6 +108,10 @@ private Q_SLOTS:
void getMultipleWithPipeliningAndMultiplePriorities();
};
+tst_QHttpNetworkConnection::tst_QHttpNetworkConnection()
+{
+ Q_SET_DEFAULT_IAP
+}
void tst_QHttpNetworkConnection::initTestCase()
{
@@ -203,8 +211,8 @@ void tst_QHttpNetworkConnection::get_data()
QTest::newRow("success-internal") << "http://" << QtNetworkSettings::serverName() << "/qtest/rfc3252.txt" << ushort(80) << false << 200 << "OK" << 25962 << 25962;
QTest::newRow("success-external") << "http://" << "www.ietf.org" << "/rfc/rfc3252.txt" << ushort(80) << false << 200 << "OK" << 25962 << 25962;
- QTest::newRow("failure-path") << "http://" << QtNetworkSettings::serverName() << "/t" << ushort(80) << false << 404 << "Not Found" << -1 << 1023;
- QTest::newRow("failure-protocol") << "" << QtNetworkSettings::serverName() << "/qtest/rfc3252.txt" << ushort(80) << false << 400 << "Bad Request" << -1 << 956;
+ QTest::newRow("failure-path") << "http://" << QtNetworkSettings::serverName() << "/t" << ushort(80) << false << 404 << "Not Found" << -1 << 997 + QtNetworkSettings::serverName().size();
+ QTest::newRow("failure-protocol") << "" << QtNetworkSettings::serverName() << "/qtest/rfc3252.txt" << ushort(80) << false << 400 << "Bad Request" << -1 << 930 + QtNetworkSettings::serverName().size();
}
void tst_QHttpNetworkConnection::get()
@@ -372,7 +380,7 @@ void tst_QHttpNetworkConnection::post_data()
QTest::addColumn<int>("downloadSize");
QTest::newRow("success-internal") << "http://" << QtNetworkSettings::serverName() << "/cgi-bin/echo.cgi" << ushort(80) << false << "7 bytes" << 200 << "OK" << 7 << 7;
- QTest::newRow("failure-internal") << "http://" << QtNetworkSettings::serverName() << "/t" << ushort(80) << false << "Hello World" << 404 << "Not Found" << -1 << 1023;
+ QTest::newRow("failure-internal") << "http://" << QtNetworkSettings::serverName() << "/t" << ushort(80) << false << "Hello World" << 404 << "Not Found" << -1 << 997 + QtNetworkSettings::serverName().size();
}
void tst_QHttpNetworkConnection::post()
@@ -415,7 +423,16 @@ void tst_QHttpNetworkConnection::post()
QCOMPARE(reply->statusCode(), statusCode);
QCOMPARE(reply->reasonPhrase(), statusString);
- QCOMPARE(reply->contentLength(), qint64(contentLength));
+
+ qint64 cLen = reply->contentLength();
+ if (cLen==-1) {
+ // HTTP 1.1 server may respond with chunked encoding and in that
+ // case contentLength is not present in reply -> verify that it is the case
+ QByteArray transferEnc = reply->headerField("Transfer-Encoding");
+ QCOMPARE(transferEnc, QByteArray("chunked"));
+ } else {
+ QCOMPARE(cLen, qint64(contentLength));
+ }
stopWatch.start();
QByteArray ba;
@@ -429,6 +446,7 @@ void tst_QHttpNetworkConnection::post()
QVERIFY(reply->isFinished());
QCOMPARE(ba.size(), downloadSize);
+
delete reply;
}
diff --git a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
index 7c53013..f920850 100644
--- a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
+++ b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
@@ -139,13 +139,14 @@ public slots:
tst_QHttpSocketEngine::tst_QHttpSocketEngine()
{
+ Q_SET_DEFAULT_IAP
}
tst_QHttpSocketEngine::~tst_QHttpSocketEngine()
{
-
}
+
void tst_QHttpSocketEngine::init()
{
tmpSocket = 0;
@@ -324,8 +325,8 @@ void tst_QHttpSocketEngine::simpleConnectToIMAP()
QVERIFY(socketDevice.read(array.data(), array.size()) == available);
// Check that the greeting is what we expect it to be
- QCOMPARE(array.constData(),
- "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ QCOMPARE(array.constData(), QtNetworkSettings::expectedReplyIMAP().constData());
+
// Write a logout message
QByteArray array2 = "XXXX LOGOUT\r\n";
@@ -454,7 +455,7 @@ void tst_QHttpSocketEngine::tcpSocketBlockingTest()
// Read greeting
QVERIFY(socket.waitForReadyRead(5000));
QString s = socket.readLine();
- QCOMPARE(s.toLatin1().constData(), "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ QCOMPARE(s.toLatin1().constData(), QtNetworkSettings::expectedReplyIMAP().constData());
// Write NOOP
QCOMPARE((int) socket.write("1 NOOP\r\n", 8), 8);
@@ -529,7 +530,9 @@ void tst_QHttpSocketEngine::tcpSocketNonBlockingTest()
// Read greeting
QVERIFY(!tcpSocketNonBlocking_data.isEmpty());
QCOMPARE(tcpSocketNonBlocking_data.at(0).toLatin1().constData(),
- "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ QtNetworkSettings::expectedReplyIMAP().constData());
+
+
tcpSocketNonBlocking_data.clear();
tcpSocketNonBlocking_totalWritten = 0;
@@ -648,7 +651,7 @@ void tst_QHttpSocketEngine::downloadBigFile()
QTime stopWatch;
stopWatch.start();
-#if defined(Q_OS_WINCE)
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QTestEventLoop::instance().enterLoop(240);
#else
QTestEventLoop::instance().enterLoop(60);
@@ -709,8 +712,8 @@ void tst_QHttpSocketEngine::passwordAuth()
QVERIFY(socketDevice.read(array.data(), array.size()) == available);
// Check that the greeting is what we expect it to be
- QCOMPARE(array.constData(),
- "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ QCOMPARE(array.constData(), QtNetworkSettings::expectedReplyIMAP().constData());
+
// Write a logout message
QByteArray array2 = "XXXX LOGOUT\r\n";
diff --git a/tests/auto/qicoimageformat/qicoimageformat.pro b/tests/auto/qicoimageformat/qicoimageformat.pro
index 9a347d7..c0aa4b5 100644
--- a/tests/auto/qicoimageformat/qicoimageformat.pro
+++ b/tests/auto/qicoimageformat/qicoimageformat.pro
@@ -12,6 +12,14 @@ wince*: {
}
addPlugins.path = imageformats
DEPLOYMENT += addFiles addPlugins
+} else:symbian* {
+ addFiles.sources = icons
+ addFiles.path = .
+ addPlugins.sources = qico.dll
+ addPlugins.path = imageformats
+ DEPLOYMENT += addFiles addPlugins
+ TARGET.UID3 = 0xE0340004
+ DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x",""))
} else {
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
diff --git a/tests/auto/qicoimageformat/tst_qicoimageformat.cpp b/tests/auto/qicoimageformat/tst_qicoimageformat.cpp
index 270a0f8..11dbaf1 100644
--- a/tests/auto/qicoimageformat/tst_qicoimageformat.cpp
+++ b/tests/auto/qicoimageformat/tst_qicoimageformat.cpp
@@ -42,6 +42,12 @@
#include <QtGui>
#include <QtCore>
+#if defined(Q_OS_SYMBIAN)
+# define STRINGIFY(x) #x
+# define TOSTRING(x) STRINGIFY(x)
+# define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/"
+#endif
+
class tst_QIcoImageFormat : public QObject
{
Q_OBJECT
diff --git a/tests/auto/qicon/qicon.pro b/tests/auto/qicon/qicon.pro
index c8d77e8..982bc5a 100644
--- a/tests/auto/qicon/qicon.pro
+++ b/tests/auto/qicon/qicon.pro
@@ -11,6 +11,13 @@ wince*:{
DEPLOYMENT += addFiles
DEPLOYMENT_PLUGIN += qsvg
DEFINES += SRCDIR=\\\".\\\"
+} else:symbian* {
+ QT += xml svg
+ addFiles.sources = *.png *.tga *.svg *.svgz
+ addFiles.path = .
+ plugins.sources = qsvgicon.dll
+ plugins.path = iconengines
+ DEPLOYMENT += addFiles plugins
} else {
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
diff --git a/tests/auto/qicon/tst_qicon.cpp b/tests/auto/qicon/tst_qicon.cpp
index add321d..2bb53e3 100644
--- a/tests/auto/qicon/tst_qicon.cpp
+++ b/tests/auto/qicon/tst_qicon.cpp
@@ -43,6 +43,10 @@
#include <QtTest/QtTest>
#include <qicon.h>
+
+#if defined(Q_OS_SYMBIAN)
+#define SRCDIR "."
+#endif
#include <qiconengine.h>
Q_DECLARE_METATYPE(QSize)
@@ -125,7 +129,6 @@ void tst_QIcon::actualSize_data()
QTest::newRow("resource10") << ":/rect.png" << QSize( 25, 50) << QSize( 20, 40);
const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/");
-
QTest::newRow("external0") << prefix + "image.png" << QSize(128, 128) << QSize(128, 128);
QTest::newRow("external1") << prefix + "image.png" << QSize( 64, 64) << QSize( 64, 64);
QTest::newRow("external2") << prefix + "image.png" << QSize( 32, 64) << QSize( 32, 32);
@@ -180,7 +183,6 @@ void tst_QIcon::actualSize2_data()
void tst_QIcon::actualSize2()
{
QIcon icon;
-
const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/");
icon.addPixmap(QPixmap(prefix + "image.png"));
@@ -239,7 +241,6 @@ void tst_QIcon::isNull() {
QVERIFY(!iconNoFileSuffix.actualSize(QSize(32, 32)).isValid());
const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/");
-
// test string constructor with existing file but unsupported format
QIcon iconUnsupportedFormat = QIcon(prefix + "image.tga");
QVERIFY(!iconUnsupportedFormat.isNull());
diff --git a/tests/auto/qimage/qimage.pro b/tests/auto/qimage/qimage.pro
index f10a488..69d6f0f 100644
--- a/tests/auto/qimage/qimage.pro
+++ b/tests/auto/qimage/qimage.pro
@@ -6,6 +6,13 @@ wince*: {
addImages.path = images
DEPLOYMENT += addImages
DEFINES += SRCDIR=\\\".\\\"
+} else:symbian* {
+ TARGET.EPOCHEAPSIZE = 0x200000 0x800000
+ addImages.sources = images/*
+ addImages.path = images
+ imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll qtiff.dll qico.dll
+ imagePlugins.path = imageformats
+ DEPLOYMENT += addImages imagePlugins
} else {
contains(QT_CONFIG, qt3support): QT += qt3support
DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp
index 487ae29..d443e2b 100644
--- a/tests/auto/qimage/tst_qimage.cpp
+++ b/tests/auto/qimage/tst_qimage.cpp
@@ -51,8 +51,12 @@
#include <qpainter.h>
#include <private/qdrawhelper_p.h>
+
//TESTED_CLASS=
//TESTED_FILES=
+#if defined(Q_OS_SYMBIAN)
+# define SRCDIR ""
+#endif
Q_DECLARE_METATYPE(QImage::Format)
@@ -262,8 +266,11 @@ void tst_QImage::formatHandlersInput_data()
{
QTest::addColumn<QString>("testFormat");
QTest::addColumn<QString>("testFile");
-
+ #ifdef Q_OS_SYMBIAN
+ const QString prefix = QLatin1String(SRCDIR) + "images/";
+ #else
const QString prefix = QLatin1String(SRCDIR) + "/images/";
+ #endif
// add a new line here when a file is added
QTest::newRow("ICO") << "ICO" << prefix + "image.ico";
@@ -285,7 +292,6 @@ void tst_QImage::formatHandlersInput()
{
QFETCH(QString, testFormat);
QFETCH(QString, testFile);
-
QList<QByteArray> formats = QImageReader::supportedImageFormats();
// qDebug("Image input formats : %s", formats.join(" | ").latin1());
@@ -297,7 +303,7 @@ void tst_QImage::formatHandlersInput()
}
}
if (formatSupported) {
-// qDebug(QImage::imageFormat(testFile));
+// qDebug(QImage::imageFormat(testFile));
QCOMPARE(testFormat.toLatin1().toLower(), QImageReader::imageFormat(testFile));
} else {
QString msg = "Format not supported : ";
@@ -1469,10 +1475,12 @@ void tst_QImage::smoothScale3()
void tst_QImage::smoothScaleBig()
{
-#ifndef Q_OS_WINCE
- int bigValue = 200000;
-#else
+#if defined(Q_OS_WINCE)
+ int bigValue = 2000;
+#elif defined(Q_OS_SYMBIAN)
int bigValue = 2000;
+#else
+ int bigValue = 200000;
#endif
QImage tall(4, bigValue, QImage::Format_ARGB32);
tall.fill(0x0);
diff --git a/tests/auto/qimagereader/qimagereader.pro b/tests/auto/qimagereader/qimagereader.pro
index 2c9510e..31a9b0f 100644
--- a/tests/auto/qimagereader/qimagereader.pro
+++ b/tests/auto/qimagereader/qimagereader.pro
@@ -3,7 +3,7 @@ SOURCES += tst_qimagereader.cpp
MOC_DIR=tmp
QT += network
RESOURCES += qimagereader.qrc
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\"
!contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF
!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
@@ -26,3 +26,12 @@ wince*: {
DEFINES += SRCDIR=\\\".\\\"
}
+symbian*: {
+ images.sources = images
+ images.path = .
+
+ imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll
+ imagePlugins.path = imageformats
+
+ DEPLOYMENT += images imagePlugins
+}
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index ba3d83e..1d19baa 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -55,6 +55,10 @@
#include <QTcpServer>
#include <QTimer>
+#if defined(Q_OS_SYMBIAN)
+# define SRCDIR "."
+#endif
+
typedef QMap<QString, QString> QStringMap;
typedef QList<int> QIntList;
Q_DECLARE_METATYPE(QImage)
@@ -793,7 +797,9 @@ void tst_QImageReader::readFromDevice()
{
QFETCH(QString, fileName);
QFETCH(QByteArray, format);
-
+ #ifdef Q_OS_SYMBIAN
+ QSKIP("Symbian local sockets are not working", SkipAll);
+ #endif
QImage expectedImage(prefix + fileName, format);
QFile file(prefix + fileName);
diff --git a/tests/auto/qimagewriter/qimagewriter.pro b/tests/auto/qimagewriter/qimagewriter.pro
index e62c1a5..5a2c908 100644
--- a/tests/auto/qimagewriter/qimagewriter.pro
+++ b/tests/auto/qimagewriter/qimagewriter.pro
@@ -10,6 +10,12 @@ wince*: {
addFiles.path = images
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\".\\\"
+} else:symbian* {
+ addFiles.sources = images\*.*
+ addFiles.path = images
+ imagePlugins.sources = qjpeg.dll qtiff.dll
+ imagePlugins.path = imageformats
+ DEPLOYMENT += addFiles imagePlugins
} else {
DEFINES += SRCDIR=\\\"$$PWD\\\"
-} \ No newline at end of file
+}
diff --git a/tests/auto/qimagewriter/tst_qimagewriter.cpp b/tests/auto/qimagewriter/tst_qimagewriter.cpp
index 2cd65ce..19d6d0c 100644
--- a/tests/auto/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/qimagewriter/tst_qimagewriter.cpp
@@ -52,6 +52,9 @@
#include <QPainter>
#include <QSet>
+#if defined(Q_OS_SYMBIAN)
+# define SRCDIR ""
+#endif
typedef QMap<QString, QString> QStringMap;
typedef QList<int> QIntList;
Q_DECLARE_METATYPE(QImage)
@@ -106,9 +109,11 @@ private slots:
void saveToTemporaryFile();
};
-
+#ifdef Q_OS_SYMBIAN
+static const QLatin1String prefix(SRCDIR "images/");
+#else
static const QLatin1String prefix(SRCDIR "/images/");
-
+#endif
static void initializePadding(QImage *image)
{
int effectiveBytesPerLine = (image->width() * image->depth() + 7) / 8;
@@ -276,7 +281,7 @@ void tst_QImageWriter::writeImage2_data()
#if defined QTEST_HAVE_TIFF
void tst_QImageWriter::largeTiff()
{
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QImage img(4096, 2048, QImage::Format_ARGB32);
QPainter p(&img);
@@ -302,6 +307,8 @@ void tst_QImageWriter::largeTiff()
QVERIFY(!img2.isNull());
QCOMPARE(img, img2);
+#else
+ QWARN("not tested on Symbian/WinCE");
#endif
}
#endif
diff --git a/tests/auto/qinputcontext/qinputcontext.pro b/tests/auto/qinputcontext/qinputcontext.pro
new file mode 100644
index 0000000..b3ea8c2
--- /dev/null
+++ b/tests/auto/qinputcontext/qinputcontext.pro
@@ -0,0 +1,2 @@
+load(qttest_p4)
+SOURCES += tst_qinputcontext.cpp
diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp
new file mode 100644
index 0000000..47675e0
--- /dev/null
+++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp
@@ -0,0 +1,249 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../../shared/util.h"
+
+#include <qinputcontext.h>
+#include <qlineedit.h>
+#include <qplaintextedit.h>
+#include <qlayout.h>
+#include <qradiobutton.h>
+#include <qwindowsstyle.h>
+
+class tst_QInputContext : public QObject
+{
+Q_OBJECT
+
+public:
+ tst_QInputContext() {}
+ virtual ~tst_QInputContext() {}
+
+public slots:
+ void initTestCase() {}
+ void cleanupTestCase() {}
+ void init() {}
+ void cleanup() {}
+private slots:
+ void maximumTextLength();
+ void filterMouseEvents();
+ void requestSoftwareInputPanel();
+ void closeSoftwareInputPanel();
+ void selections();
+};
+
+void tst_QInputContext::maximumTextLength()
+{
+ QLineEdit le;
+
+ le.setMaxLength(15);
+ QVariant variant = le.inputMethodQuery(Qt::ImMaximumTextLength);
+ QVERIFY(variant.isValid());
+ QCOMPARE(variant.toInt(), 15);
+
+ QPlainTextEdit pte;
+ // For BC/historical reasons, QPlainTextEdit::inputMethodQuery is protected.
+ variant = static_cast<QWidget *>(&pte)->inputMethodQuery(Qt::ImMaximumTextLength);
+ QVERIFY(!variant.isValid());
+}
+
+class QFilterInputContext : public QInputContext
+{
+public:
+ QFilterInputContext() {}
+ ~QFilterInputContext() {}
+
+ QString identifierName() { return QString(); }
+ QString language() { return QString(); }
+
+ void reset() {}
+
+ bool isComposing() const { return false; }
+
+ bool filterEvent( const QEvent *event )
+ {
+ lastTypes.append(event->type());
+ return false;
+ }
+
+public:
+ QList<QEvent::Type> lastTypes;
+};
+
+void tst_QInputContext::filterMouseEvents()
+{
+ QLineEdit le;
+ le.show();
+ QApplication::setActiveWindow(&le);
+
+ QFilterInputContext *ic = new QFilterInputContext;
+ le.setInputContext(ic);
+ QTest::mouseClick(&le, Qt::LeftButton);
+
+ QVERIFY(ic->lastTypes.indexOf(QEvent::MouseButtonRelease) >= 0);
+
+ le.setInputContext(0);
+}
+
+class RequestSoftwareInputPanelStyle : public QWindowsStyle
+{
+public:
+ RequestSoftwareInputPanelStyle()
+ : m_rsipBehavior(RSIP_OnMouseClickAndAlreadyFocused)
+ {
+ }
+ ~RequestSoftwareInputPanelStyle()
+ {
+ }
+
+ int styleHint(StyleHint hint, const QStyleOption *opt = 0,
+ const QWidget *widget = 0, QStyleHintReturn* returnData = 0) const
+ {
+ if (hint == SH_RequestSoftwareInputPanel) {
+ return m_rsipBehavior;
+ } else {
+ return QWindowsStyle::styleHint(hint, opt, widget, returnData);
+ }
+ }
+
+ RequestSoftwareInputPanel m_rsipBehavior;
+};
+
+void tst_QInputContext::requestSoftwareInputPanel()
+{
+ QStyle *oldStyle = qApp->style();
+ oldStyle->setParent(this); // Prevent it being deleted.
+ RequestSoftwareInputPanelStyle *newStyle = new RequestSoftwareInputPanelStyle;
+ qApp->setStyle(newStyle);
+
+ QWidget w;
+ QLayout *layout = new QVBoxLayout;
+ QLineEdit *le1, *le2;
+ le1 = new QLineEdit;
+ le2 = new QLineEdit;
+ layout->addWidget(le1);
+ layout->addWidget(le2);
+ w.setLayout(layout);
+
+ QFilterInputContext *ic1, *ic2;
+ ic1 = new QFilterInputContext;
+ ic2 = new QFilterInputContext;
+ le1->setInputContext(ic1);
+ le2->setInputContext(ic2);
+
+ w.show();
+ QApplication::setActiveWindow(&w);
+
+ // Testing single click panel activation.
+ newStyle->m_rsipBehavior = QStyle::RSIP_OnMouseClick;
+ QTest::mouseClick(le2, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5));
+ QVERIFY(ic2->lastTypes.indexOf(QEvent::RequestSoftwareInputPanel) >= 0);
+ ic2->lastTypes.clear();
+
+ // Testing double click panel activation.
+ newStyle->m_rsipBehavior = QStyle::RSIP_OnMouseClickAndAlreadyFocused;
+ QTest::mouseClick(le1, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5));
+ QVERIFY(ic1->lastTypes.indexOf(QEvent::RequestSoftwareInputPanel) < 0);
+ QTest::mouseClick(le1, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5));
+ QVERIFY(ic1->lastTypes.indexOf(QEvent::RequestSoftwareInputPanel) >= 0);
+ ic1->lastTypes.clear();
+
+ // Testing right mouse button
+ QTest::mouseClick(le1, Qt::RightButton, Qt::NoModifier, QPoint(5, 5));
+ QVERIFY(ic1->lastTypes.indexOf(QEvent::RequestSoftwareInputPanel) < 0);
+
+ qApp->setStyle(oldStyle);
+ oldStyle->setParent(qApp);
+}
+
+void tst_QInputContext::closeSoftwareInputPanel()
+{
+ QWidget w;
+ QLayout *layout = new QVBoxLayout;
+ QLineEdit *le1, *le2;
+ QRadioButton *rb;
+ le1 = new QLineEdit;
+ le2 = new QLineEdit;
+ rb = new QRadioButton;
+ layout->addWidget(le1);
+ layout->addWidget(le2);
+ layout->addWidget(rb);
+ w.setLayout(layout);
+
+ QFilterInputContext *ic1, *ic2;
+ ic1 = new QFilterInputContext;
+ ic2 = new QFilterInputContext;
+ le1->setInputContext(ic1);
+ le2->setInputContext(ic2);
+
+ w.show();
+ QApplication::setActiveWindow(&w);
+
+ // Testing that panel doesn't close between two input methods aware widgets.
+ QTest::mouseClick(le1, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5));
+ QTest::mouseClick(le2, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5));
+ QVERIFY(ic2->lastTypes.indexOf(QEvent::CloseSoftwareInputPanel) < 0);
+
+ // Testing that panel closes when focusing non-aware widget.
+ QTest::mouseClick(rb, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5));
+ QVERIFY(ic2->lastTypes.indexOf(QEvent::CloseSoftwareInputPanel) >= 0);
+}
+
+void tst_QInputContext::selections()
+{
+ QLineEdit le;
+ le.setText("Test text");
+ le.setSelection(2, 2);
+ QCOMPARE(le.inputMethodQuery(Qt::ImCursorPosition).toInt(), 4);
+ QCOMPARE(le.inputMethodQuery(Qt::ImAnchorPosition).toInt(), 2);
+
+ QList<QInputMethodEvent::Attribute> attributes;
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 5, 3, QVariant()));
+ QInputMethodEvent event("", attributes);
+ QApplication::sendEvent(&le, &event);
+ QCOMPARE(le.cursorPosition(), 8);
+ QCOMPARE(le.selectionStart(), 5);
+ QCOMPARE(le.inputMethodQuery(Qt::ImCursorPosition).toInt(), 8);
+ QCOMPARE(le.inputMethodQuery(Qt::ImAnchorPosition).toInt(), 5);
+}
+
+QTEST_MAIN(tst_QInputContext)
+#include "tst_qinputcontext.moc"
diff --git a/tests/auto/qiodevice/qiodevice.pro b/tests/auto/qiodevice/qiodevice.pro
index e2864e8..e695bf6 100644
--- a/tests/auto/qiodevice/qiodevice.pro
+++ b/tests/auto/qiodevice/qiodevice.pro
@@ -9,6 +9,11 @@ wince*: {
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.path = .
+ DEPLOYMENT += addFiles
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
contains(QT_CONFIG, qt3support):QT += qt3support
diff --git a/tests/auto/qiodevice/tst_qiodevice.cpp b/tests/auto/qiodevice/tst_qiodevice.cpp
index 614247b..aa49854 100644
--- a/tests/auto/qiodevice/tst_qiodevice.cpp
+++ b/tests/auto/qiodevice/tst_qiodevice.cpp
@@ -49,6 +49,10 @@
//TESTED_CLASS=
//TESTED_FILES=
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR ""
+#endif
+
class tst_QIODevice : public QObject
{
Q_OBJECT
@@ -94,11 +98,11 @@ void tst_QIODevice::getSetCheck()
tst_QIODevice::tst_QIODevice()
{
+ Q_SET_DEFAULT_IAP
}
tst_QIODevice::~tst_QIODevice()
{
-
}
void tst_QIODevice::init()
@@ -136,6 +140,7 @@ void tst_QIODevice::constructing_QTcpSocket()
socket.close();
socket.connectToHost(QtNetworkSettings::serverName(), 143);
QVERIFY(socket.waitForConnected(5000));
+ QVERIFY(device->isOpen());
while (!device->canReadLine())
QVERIFY(device->waitForReadyRead(5000));
diff --git a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
index 9fc23fb..75d9c8f 100644
--- a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
@@ -1055,23 +1055,31 @@ void tst_QItemDelegate::editorEvent()
QCOMPARE(index.data(Qt::CheckStateRole).toInt(), expectedCheckState);
}
+enum WidgetType
+{
+ LineEdit,
+ TextEdit,
+ PlainTextEdit
+};
+Q_DECLARE_METATYPE(WidgetType);
+
void tst_QItemDelegate::enterKey_data()
{
- QTest::addColumn<int>("widget");
+ QTest::addColumn<WidgetType>("widget");
QTest::addColumn<int>("key");
QTest::addColumn<bool>("expectedFocus");
- QTest::newRow("lineedit enter") << 1 << int(Qt::Key_Enter) << false;
- QTest::newRow("textedit enter") << 2 << int(Qt::Key_Enter) << true;
- QTest::newRow("plaintextedit enter") << 3 << int(Qt::Key_Enter) << true;
- QTest::newRow("plaintextedit return") << 3 << int(Qt::Key_Return) << true;
- QTest::newRow("plaintextedit tab") << 3 << int(Qt::Key_Tab) << false;
- QTest::newRow("lineedit tab") << 1 << int(Qt::Key_Tab) << false;
+ QTest::newRow("lineedit enter") << LineEdit << int(Qt::Key_Enter) << false;
+ QTest::newRow("textedit enter") << TextEdit << int(Qt::Key_Enter) << true;
+ QTest::newRow("plaintextedit enter") << PlainTextEdit << int(Qt::Key_Enter) << true;
+ QTest::newRow("plaintextedit return") << PlainTextEdit << int(Qt::Key_Return) << true;
+ QTest::newRow("plaintextedit tab") << PlainTextEdit << int(Qt::Key_Tab) << false;
+ QTest::newRow("lineedit tab") << LineEdit << int(Qt::Key_Tab) << false;
}
void tst_QItemDelegate::enterKey()
{
- QFETCH(int, widget);
+ QFETCH(WidgetType, widget);
QFETCH(int, key);
QFETCH(bool, expectedFocus);
@@ -1087,18 +1095,18 @@ void tst_QItemDelegate::enterKey()
struct TestDelegate : public QItemDelegate
{
- int widgetType;
+ WidgetType widgetType;
virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& /*option*/, const QModelIndex& /*index*/) const
{
QWidget *editor = 0;
switch(widgetType) {
- case 1:
+ case LineEdit:
editor = new QLineEdit(parent);
break;
- case 2:
+ case TextEdit:
editor = new QTextEdit(parent);
break;
- case 3:
+ case PlainTextEdit:
editor = new QPlainTextEdit(parent);
break;
}
@@ -1124,7 +1132,11 @@ void tst_QItemDelegate::enterKey()
QTest::keyClick(editor, Qt::Key(key));
QApplication::processEvents();
- QCOMPARE(editor && editor->hasFocus(), expectedFocus);
+ // The line edit has already been destroyed, so avoid that case.
+ if (widget == TextEdit || widget == PlainTextEdit) {
+ QVERIFY(!editor.isNull());
+ QCOMPARE(editor && editor->hasFocus(), expectedFocus);
+ }
}
void tst_QItemDelegate::task257859_finalizeEdit()
diff --git a/tests/auto/qitemmodel/qitemmodel.pro b/tests/auto/qitemmodel/qitemmodel.pro
index 38c615b..eb62b24 100644
--- a/tests/auto/qitemmodel/qitemmodel.pro
+++ b/tests/auto/qitemmodel/qitemmodel.pro
@@ -13,3 +13,12 @@ QT += sql
# plugFiles.path = sqldrivers
# DEPLOYMENT += plugFiles
#}
+
+symbian {
+ TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb"
+ contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
+ sqlite.path = /sys/bin
+ sqlite.sources = sqlite3.dll
+ DEPLOYMENT += sqlite
+ }
+}
diff --git a/tests/auto/qitemview/tst_qitemview.cpp b/tests/auto/qitemview/tst_qitemview.cpp
index 1b06401..18a7922 100644
--- a/tests/auto/qitemview/tst_qitemview.cpp
+++ b/tests/auto/qitemview/tst_qitemview.cpp
@@ -254,7 +254,7 @@ void tst_QItemView::populate()
{
treeModel = new CheckerModel;
QModelIndex parent;
-#ifdef QT_ARCH_ARM
+#if defined(QT_ARCH_ARM) || defined(Q_OS_SYMBIAN)
const int baseInsert = 4;
#else
const int baseInsert = 26;
@@ -352,7 +352,7 @@ void tst_QItemView::nonDestructiveBasicTest()
QCOMPARE(view->tabKeyNavigation(), false);
view->setTabKeyNavigation(true);
QCOMPARE(view->tabKeyNavigation(), true);
-
+#ifndef QT_NO_DRAGANDDROP
// setDropIndicatorShown
view->setDropIndicatorShown(false);
QCOMPARE(view->showDropIndicator(), false);
@@ -364,6 +364,7 @@ void tst_QItemView::nonDestructiveBasicTest()
QCOMPARE(view->dragEnabled(), false);
view->setDragEnabled(true);
QCOMPARE(view->dragEnabled(), true);
+#endif
// setAlternatingRowColors
view->setAlternatingRowColors(false);
@@ -457,7 +458,7 @@ void tst_QItemView::spider()
view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll);
view->setModel(treeModel);
view->show();
-#if defined(Q_OS_WINCE)
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
srandom(0);
#else
srandom(time(0));
diff --git a/tests/auto/qkeyevent/.gitignore b/tests/auto/qkeyevent/.gitignore
deleted file mode 100644
index 8d69f55..0000000
--- a/tests/auto/qkeyevent/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-tst_qkeyevent
diff --git a/tests/auto/qkeyevent/qkeyevent.pro b/tests/auto/qkeyevent/qkeyevent.pro
deleted file mode 100644
index 8a3dc12..0000000
--- a/tests/auto/qkeyevent/qkeyevent.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-load(qttest_p4)
-HEADERS +=
-SOURCES += tst_qkeyevent.cpp
-
-
diff --git a/tests/auto/qkeyevent/tst_qkeyevent.cpp b/tests/auto/qkeyevent/tst_qkeyevent.cpp
deleted file mode 100644
index 54c59f7..0000000
--- a/tests/auto/qkeyevent/tst_qkeyevent.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** 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 either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtTest/QtTest>
-#include <qevent.h>
-#include <qapplication.h>
-
-
-#include <qevent.h>
-
-//TESTED_CLASS=
-//TESTED_FILES=gui/itemviews/qitemselectionmodel.h gui/itemviews/qitemselectionmodel.cpp
-
-class KeyEventWidget : public QWidget
-{
-public:
- KeyEventWidget( QWidget* parent = 0, const char* name = 0 );
- ~KeyEventWidget();
- QKeyEvent* getLastKeyPress();
- QKeyEvent* getLastKeyRelease();
- bool recievedKeyPress;
- bool recievedKeyRelease;
-protected:
- void keyPressEvent( QKeyEvent* e );
- void keyReleaseEvent( QKeyEvent* e );
-private:
- QKeyEvent* lastKeyPress;
- QKeyEvent* lastKeyRelease;
-};
-
-class tst_QKeyEvent : public QObject
-{
- Q_OBJECT
-public:
- tst_QKeyEvent();
- ~tst_QKeyEvent();
-public slots:
- void initTestCase();
- void cleanupTestCase();
-private slots:
- void sendRecieveKeyEvents_data();
- void sendRecieveKeyEvents();
- void standardKey();
-private:
- KeyEventWidget* testWidget;
-};
-
-
-KeyEventWidget::KeyEventWidget( QWidget* parent, const char* name )
- : QWidget( parent ), recievedKeyPress( FALSE ), recievedKeyRelease( FALSE ),
- lastKeyPress( 0 ), lastKeyRelease( 0 )
-{
- setObjectName(name);
-}
-
-KeyEventWidget::~KeyEventWidget()
-{
-}
-
-QKeyEvent* KeyEventWidget::getLastKeyPress()
-{
- return lastKeyPress;
-}
-
-QKeyEvent* KeyEventWidget::getLastKeyRelease()
-{
- return lastKeyRelease;
-}
-
-void KeyEventWidget::keyPressEvent( QKeyEvent* e )
-{
- lastKeyPress = e;
- recievedKeyPress = TRUE;
-}
-
-void KeyEventWidget::keyReleaseEvent( QKeyEvent* e )
-{
- lastKeyRelease = e;
- recievedKeyRelease = TRUE;
-}
-
-tst_QKeyEvent::tst_QKeyEvent()
-{
-}
-
-tst_QKeyEvent::~tst_QKeyEvent()
-{
-}
-
-void tst_QKeyEvent::initTestCase()
-{
- testWidget = new KeyEventWidget( 0 );
- testWidget->show();
-}
-
-void tst_QKeyEvent::cleanupTestCase()
-{
- delete testWidget;
-}
-
-void tst_QKeyEvent::sendRecieveKeyEvents_data()
-{
- QTest::addColumn<int>("key");
- QTest::addColumn<bool>("textExpected");
- QTest::addColumn<QString>("text");
- int a;
- for ( a = Qt::Key_Escape; a < Qt::Key_Direction_R; a++ ) {
- if ( ( a > Qt::Key_Clear && a < Qt::Key_Home )
- || ( a > Qt::Key_PageDown && a < Qt::Key_Shift )
- || ( a > Qt::Key_ScrollLock && a < Qt::Key_F1 ) ) {
- // There is no representation for these values
- continue;
- }
- if ( a == Qt::Key_Backtab ) // Actually SHIFT+Tab
- QTest::newRow( QString("key - %1").arg( a ).toLatin1() ) << int(Qt::Key_Tab) << FALSE << "";
- else
- QTest::newRow( QString("key - %1").arg( a ).toLatin1() ) << a << FALSE << "";
- }
-
- for ( a = Qt::Key_Space; a < Qt::Key_ydiaeresis; a++ ) {
- QTest::newRow( QString("key - %1").arg( a ).toLatin1() ) << a << TRUE << QString( QChar(a) );
- }
-}
-
-void tst_QKeyEvent::standardKey()
-{
-
-}
-
-void tst_QKeyEvent::sendRecieveKeyEvents()
-{
- QSKIP( "Skipped while it is being worked on", SkipAll);
- QFETCH( int, key );
- QFETCH( bool, textExpected );
- QFETCH( QString, text );
- testWidget->recievedKeyPress = FALSE;
-
-#ifdef Q_WS_WIN
- // Will be eaten by Windows system
- if ( key == Qt::Key_Print )
- return;
-
- // This is mapped to nothing on Windows
- if ( key == Qt::Key_SysReq )
- return;
-
- // Not supported on Windows
- if ( key >= Qt::Key_F25 && key <= Qt::Key_Super_R )
- return;
- if ( key >= Qt::Key_Hyper_L && key <= Qt::Key_Hyper_R )
- return;
- if ( key == Qt::Key_Help )
- return;
-
- // Not sure on how to add support for these yet
- if ( key >= Qt::Key_Direction_L && key <= Qt::Key_Direction_R )
- return;
-
- // Not sure on how to test these yet, since they use SHIFT etc
- if ( key >= Qt::Key_Exclam && key <= Qt::Key_Slash )
- return;
- if ( key >= Qt::Key_Colon && key <= Qt::Key_At )
- return;
- if ( key >= Qt::Key_BracketRight && key <= Qt::Key_ydiaeresis )
- return;
-#endif // Q_WS_WIN
-
- if ( key == Qt::Key_F1 )
- return; // Ignore for the moment
-
- QTest::keyPress( testWidget, (Qt::Key)key );
- while ( !testWidget->recievedKeyPress )
- qApp->processEvents();
- QKeyEvent* ke = testWidget->getLastKeyPress();
- QCOMPARE( ke->key(), key );
- if ( textExpected )
- QCOMPARE( ke->text(), text );
- testWidget->recievedKeyRelease = FALSE;
- QTest::keyRelease( testWidget, (Qt::Key)key );
- while ( !testWidget->recievedKeyRelease )
- qApp->processEvents();
- ke = testWidget->getLastKeyRelease();
- QCOMPARE( ke->key(), key );
- if ( textExpected )
- QCOMPARE( ke->text(), text );
-}
-
-QTEST_MAIN(tst_QKeyEvent)
-#include "tst_qkeyevent.moc"
diff --git a/tests/auto/qkeysequence/tst_qkeysequence.cpp b/tests/auto/qkeysequence/tst_qkeysequence.cpp
index 5c47da4..6deee02 100644
--- a/tests/auto/qkeysequence/tst_qkeysequence.cpp
+++ b/tests/auto/qkeysequence/tst_qkeysequence.cpp
@@ -311,15 +311,7 @@ void tst_QKeySequence::standardKeys_data()
QTest::newRow("zoomOut") << (int)QKeySequence::ZoomOut<< QString("CTRL+-");
QTest::newRow("whatsthis") << (int)QKeySequence::WhatsThis<< QString("SHIFT+F1");
-#ifndef Q_WS_MAC
- QTest::newRow("help") << (int)QKeySequence::HelpContents<< QString("F1");
- QTest::newRow("nextChild") << (int)QKeySequence::NextChild<< QString("CTRL+Tab");
- QTest::newRow("previousChild") << (int)QKeySequence::PreviousChild<< QString("CTRL+SHIFT+BACKTAB");
- QTest::newRow("forward") << (int)QKeySequence::Forward << QString("ALT+RIGHT");
- QTest::newRow("backward") << (int)QKeySequence::Back << QString("ALT+LEFT");
- QTest::newRow("MoveToEndOfBlock") << (int)QKeySequence::MoveToEndOfBlock<< QString(""); //mac only
- QTest::newRow("SelectEndOfDocument") << (int)QKeySequence::SelectEndOfDocument<< QString("CTRL+SHIFT+END"); //mac only
-#else
+#if defined(Q_WS_MAC)
QTest::newRow("help") << (int)QKeySequence::HelpContents<< QString("Ctrl+?");
QTest::newRow("nextChild") << (int)QKeySequence::NextChild << QString("CTRL+}");
QTest::newRow("previousChild") << (int)QKeySequence::PreviousChild << QString("CTRL+{");
@@ -327,6 +319,17 @@ void tst_QKeySequence::standardKeys_data()
QTest::newRow("forward") << (int)QKeySequence::Forward << QString("CTRL+]");
QTest::newRow("backward") << (int)QKeySequence::Back << QString("CTRL+[");
QTest::newRow("SelectEndOfDocument") << (int)QKeySequence::SelectEndOfDocument<< QString("CTRL+SHIFT+DOWN"); //mac only
+#elif defined(Q_WS_S60)
+ QTest::newRow("help") << (int)QKeySequence::HelpContents<< QString("F2");
+ QTest::newRow("SelectEndOfDocument") << (int)QKeySequence::SelectEndOfDocument<< QString("CTRL+SHIFT+END"); //mac only
+#else
+ QTest::newRow("help") << (int)QKeySequence::HelpContents<< QString("F1");
+ QTest::newRow("nextChild") << (int)QKeySequence::NextChild<< QString("CTRL+Tab");
+ QTest::newRow("previousChild") << (int)QKeySequence::PreviousChild<< QString("CTRL+SHIFT+BACKTAB");
+ QTest::newRow("forward") << (int)QKeySequence::Forward << QString("ALT+RIGHT");
+ QTest::newRow("backward") << (int)QKeySequence::Back << QString("ALT+LEFT");
+ QTest::newRow("MoveToEndOfBlock") << (int)QKeySequence::MoveToEndOfBlock<< QString(""); //mac only
+ QTest::newRow("SelectEndOfDocument") << (int)QKeySequence::SelectEndOfDocument<< QString("CTRL+SHIFT+END"); //mac only
#endif
}
@@ -343,7 +346,7 @@ void tst_QKeySequence::keyBindings()
{
QList<QKeySequence> bindings = QKeySequence::keyBindings(QKeySequence::Copy);
QList<QKeySequence> expected;
-#ifdef Q_WS_MAC
+#if defined(Q_WS_MAC) || defined (Q_WS_S60)
expected << QKeySequence("CTRL+C");
#elif defined Q_WS_X11
expected << QKeySequence("CTRL+C") << QKeySequence("F16") << QKeySequence("CTRL+INSERT");
@@ -504,8 +507,8 @@ void tst_QKeySequence::translated()
QFETCH(QString, compKey);
#ifdef Q_WS_MAC
QSKIP("No need to translate modifiers on Mac OS X", SkipAll);
-#elif defined(Q_OS_WINCE)
- QSKIP("No need to translate modifiers on WinCE", SkipAll);
+#elif defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+ QSKIP("No need to translate modifiers on WinCE or Symbian", SkipAll);
#endif
qApp->installTranslator(ourTranslator);
diff --git a/tests/auto/qlabel/qlabel.pro b/tests/auto/qlabel/qlabel.pro
index 141559e..c274b4a 100644
--- a/tests/auto/qlabel/qlabel.pro
+++ b/tests/auto/qlabel/qlabel.pro
@@ -3,11 +3,14 @@ SOURCES += tst_qlabel.cpp
wince*:{
DEFINES += SRCDIR=\\\"\\\"
+} !symbian {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
+}
+
+wince*|symbian {
addFiles.sources = *.png testdata
addFiles.path = .
DEPLOYMENT += addFiles
-} else {
- DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qlabel/tst_qlabel.cpp b/tests/auto/qlabel/tst_qlabel.cpp
index 6754688..3ff5bb4 100644
--- a/tests/auto/qlabel/tst_qlabel.cpp
+++ b/tests/auto/qlabel/tst_qlabel.cpp
@@ -53,6 +53,9 @@
//TESTED_CLASS=
//TESTED_FILES=
+#if defined(Q_OS_SYMBIAN)
+# define SRCDIR ""
+#endif
class Widget : public QWidget
{
diff --git a/tests/auto/qlayout/qlayout.pro b/tests/auto/qlayout/qlayout.pro
index 0c69b11..0dfe1e9 100644
--- a/tests/auto/qlayout/qlayout.pro
+++ b/tests/auto/qlayout/qlayout.pro
@@ -6,7 +6,7 @@ load(qttest_p4)
SOURCES += tst_qlayout.cpp
contains(QT_CONFIG, qt3support): QT += qt3support
-wince*: {
+wince*|symbian*: {
addFiles.sources = baseline
addFiles.path = .
DEPLOYMENT += addFiles
diff --git a/tests/auto/qlibrary/lib/lib.pro b/tests/auto/qlibrary/lib/lib.pro
index 14b8783..25a50b5 100644
--- a/tests/auto/qlibrary/lib/lib.pro
+++ b/tests/auto/qlibrary/lib/lib.pro
@@ -19,7 +19,7 @@ win32: {
copy /Y $(DESTDIR_TARGET) ..\system.trolltech.test.mylib.dll && \
copy /Y $(DESTDIR_TARGET) ..\mylib_noextension
}
-unix: {
+unix:!symbian: {
QMAKE_POST_LINK = cp -f $(DESTDIR)$(TARGET) ../libmylib.so2 && \
cp -f $(DESTDIR)$(TARGET) ../system.trolltech.test.mylib.so
}
@@ -27,4 +27,5 @@ unix: {
#no special install rule for the library used by test
INSTALLS =
+symbian: TARGET.CAPABILITY=ALL -TCB
diff --git a/tests/auto/qlibrary/lib/mylib.c b/tests/auto/qlibrary/lib/mylib.c
index 1366b7c..5e98362 100644
--- a/tests/auto/qlibrary/lib/mylib.c
+++ b/tests/auto/qlibrary/lib/mylib.c
@@ -1,6 +1,6 @@
#include <qglobal.h>
-#if defined(Q_CC_MSVC) || defined(Q_CC_MSVC_NET) || defined(Q_CC_BOR)
+#if defined(Q_CC_MSVC) || defined(Q_CC_MSVC_NET) || defined(Q_CC_BOR) || defined(Q_OS_SYMBIAN)
#define LIB_EXPORT __declspec(dllexport)
#else
#define LIB_EXPORT
@@ -12,7 +12,7 @@
# define BORLAND_STDCALL
#endif
-LIB_EXPORT int BORLAND_STDCALL version()
+LIB_EXPORT int BORLAND_STDCALL mylibversion()
{
return 1;
}
diff --git a/tests/auto/qlibrary/lib2/lib2.pro b/tests/auto/qlibrary/lib2/lib2.pro
index 718c5c6..436d7ba 100644
--- a/tests/auto/qlibrary/lib2/lib2.pro
+++ b/tests/auto/qlibrary/lib2/lib2.pro
@@ -19,11 +19,29 @@ win32: {
QMAKE_POST_LINK = copy /Y ..\mylib2.dll ..\mylib.dl2 && \
copy /Y ..\mylib2.dll ..\system.trolltech.test.mylib.dll
}
-unix: {
+
+unix:!symbian: {
QMAKE_POST_LINK = cp -f $(DESTDIR)$(TARGET) ../libmylib.so2 && \
cp -f $(DESTDIR)$(TARGET) ../system.trolltech.test.mylib.so
}
+symbian-abld: {
+ TARGET.CAPABILITY=ALL -TCB
+ FIXEDROOT = $$replace(EPOCROOT,/,\\)
+ QMAKE_POST_LINK = \
+ copy /Y $${FIXEDROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\mylib.dll $${FIXEDROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\mylib.dl2 && \
+ copy /Y $${FIXEDROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\mylib.dll $${FIXEDROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\system.trolltech.test.mylib.dll && \
+ IF NOT "$(PLATFORM)==WINSCW" copy /Y $${FIXEDROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\mylib.dll ..\tst\mylib.dl2
+}
+
+symbian-sbsv2: {
+ TARGET.CAPABILITY=ALL -TCB
+ QMAKE_POST_LINK = \
+ $(GNUCP) $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dl2 && \
+ $(GNUCP) $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/system.trolltech.test.mylib.dll && \
+ if test $(PLATFORM) != WINSCW;then $(GNUCP) $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $${PWD}/../tst/mylib.dl2; fi
+}
+
#no special install rule for the library used by test
INSTALLS =
diff --git a/tests/auto/qlibrary/lib2/mylib.c b/tests/auto/qlibrary/lib2/mylib.c
index dd90f04..4046f1f 100644
--- a/tests/auto/qlibrary/lib2/mylib.c
+++ b/tests/auto/qlibrary/lib2/mylib.c
@@ -1,6 +1,6 @@
#include <qglobal.h>
-#if defined(Q_CC_MSVC) || defined(Q_CC_MSVC_NET) || defined(Q_CC_BOR)
+#if defined(Q_CC_MSVC) || defined(Q_CC_MSVC_NET) || defined(Q_CC_BOR)|| defined(Q_OS_SYMBIAN)
#define LIB_EXPORT __declspec(dllexport)
#else
#define LIB_EXPORT
@@ -12,7 +12,7 @@
# define BORLAND_STDCALL
#endif
-LIB_EXPORT int BORLAND_STDCALL version()
+LIB_EXPORT int BORLAND_STDCALL mylibversion()
{
return 2;
}
diff --git a/tests/auto/qlibrary/qlibrary.pro b/tests/auto/qlibrary/qlibrary.pro
index f3e646a..fd5790b 100644
--- a/tests/auto/qlibrary/qlibrary.pro
+++ b/tests/auto/qlibrary/qlibrary.pro
@@ -1,8 +1,16 @@
+QT -= gui
TEMPLATE = subdirs
CONFIG += ordered
-SUBDIRS = lib \
- lib2 \
- tst
+
+symbian: {
+# Can't build two versions of lib with same name in symbian, so just build one
+SUBDIRS = lib2 \
+ tst
+} else {
+SUBDIRS = lib \
+ lib2 \
+ tst
+}
TARGET = tst_qlibrary
# no special install rule for subdir
diff --git a/tests/auto/qlibrary/tst/tst.pro b/tests/auto/qlibrary/tst/tst.pro
index 67437a6..e15d7ed 100644
--- a/tests/auto/qlibrary/tst/tst.pro
+++ b/tests/auto/qlibrary/tst/tst.pro
@@ -16,8 +16,18 @@ wince*: {
addFiles.path = .
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\"\\\"
+}else:symbian* {
+ binDep.sources = \
+ 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.path = /sys/bin
+
+ DEPLOYMENT += binDep custBinDep
} else {
DEFINES += SRCDIR=\\\"$$PWD/../\\\"
}
-
diff --git a/tests/auto/qlibrary/tst_qlibrary.cpp b/tests/auto/qlibrary/tst_qlibrary.cpp
index a5d5cbe..242ad86 100644
--- a/tests/auto/qlibrary/tst_qlibrary.cpp
+++ b/tests/auto/qlibrary/tst_qlibrary.cpp
@@ -85,7 +85,7 @@
# define SUFFIX ".a"
# define PREFIX "lib"
-#elif defined(Q_OS_WIN)
+#elif defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
# undef dll_VALID
# define dll_VALID true
# define SUFFIX ".dll"
@@ -100,8 +100,12 @@
static QString sys_qualifiedLibraryName(const QString &fileName)
{
+#if defined(Q_OS_SYMBIAN)
+ return PREFIX + fileName + SUFFIX;
+#else
QString currDir = QDir::currentPath();
return currDir + "/" + PREFIX + fileName + SUFFIX;
+#endif
}
//TESTED_CLASS=
@@ -187,13 +191,13 @@ void tst_QLibrary::version()
QFETCH( int, loadversion );
QFETCH( int, resultversion );
-#if !defined(Q_OS_AIX) && !defined(Q_OS_WIN)
+#if !defined(Q_OS_AIX) && !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN)
QString currDir = QDir::currentPath();
QLibrary library( currDir + QLatin1Char('/') + lib, loadversion );
bool ok = library.load();
QVERIFY(ok);
- VersionFunction fnVersion = (VersionFunction)library.resolve("version");
+ VersionFunction fnVersion = (VersionFunction)library.resolve("mylibversion");
QVERIFY(fnVersion);
QCOMPARE(fnVersion(), resultversion);
#else
@@ -209,7 +213,11 @@ void tst_QLibrary::load_data()
QTest::addColumn<QString>("lib");
QTest::addColumn<bool>("result");
+#if defined(Q_OS_SYMBIAN)
+ QString currDir;
+#else
QString currDir = QDir::currentPath();
+#endif
QTest::newRow( "ok00" ) << currDir + "/mylib" << (bool)true;
QTest::newRow( "notexist" ) << currDir + "/nolib" << (bool)false;
QTest::newRow( "badlibrary" ) << currDir + "/qlibrary.pro" << (bool)false;
@@ -218,7 +226,7 @@ void tst_QLibrary::load_data()
QTest::newRow("ok (libmylib ver. 1)") << currDir + "/libmylib" <<(bool)true;
#endif
-# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
+# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QTest::newRow( "ok01 (with suffix)" ) << currDir + "/mylib.dll" << (bool)true;
QTest::newRow( "ok02 (with non-standard suffix)" ) << currDir + "/mylib.dl2" << (bool)true;
QTest::newRow( "ok03 (with many dots)" ) << currDir + "/system.trolltech.test.mylib.dll" << (bool)true;
@@ -248,7 +256,12 @@ void tst_QLibrary::unload_data()
QTest::addColumn<QString>("lib");
QTest::addColumn<bool>("result");
+#if defined(Q_OS_SYMBIAN)
+ QString currDir;
+#else
QString currDir = QDir::currentPath();
+#endif
+
QTest::newRow( "mylib" ) << currDir + "/mylib" << (bool)TRUE;
#ifdef Q_WS_MAC
if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_3)
@@ -274,8 +287,12 @@ void tst_QLibrary::unload()
void tst_QLibrary::unload_after_implicit_load()
{
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("SYMBIAN does not support symbols on non-STDDLL libraries.", SkipAll);
+#endif
+
QLibrary library( "./mylib" );
- void *p = library.resolve("version");
+ void *p = library.resolve("mylibversion");
QVERIFY(p); // Check if it was loaded
QVERIFY(library.isLoaded());
QVERIFY(library.unload());
@@ -289,14 +306,23 @@ void tst_QLibrary::resolve_data()
QTest::addColumn<QString>("symbol");
QTest::addColumn<bool>("goodPointer");
+#if defined(Q_OS_SYMBIAN)
+ QString currDir;
+#else
QString currDir = QDir::currentPath();
- QTest::newRow( "ok00" ) << currDir + "/mylib" << QString("version") << (bool)TRUE;
+#endif
+
+ QTest::newRow( "ok00" ) << currDir + "/mylib" << QString("mylibversion") << (bool)TRUE;
QTest::newRow( "bad00" ) << currDir + "/mylib" << QString("nosym") << (bool)FALSE;
QTest::newRow( "bad01" ) << currDir + "/nolib" << QString("nosym") << (bool)FALSE;
}
void tst_QLibrary::resolve()
{
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("SYMBIAN does not support symbols on non-STDDLL libraries.", SkipAll);
+#endif
+
typedef int (*testFunc)();
QFETCH( QString, lib );
QFETCH( QString, symbol );
@@ -347,7 +373,7 @@ void tst_QLibrary::isLibrary_data()
QTest::newRow("good (libmylib.so.1.0.0)") << QString("libmylib.so.1.0.0") << true;
QTest::newRow("bad (libmylib.1.0.0.foo)") << QString("libmylib.1.0.0.foo") << false;
-#elif defined(Q_OS_WIN)
+#elif defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
QTest::newRow("good (with many dots)" ) << "/system.trolltech.test.mylib.dll" << true;
#endif
}
@@ -367,10 +393,15 @@ void tst_QLibrary::errorString_data()
QTest::addColumn<bool>("success");
QTest::addColumn<QString>("errorString");
+#if defined(Q_OS_SYMBIAN)
+ QString currDir;
+#else
QString currDir = QDir::currentPath();
+
QString srcDir = SRCDIR;
if (srcDir.isEmpty())
srcDir = currDir;
+#endif
QTest::newRow("bad load()") << (int)Load << QString("nosuchlib") << false << QString("Cannot load library nosuchlib: .*");
QTest::newRow("call errorString() on QLibrary with no d-pointer (crashtest)") << (int)(Load | DontSetFileName) << QString() << false << QString("Unknown error");
@@ -385,6 +416,8 @@ void tst_QLibrary::errorString_data()
QTest::newRow("bad load() with .dll suffix") << (int)Load << QString("nosuchlib.dll") << false << QString("Cannot load library nosuchlib.dll: The specified module could not be found.");
// QTest::newRow("bad unload") << (int)Unload << QString("nosuchlib.dll") << false << QString("QLibrary::unload_sys: Cannot unload nosuchlib.dll (The specified module could not be found.)");
#elif defined Q_OS_MAC
+#elif defined Q_OS_SYMBIAN
+ QTest::newRow("load invalid file") << (int)Load << "tst_qlibrary.exe" << false << QString("Cannot load library.*");
#else
QTest::newRow("load invalid file") << (int)Load << srcDir + "/library_path/invalid.so" << false << QString("Cannot load library.*");
#endif
@@ -397,6 +430,13 @@ void tst_QLibrary::errorString()
QFETCH(bool, success);
QFETCH(QString, errorString);
+#if defined(Q_OS_SYMBIAN)
+ if ( success )
+ {
+ QSKIP("SYMBIAN does not support symbols on non-STDDLL libraries.", SkipSingle );
+ }
+#endif
+
QLibrary lib;
if (!(operation & DontSetFileName)) {
lib.setFileName(fileName);
@@ -415,7 +455,7 @@ void tst_QLibrary::errorString()
ok = lib.load();
QCOMPARE(ok, true);
if (success) {
- ok = lib.resolve("version");
+ ok = lib.resolve("mylibversion");
} else {
ok = lib.resolve("nosuchsymbol");
}
@@ -446,9 +486,14 @@ void tst_QLibrary::loadHints_data()
}
#endif
+#if defined(Q_OS_SYMBIAN)
+ QString currDir;
+#else
QString currDir = QDir::currentPath();
+#endif
+
lh |= QLibrary::ResolveAllSymbolsHint;
-# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
+# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QTest::newRow( "ok01 (with suffix)" ) << currDir + "/mylib.dll" << int(lh) << (bool)TRUE;
QTest::newRow( "ok02 (with non-standard suffix)" ) << currDir + "/mylib.dl2" << int(lh) << (bool)TRUE;
QTest::newRow( "ok03 (with many dots)" ) << currDir + "/system.trolltech.test.mylib.dll" << int(lh) << (bool)TRUE;
@@ -486,7 +531,6 @@ void tst_QLibrary::fileName_data()
QTest::addColumn<QString>("libName");
QTest::addColumn<QString>("expectedFilename");
- QString currDir = QDir::currentPath();
QTest::newRow( "ok02" ) << sys_qualifiedLibraryName(QLatin1String("mylib"))
<< sys_qualifiedLibraryName(QLatin1String("mylib"));
#ifdef Q_WS_WIN
@@ -518,7 +562,12 @@ void tst_QLibrary::fileName()
void tst_QLibrary::multipleInstancesForOneLibrary()
{
+#if defined(Q_OS_SYMBIAN)
+ QString lib = "/mylib";
+#else
QString lib = QDir::currentPath() + "/mylib";
+#endif
+
QLibrary lib1(lib);
QLibrary lib2(lib);
QCOMPARE(lib1.isLoaded(), false);
diff --git a/tests/auto/qline/qline.pro b/tests/auto/qline/qline.pro
index 56718d0..1a3d7f2 100644
--- a/tests/auto/qline/qline.pro
+++ b/tests/auto/qline/qline.pro
@@ -1,6 +1,6 @@
load(qttest_p4)
QT -= gui
SOURCES += tst_qline.cpp
-unix:!mac:!vxworks:LIBS+=-lm
+unix:!mac:!symbian*:!vxworks:LIBS+=-lm
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index 3525865..1616154 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -220,10 +220,11 @@ private slots:
void setSelection_data();
void setSelection();
+#ifndef QT_NO_CLIPBOARD
void cut();
void copy();
void paste();
-
+#endif
void maxLengthAndInputMask();
void returnPressedKeyEvent();
@@ -2750,6 +2751,7 @@ void tst_QLineEdit::setSelection()
QCOMPARE(testWidget->cursorPosition(), expectedCursor);
}
+#ifndef QT_NO_CLIPBOARD
void tst_QLineEdit::cut()
{
#ifdef Q_WS_MAC
@@ -2830,7 +2832,7 @@ void tst_QLineEdit::paste()
{
DEPENDS_ON("cut");
}
-
+#endif
class InputMaskValidator : public QValidator
{
public:
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp
index 2abf198..533dff1 100644
--- a/tests/auto/qlistview/tst_qlistview.cpp
+++ b/tests/auto/qlistview/tst_qlistview.cpp
@@ -48,7 +48,9 @@
#include <qitemdelegate.h>
#include <qstandarditemmodel.h>
#include <qstringlistmodel.h>
+#ifndef Q_OS_SYMBIAN
#include <cmath>
+#endif
#include <math.h>
#include <QtGui/QScrollBar>
#include <QtGui/QDialog>
diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp
index 0ca94bf..6cbe9ca 100644
--- a/tests/auto/qlistwidget/tst_qlistwidget.cpp
+++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp
@@ -1437,6 +1437,10 @@ public:
void tst_QListWidget::fastScroll()
{
+ if (qstrcmp(QApplication::style()->metaObject()->className(), "QS60Style") == 0) {
+ QSKIP("S60 style doesn't support fast scrolling", SkipAll);
+ }
+
MyListWidget widget;
for (int i = 0; i < 50; ++i)
widget.addItem(QString("Item %1").arg(i));
diff --git a/tests/auto/qlocale/test/test.pro b/tests/auto/qlocale/test/test.pro
index b840e2d..7bc9f59 100644
--- a/tests/auto/qlocale/test/test.pro
+++ b/tests/auto/qlocale/test/test.pro
@@ -29,3 +29,11 @@ wince*: {
DEPLOYMENT += addFiles
}
+symbian:contains(S60_VERSION,3.2) {
+ # This test case compilation crashes on 3.2 for gcce if paging is on
+ MMP_RULES -= PAGED
+ custom_paged_rule = "$${LITERAL_HASH}ifndef GCCE"\
+ "PAGED" \
+ "$${LITERAL_HASH}endif"
+ MMP_RULES += custom_paged_rule
+} \ No newline at end of file
diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp
index e920b2b..642e655 100644
--- a/tests/auto/qlocale/tst_qlocale.cpp
+++ b/tests/auto/qlocale/tst_qlocale.cpp
@@ -68,6 +68,11 @@ extern "C" DWORD GetThreadLocale(void) {
# include <stdlib.h>
#endif
+#if defined(Q_OS_SYMBIAN)
+# include <e32std.h>
+# include <private/qcore_symbian_p.h>
+#endif
+
Q_DECLARE_METATYPE(qlonglong)
Q_DECLARE_METATYPE(QDate)
Q_DECLARE_METATYPE(QLocale::FormatType)
@@ -130,6 +135,9 @@ private slots:
void queryDateTime();
void queryMeasureSystem_data();
void queryMeasureSystem();
+#if defined(Q_OS_SYMBIAN)
+ void symbianSystemLocale();
+#endif
void ampm();
@@ -317,8 +325,8 @@ void tst_QLocale::ctor()
void tst_QLocale::emptyCtor()
{
-#ifdef Q_OS_WINCE
- QSKIP("Uses unsupported Windows CE QProcess functionality", SkipAll);
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+ QSKIP("Uses unsupported Windows CE / Symbian QProcess functionality (std streams, env)", SkipAll);
#endif
#if defined(QT_NO_PROCESS)
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
@@ -667,7 +675,7 @@ void tst_QLocale::testInfAndNan()
double nan = sqrt(-1.0);
#ifdef Q_OS_WIN
- // these causes INVALID floating point exception so we want to clare the status.
+ // these cause INVALID floating point exception so we want to clear the status.
_clear87();
#endif
@@ -1060,11 +1068,11 @@ void tst_QLocale::macDefaultLocale()
QTime utcTime = QDateTime::currentDateTime().toUTC().time();
int diff = currentTime.hour() - utcTime.hour();
-
+
// Check if local time and utc time are on opposite sides of the 24-hour wrap-around.
- if (diff < -12)
+ if (diff < -12)
diff += 24;
- if (diff > 12)
+ if (diff > 12)
diff -= 24;
const QString timeString = locale.toString(QTime(1,2,3), QLocale::LongFormat);
@@ -1720,7 +1728,7 @@ void tst_QLocale::systemMeasurementSystems()
// Theoretically, we could include HPUX in this test, but its setenv implementation
// stinks. It's called putenv, and it requires you to keep the variable you pass
// to it around forever.
-#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_SYMBIAN)
QFETCH(QString, lcAllLocale);
QFETCH(QString, lcMeasurementLocale);
QFETCH(QString, langLocale);
@@ -1744,7 +1752,7 @@ void tst_QLocale::systemMeasurementSystems()
qputenv("LC_MEASUREMENT", oldLcMeasurement.toLocal8Bit());
qputenv("LANG", oldLang.toLocal8Bit());
#else
- QSKIP("Test doesn't work on Mac or Windows", SkipAll);
+ QSKIP("Test doesn't work on Mac, Windows or Symbian", SkipAll);
#endif
}
@@ -1842,7 +1850,7 @@ void tst_QLocale::queryMeasureSystem()
// Theoretically, we could include HPUX in this test, but its setenv implementation
// stinks. It's called putenv, and it requires you to keep the variable you pass
// to it around forever.
-#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_SYMBIAN)
QFETCH(QString, lcAllLocale);
QFETCH(QString, lcMeasurementLocale);
QFETCH(QString, langLocale);
@@ -1866,7 +1874,7 @@ void tst_QLocale::queryMeasureSystem()
qputenv("LC_MEASUREMENT", oldLcMeasurement.toLocal8Bit());
qputenv("LANG", oldLang.toLocal8Bit());
#else
- QSKIP("Test doesn't work on Mac or Windows", SkipAll);
+ QSKIP("Test doesn't work on Mac, Windows or Symbian", SkipAll);
#endif
}
#endif // QT_NO_SYSTEMLOCALE
@@ -1983,5 +1991,33 @@ void tst_QLocale::standaloneMonthName()
QCOMPARE(ru.standaloneMonthName(1, QLocale::NarrowFormat), QString::fromUtf8("\320\257"));
}
+#if defined(Q_OS_SYMBIAN)
+void tst_QLocale::symbianSystemLocale()
+{
+# if defined(__SERIES60_31__)
+ QSKIP("S60 3.1 doesn't support system format properly", SkipAll);
+# else
+ // Simple test to verify that Symbian system locale works at all
+ const QSystemLocale locale;
+ TExtendedLocale s60Locale;
+ s60Locale.LoadSystemSettings();
+
+ TTime s60Date(_L("20090117:")); // Symbian offsets day and month from zero
+ QDate date(2009,2,18);
+
+ TPtrC s60DateFormat = s60Locale.GetShortDateFormatSpec();
+ QString dateFormat = locale.query(QSystemLocale::DateFormatShort, QVariant()).toString();
+
+ TBuf<50> s60FormattedDate;
+ TRAPD(err, s60Date.FormatL(s60FormattedDate, s60DateFormat));
+ QVERIFY(err == KErrNone);
+ QString s60FinalResult = qt_TDesC2QString(s60FormattedDate);
+ QString finalResult = date.toString(dateFormat);
+
+ QCOMPARE(finalResult, s60FinalResult);
+# endif
+}
+#endif
+
QTEST_APPLESS_MAIN(tst_QLocale)
#include "tst_qlocale.moc"
diff --git a/tests/auto/qlocalsocket/lackey/lackey.pro b/tests/auto/qlocalsocket/lackey/lackey.pro
index 7460d8c..7bb6bc3 100644
--- a/tests/auto/qlocalsocket/lackey/lackey.pro
+++ b/tests/auto/qlocalsocket/lackey/lackey.pro
@@ -12,7 +12,7 @@ mac:CONFIG -= app_bundle
DEFINES += QLOCALSERVER_DEBUG
DEFINES += QLOCALSOCKET_DEBUG
-SOURCES += main.cpp
+SOURCES += main.cpp
TARGET = lackey
-
+symbian:TARGET.CAPABILITY = ALL -TCB \ No newline at end of file
diff --git a/tests/auto/qlocalsocket/lackey/main.cpp b/tests/auto/qlocalsocket/lackey/main.cpp
index 0506793..181e6be 100644
--- a/tests/auto/qlocalsocket/lackey/main.cpp
+++ b/tests/auto/qlocalsocket/lackey/main.cpp
@@ -41,7 +41,7 @@
#include <qscriptengine.h>
-#include <QtGui/QtGui>
+ #include <QFile>
#include <QTest>
#include <qlocalsocket.h>
diff --git a/tests/auto/qlocalsocket/qlocalsocket.pro b/tests/auto/qlocalsocket/qlocalsocket.pro
index 4df17de..0849453 100644
--- a/tests/auto/qlocalsocket/qlocalsocket.pro
+++ b/tests/auto/qlocalsocket/qlocalsocket.pro
@@ -1,3 +1,3 @@
TEMPLATE = subdirs
SUBDIRS = lackey test
-!wince*: SUBDIRS += example
+!wince*:!symbian*: SUBDIRS += example
diff --git a/tests/auto/qlocalsocket/test/test.pro b/tests/auto/qlocalsocket/test/test.pro
index 7befdf9..503f769 100644
--- a/tests/auto/qlocalsocket/test/test.pro
+++ b/tests/auto/qlocalsocket/test/test.pro
@@ -2,11 +2,14 @@ load(qttest_p4)
DEFINES += QLOCALSERVER_DEBUG
DEFINES += QLOCALSOCKET_DEBUG
-!wince*: {
- DEFINES += SRCDIR=\\\"$$PWD/../\\\"
-} else {
+
+symbian {
+ # nothing
+} else:wince* {
DEFINES += QT_LOCALSOCKET_TCP
DEFINES += SRCDIR=\\\"../\\\"
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD/../\\\"
}
QT = core network
@@ -27,6 +30,16 @@ CONFIG(debug_and_release) {
wince* {
additionalFiles.sources = ../lackey/lackey.exe
additionalFiles.path = lackey
+}
+
+symbian {
+ additionalFiles.sources = 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.path = lackey/scripts
DEPLOYMENT = additionalFiles scriptFiles
diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
index 98e9023..3c42ecb 100644
--- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
@@ -47,9 +47,16 @@
#include <QtNetwork/qlocalserver.h>
#include "../../shared/util.h"
+#ifdef Q_OS_SYMBIAN
+ #include <unistd.h>
+#endif
//TESTED_CLASS=QLocalServer, QLocalSocket
//TESTED_FILES=network/socket/qlocalserver.cpp network/socket/qlocalsocket.cpp
-
+#ifdef Q_OS_SYMBIAN
+ #define STRINGIFY(x) #x
+ #define TOSTRING(x) STRINGIFY(x)
+ #define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/"
+#endif
Q_DECLARE_METATYPE(QLocalSocket::LocalSocketError)
Q_DECLARE_METATYPE(QLocalSocket::LocalSocketState)
@@ -80,8 +87,6 @@ private slots:
void sendData_data();
void sendData();
- void readBufferOverflow();
-
void fullPath();
void hitMaximumConnections_data();
@@ -97,17 +102,17 @@ private slots:
void longPath();
void waitForDisconnect();
- void waitForDisconnectByServer();
void removeServer();
void recycleServer();
- void multiConnect();
- void writeOnlySocket();
-
void debug();
+#ifdef Q_OS_SYMBIAN
+private:
+ void unlink(QString serverName);
+#endif
};
tst_QLocalSocket::tst_QLocalSocket()
@@ -142,13 +147,7 @@ public:
LocalServer() : QLocalServer()
{
connect(this, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
- }
-
- bool listen(const QString &name)
- {
- removeServer(name);
- return QLocalServer::listen(name);
- }
+ };
QList<int> hits;
@@ -294,6 +293,9 @@ void tst_QLocalSocket::listen()
QSignalSpy spyNewConnection(&server, SIGNAL(newConnection()));
QFETCH(QString, name);
+#ifdef Q_OS_SYMBIAN
+ unlink(name);
+#endif
QFETCH(bool, canListen);
QFETCH(bool, close);
QVERIFY2((server.listen(name) == canListen), server.errorString().toLatin1().constData());
@@ -344,7 +346,9 @@ void tst_QLocalSocket::listenAndConnect()
QFETCH(QString, name);
QFETCH(bool, canListen);
-
+#ifdef Q_OS_SYMBIAN
+ unlink(name);
+#endif
QCOMPARE(server.listen(name), canListen);
QTest::qWait(1000);
//QVERIFY(!server.errorString().isEmpty());
@@ -364,7 +368,7 @@ void tst_QLocalSocket::listenAndConnect()
QSignalSpy spyReadyRead(socket, SIGNAL(readyRead()));
socket->connectToServer(name);
-#ifdef QT_LOCALSOCKET_TCP
+#if defined(QT_LOCALSOCKET_TCP) || defined (Q_OS_SYMBIAN)
QTest::qWait(250);
#endif
@@ -467,6 +471,9 @@ void tst_QLocalSocket::sendData_data()
void tst_QLocalSocket::sendData()
{
QFETCH(QString, name);
+#ifdef Q_OS_SYMBIAN
+ unlink(name);
+#endif
QFETCH(bool, canListen);
LocalServer server;
@@ -484,8 +491,10 @@ void tst_QLocalSocket::sendData()
// test creating a connection
socket.connectToServer(name);
bool timedOut = true;
+
QCOMPARE(server.waitForNewConnection(3000, &timedOut), canListen);
-#ifdef QT_LOCALSOCKET_TCP
+
+#if defined(QT_LOCALSOCKET_TCP) || defined(Q_OS_SYMBIAN)
QTest::qWait(250);
#endif
QVERIFY(!timedOut);
@@ -495,7 +504,11 @@ void tst_QLocalSocket::sendData()
// test sending/receiving data
if (server.hasPendingConnections()) {
QString testLine = "test";
+#ifdef Q_OS_SYMBIAN
+ for (int i = 0; i < 25 * 1024; ++i)
+#else
for (int i = 0; i < 50000; ++i)
+#endif
testLine += "a";
QLocalSocket *serverSocket = server.nextPendingConnection();
QVERIFY(serverSocket);
@@ -516,7 +529,9 @@ void tst_QLocalSocket::sendData()
QCOMPARE(spyReadyRead.count(), 1);
QVERIFY(testLine.startsWith(in.readLine()));
+
QVERIFY(wrote || serverSocket->waitForBytesWritten(1000));
+
QCOMPARE(serverSocket->errorString(), QString("Unknown error"));
QCOMPARE(socket.errorString(), QString("Unknown error"));
}
@@ -534,46 +549,14 @@ void tst_QLocalSocket::sendData()
QCOMPARE(spy.count(), (canListen ? 1 : 0));
}
-void tst_QLocalSocket::readBufferOverflow()
-{
- const int readBufferSize = 128;
- const int dataBufferSize = readBufferSize * 2;
- const QString serverName = QLatin1String("myPreciousTestServer");
- LocalServer server;
- server.listen(serverName);
- QVERIFY(server.isListening());
-
- LocalSocket client;
- client.setReadBufferSize(readBufferSize);
- client.connectToServer(serverName);
-
- bool timedOut = true;
- QVERIFY(server.waitForNewConnection(3000, &timedOut));
- QVERIFY(!timedOut);
-
- QCOMPARE(client.state(), QLocalSocket::ConnectedState);
- QVERIFY(server.hasPendingConnections());
-
- QLocalSocket* serverSocket = server.nextPendingConnection();
- char buffer[dataBufferSize];
- memset(buffer, 0, dataBufferSize);
- serverSocket->write(buffer, dataBufferSize);
- serverSocket->flush();
-
- QVERIFY(client.waitForReadyRead());
- QCOMPARE(client.read(buffer, readBufferSize), qint64(readBufferSize));
-#ifdef QT_LOCALSOCKET_TCP
- QTest::qWait(250);
-#endif
- QCOMPARE(client.read(buffer, readBufferSize), qint64(readBufferSize));
-}
-
// QLocalSocket/Server can take a name or path, check that it works as expected
void tst_QLocalSocket::fullPath()
{
- LocalServer server;
+ QLocalServer server;
QString name = "qlocalsocket_pathtest";
-#if defined(QT_LOCALSOCKET_TCP)
+#if defined(Q_OS_SYMBIAN)
+ QString path = "";
+#elif defined(QT_LOCALSOCKET_TCP)
QString path = "QLocalServer";
#elif defined(Q_OS_WIN)
QString path = "\\\\.\\pipe\\";
@@ -587,6 +570,10 @@ void tst_QLocalSocket::fullPath()
LocalSocket socket;
socket.connectToServer(serverName);
+#if defined (Q_OS_SYMBIAN)
+ QTest::qWait(250);
+#endif
+
QCOMPARE(socket.serverName(), serverName);
QCOMPARE(socket.fullServerName(), serverName);
socket.disconnectFromServer();
@@ -610,6 +597,9 @@ void tst_QLocalSocket::hitMaximumConnections()
QFETCH(int, max);
LocalServer server;
QString name = "tst_localsocket";
+#ifdef Q_OS_SYMBIAN
+ unlink(name);
+#endif
server.setMaxPendingConnections(max);
QVERIFY2(server.listen(name), server.errorString().toLatin1().constData());
int connections = server.maxPendingConnections() + 1;
@@ -723,14 +713,24 @@ void tst_QLocalSocket::threadedConnection_data()
void tst_QLocalSocket::threadedConnection()
{
+#ifdef Q_OS_SYMBIAN
+ unlink("qlocalsocket_threadtest");
+#endif
+
QFETCH(int, threads);
Server server;
+#if defined(Q_OS_SYMBIAN)
+ server.setStackSize(0x14000);
+#endif
server.clients = threads;
server.start();
QList<Client*> clients;
for (int i = 0; i < threads; ++i) {
clients.append(new Client());
+#if defined(Q_OS_SYMBIAN)
+ clients.last()->setStackSize(0x14000);
+#endif
clients.last()->start();
}
@@ -759,7 +759,7 @@ void tst_QLocalSocket::processConnection_data()
*/
void tst_QLocalSocket::processConnection()
{
-#if defined(QT_NO_PROCESS)
+#if defined(QT_NO_PROCESS) || defined(Q_CC_NOKIAX86)
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
#else
QFETCH(int, processes);
@@ -814,6 +814,9 @@ void tst_QLocalSocket::longPath()
void tst_QLocalSocket::waitForDisconnect()
{
QString name = "tst_localsocket";
+#ifdef Q_OS_SYMBIAN
+ unlink(name);
+#endif
LocalServer server;
QVERIFY(server.listen(name));
LocalSocket socket;
@@ -829,25 +832,6 @@ void tst_QLocalSocket::waitForDisconnect()
QVERIFY(timer.elapsed() < 2000);
}
-void tst_QLocalSocket::waitForDisconnectByServer()
-{
- QString name = "tst_localsocket";
- LocalServer server;
- QVERIFY(server.listen(name));
- LocalSocket socket;
- QSignalSpy spy(&socket, SIGNAL(disconnected()));
- QVERIFY(spy.isValid());
- socket.connectToServer(name);
- QVERIFY(socket.waitForConnected(3000));
- QVERIFY(server.waitForNewConnection(3000));
- QLocalSocket *serverSocket = server.nextPendingConnection();
- QVERIFY(serverSocket);
- serverSocket->close();
- QVERIFY(serverSocket->state() == QLocalSocket::UnconnectedState);
- QVERIFY(socket.waitForDisconnected(3000));
- QCOMPARE(spy.count(), 1);
-}
-
void tst_QLocalSocket::removeServer()
{
// this is a hostile takeover, but recovering from a crash results in the same
@@ -865,7 +849,11 @@ void tst_QLocalSocket::removeServer()
void tst_QLocalSocket::recycleServer()
{
- LocalServer server;
+#ifdef Q_OS_SYMBIAN
+ unlink("recycletest1");
+#endif
+
+ QLocalServer server;
QLocalSocket client;
QVERIFY(server.listen("recycletest1"));
@@ -885,54 +873,35 @@ void tst_QLocalSocket::recycleServer()
QVERIFY(server.nextPendingConnection() != 0);
}
-void tst_QLocalSocket::multiConnect()
+void tst_QLocalSocket::debug()
{
- QLocalServer server;
- QLocalSocket client1;
- QLocalSocket client2;
- QLocalSocket client3;
-
- QVERIFY(server.listen("multiconnect"));
-
- client1.connectToServer("multiconnect");
- client2.connectToServer("multiconnect");
- client3.connectToServer("multiconnect");
-
- QVERIFY(client1.waitForConnected(201));
- QVERIFY(client2.waitForConnected(202));
- QVERIFY(client3.waitForConnected(203));
-
- QVERIFY(server.waitForNewConnection(201));
- QVERIFY(server.nextPendingConnection() != 0);
- QVERIFY(server.waitForNewConnection(202));
- QVERIFY(server.nextPendingConnection() != 0);
- QVERIFY(server.waitForNewConnection(203));
- QVERIFY(server.nextPendingConnection() != 0);
+ // Make sure this compiles
+ qDebug() << QLocalSocket::ConnectionRefusedError << QLocalSocket::UnconnectedState;
}
-void tst_QLocalSocket::writeOnlySocket()
+#ifdef Q_OS_SYMBIAN
+void tst_QLocalSocket::unlink(QString name)
{
- QLocalServer server;
- QVERIFY(server.listen("writeOnlySocket"));
-
- QLocalSocket client;
- client.connectToServer("writeOnlySocket", QIODevice::WriteOnly);
- QVERIFY(client.waitForConnected());
+ if(name.length() == 0)
+ return;
- QVERIFY(server.waitForNewConnection());
- QLocalSocket* serverSocket = server.nextPendingConnection();
- QVERIFY(serverSocket);
+ QString fullName;
+ // determine the full server path
+ if (name.startsWith(QLatin1Char('/'))) {
+ fullName = name;
+ } else {
+ fullName = QDir::cleanPath(QDir::tempPath());
+ fullName += QLatin1Char('/') + name;
+ fullName = QDir::toNativeSeparators(fullName);
+ }
- QCOMPARE(client.bytesAvailable(), qint64(0));
- QCOMPARE(client.state(), QLocalSocket::ConnectedState);
-}
+ int result = ::unlink(fullName.toUtf8().data());
-void tst_QLocalSocket::debug()
-{
- // Make sure this compiles
- qDebug() << QLocalSocket::ConnectionRefusedError << QLocalSocket::UnconnectedState;
+ if(result != 0) {
+ qWarning() << "Unlinking " << fullName << " failed with " << strerror(errno);
+ }
}
-
+#endif
QTEST_MAIN(tst_QLocalSocket)
#include "tst_qlocalsocket.moc"
diff --git a/tests/auto/qmainwindow/qmainwindow.pro b/tests/auto/qmainwindow/qmainwindow.pro
index b1cbd16..43d73ae 100644
--- a/tests/auto/qmainwindow/qmainwindow.pro
+++ b/tests/auto/qmainwindow/qmainwindow.pro
@@ -1,5 +1,6 @@
load(qttest_p4)
SOURCES += tst_qmainwindow.cpp
-
+# Symbian toolchain does not support correct include semantics
+symbian:INCPATH+=..\..\..\include\QtGui\private
diff --git a/tests/auto/qmap/qmap.pro b/tests/auto/qmap/qmap.pro
index 5b61272..00b84d1 100644
--- a/tests/auto/qmap/qmap.pro
+++ b/tests/auto/qmap/qmap.pro
@@ -3,6 +3,4 @@ load(qttest_p4)
QT = core
SOURCES += tst_qmap.cpp
-
-
-
+QT = core
diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp
index 90b9a2a..13aa2b8 100644
--- a/tests/auto/qmenu/tst_qmenu.cpp
+++ b/tests/auto/qmenu/tst_qmenu.cpp
@@ -425,8 +425,11 @@ void tst_QMenu::overrideMenuAction()
QSKIP("On Mac, we need to create native key events to test menu action activation", SkipAll);
#elif defined(Q_OS_WINCE)
QSKIP("On Windows CE, we need to create native key events to test menu action activation", SkipAll);
+#elif defined(Q_OS_SYMBIAN)
+ QSKIP("On Symbian OS, we need to create native key events to test menu action activation", SkipAll);
#endif
- QAction *aQuit = new QAction("Quit", &w);
+
+ QAction *aQuit = new QAction("Quit", &w);
aQuit->setShortcut(QKeySequence("Ctrl+X"));
m->addAction(aQuit);
@@ -443,7 +446,7 @@ void tst_QMenu::overrideMenuAction()
delete aFileMenu;
- //after the deletion of the override menu action,
+ //after the deletion of the override menu action,
//the menu should have its default menu action back
QCOMPARE(m->menuAction(), menuaction);
@@ -472,7 +475,7 @@ void tst_QMenu::statusTip()
QVERIFY(btn != NULL);
- //because showMenu calls QMenu::exec, we need to use a singleshot
+ //because showMenu calls QMenu::exec, we need to use a singleshot
//to continue the test
QTimer::singleShot(200,this, SLOT(onStatusTipTimer()));
btn->showMenu();
@@ -486,10 +489,10 @@ void tst_QMenu::onStatusTipTimer()
QVERIFY(menu != 0);
QVERIFY(menu->isVisible());
QTest::keyClick(menu, Qt::Key_Down);
-
+
//we store the statustip to press escape in any case
//otherwise, if the test fails it blocks (never gets out of QMenu::exec
- const QString st=statustip;
+ const QString st=statustip;
menu->close(); //goes out of the menu
@@ -554,10 +557,10 @@ void tst_QMenu::tearOff()
menu->popup(QPoint(0,0));
QTest::qWait(50);
QVERIFY(!menu->isTearOffMenuVisible());
-
+
QTest::mouseClick(menu, Qt::LeftButton, 0, QPoint(3, 3), 10);
QTest::qWait(100);
-
+
QVERIFY(menu->isTearOffMenuVisible());
QPointer<QMenu> torn = 0;
foreach (QWidget *w, QApplication::allWidgets()) {
@@ -640,7 +643,11 @@ void tst_QMenu::activeSubMenuPosition()
main->setActiveAction(menuAction);
sub->setActiveAction(subAction);
+#ifdef Q_OS_SYMBIAN
+ main->popup(QPoint(50,200));
+#else
main->popup(QPoint(200,200));
+#endif
QVERIFY(main->isVisible());
QCOMPARE(main->activeAction(), menuAction);
diff --git a/tests/auto/qmenubar/qmenubar.pro b/tests/auto/qmenubar/qmenubar.pro
index 51cf21d..a0a6420 100644
--- a/tests/auto/qmenubar/qmenubar.pro
+++ b/tests/auto/qmenubar/qmenubar.pro
@@ -2,5 +2,5 @@ load(qttest_p4)
HEADERS +=
SOURCES += tst_qmenubar.cpp
-contains(QT_CONFIG, qt3support):QT += qt3support
+contains(QT_CONFIG, qt3support):!symbian*:QT += qt3support
diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp
index ec8ff5f..8c77933 100644
--- a/tests/auto/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/qmenubar/tst_qmenubar.cpp
@@ -466,6 +466,10 @@ void tst_QMenuBar::accel_noQt3()
#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM)
QSKIP("On Mac/WinCE, native key events are needed to test menu action activation", SkipAll);
#endif
+#ifdef Q_OS_SYMBIAN
+ QSKIP("On Symbian OS, native key events are needed to test menu action activation", SkipAll);
+#endif
+
// create a popup menu with menu items set the accelerators later...
initSimpleMenubar_noQt3();
// QTest::keyClick( 0, Qt::Key_A, AltKey );
diff --git a/tests/auto/qmetatype/qmetatype.pro b/tests/auto/qmetatype/qmetatype.pro
index 20ec3b8..a84d238 100644
--- a/tests/auto/qmetatype/qmetatype.pro
+++ b/tests/auto/qmetatype/qmetatype.pro
@@ -1,6 +1,3 @@
load(qttest_p4)
SOURCES += tst_qmetatype.cpp
-
QT = core
-
-
diff --git a/tests/auto/qmouseevent/tst_qmouseevent.cpp b/tests/auto/qmouseevent/tst_qmouseevent.cpp
index 4cfb4f5..9e9f76c 100644
--- a/tests/auto/qmouseevent/tst_qmouseevent.cpp
+++ b/tests/auto/qmouseevent/tst_qmouseevent.cpp
@@ -205,7 +205,7 @@ void tst_QMouseEvent::checkMousePressEvent()
int buttons = button;
int modifiers = keyPressed;
- QTest::mousePress(testMouseWidget, (Qt::MouseButton)buttonPressed, (Qt::KeyboardModifiers)keyPressed);
+ QTest::mousePress(testMouseWidget, Qt::MouseButton(buttonPressed), Qt::KeyboardModifiers(keyPressed));
QVERIFY(testMouseWidget->mousePressEventRecieved);
QCOMPARE(testMouseWidget->mousePressButton, button);
QCOMPARE(testMouseWidget->mousePressButtons, buttons);
@@ -218,7 +218,7 @@ void tst_QMouseEvent::checkMousePressEvent()
QCOMPARE(testMouseWidget->mousePressStateAfter, stateAfter);
#endif
- QTest::mouseRelease(testMouseWidget, (Qt::MouseButton)buttonPressed, (Qt::KeyboardModifiers)keyPressed);
+ QTest::mouseRelease(testMouseWidget, Qt::MouseButton(buttonPressed), Qt::KeyboardModifiers(keyPressed));
}
void tst_QMouseEvent::checkMouseReleaseEvent_data()
@@ -251,7 +251,7 @@ void tst_QMouseEvent::checkMouseReleaseEvent()
int buttons = 0;
int modifiers = keyPressed;
- QTest::mouseClick(testMouseWidget, (Qt::MouseButton)buttonReleased, (Qt::KeyboardModifiers)keyPressed);
+ QTest::mouseClick(testMouseWidget, Qt::MouseButton(buttonReleased), Qt::KeyboardModifiers(keyPressed));
QVERIFY(testMouseWidget->mouseReleaseEventRecieved);
QCOMPARE(testMouseWidget->mouseReleaseButton, button);
QCOMPARE(testMouseWidget->mouseReleaseButtons, buttons);
diff --git a/tests/auto/qmovie/qmovie.pro b/tests/auto/qmovie/qmovie.pro
index 765966e..15f0c83 100644
--- a/tests/auto/qmovie/qmovie.pro
+++ b/tests/auto/qmovie/qmovie.pro
@@ -12,3 +12,13 @@ wince*: {
DEPLOYMENT += addFiles
}
+
+symbian*: {
+ addFiles.sources = animations\*
+ addFiles.path = animations
+ DEPLOYMENT += addFiles
+
+ imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll
+ imagePlugins.path = imageformats
+ DEPLOYMENT += imagePlugins
+} \ No newline at end of file
diff --git a/tests/auto/qmultiscreen/qmultiscreen.pro b/tests/auto/qmultiscreen/qmultiscreen.pro
index 30666d7..4e92a65 100644
--- a/tests/auto/qmultiscreen/qmultiscreen.pro
+++ b/tests/auto/qmultiscreen/qmultiscreen.pro
@@ -1,5 +1,6 @@
load(qttest_p4)
SOURCES += tst_qmultiscreen.cpp
+QT = core
requires(embedded)
diff --git a/tests/auto/qmutex/qmutex.pro b/tests/auto/qmutex/qmutex.pro
index e52f947..bd24dcb 100644
--- a/tests/auto/qmutex/qmutex.pro
+++ b/tests/auto/qmutex/qmutex.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qmutex.cpp
QT = core
-
-
diff --git a/tests/auto/qmutexlocker/qmutexlocker.pro b/tests/auto/qmutexlocker/qmutexlocker.pro
index f921308..ff8a3da 100644
--- a/tests/auto/qmutexlocker/qmutexlocker.pro
+++ b/tests/auto/qmutexlocker/qmutexlocker.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qmutexlocker.cpp
QT = core
-
-
diff --git a/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp b/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp
index 20874f3..ef285f6 100644
--- a/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp
+++ b/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp
@@ -102,11 +102,11 @@ private slots:
tst_QNativeSocketEngine::tst_QNativeSocketEngine()
{
+ Q_SET_DEFAULT_IAP
}
tst_QNativeSocketEngine::~tst_QNativeSocketEngine()
{
-
}
void tst_QNativeSocketEngine::init()
@@ -173,7 +173,7 @@ void tst_QNativeSocketEngine::simpleConnectToIMAP()
QVERIFY(socketDevice.read(array.data(), array.size()) == available);
// Check that the greeting is what we expect it to be
- QCOMPARE(array.constData(), "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ QCOMPARE(array.constData(), QtNetworkSettings::expectedReplyIMAP().constData());
// Write a logout message
QByteArray array2 = "ZZZ LOGOUT\r\n";
@@ -204,6 +204,9 @@ void tst_QNativeSocketEngine::simpleConnectToIMAP()
//---------------------------------------------------------------------------
void tst_QNativeSocketEngine::udpLoopbackTest()
{
+#ifdef SYMBIAN_WINSOCK_CONNECTIVITY
+ QSKIP("Not working on Emulator without WinPCAP", SkipAll);
+#endif
QNativeSocketEngine udpSocket;
// Initialize device #1
@@ -252,6 +255,9 @@ void tst_QNativeSocketEngine::udpLoopbackTest()
//---------------------------------------------------------------------------
void tst_QNativeSocketEngine::udpIPv6LoopbackTest()
{
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Symbian: IPv6 is not yet supported", SkipAll);
+#endif
QNativeSocketEngine udpSocket;
// Initialize device #1
@@ -396,6 +402,9 @@ void tst_QNativeSocketEngine::serverTest()
//---------------------------------------------------------------------------
void tst_QNativeSocketEngine::udpLoopbackPerformance()
{
+#ifdef SYMBIAN_WINSOCK_CONNECTIVITY
+ QSKIP("Not working on Emulator without WinPCAP", SkipAll);
+#endif
QNativeSocketEngine udpSocket;
// Initialize device #1
@@ -553,7 +562,7 @@ void tst_QNativeSocketEngine::tooManySockets()
//---------------------------------------------------------------------------
void tst_QNativeSocketEngine::bind()
{
-#ifndef Q_OS_WIN
+#if !defined Q_OS_WIN && !defined Q_OS_SYMBIAN
QNativeSocketEngine binder;
QVERIFY(binder.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol));
QVERIFY(!binder.bind(QHostAddress::Any, 82));
@@ -567,7 +576,13 @@ void tst_QNativeSocketEngine::bind()
QNativeSocketEngine binder3;
QVERIFY(binder3.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol));
QVERIFY(!binder3.bind(QHostAddress::Any, 31180));
+
+#ifdef SYMBIAN_WINSOCK_CONNECTIVITY
+ qDebug("On Symbian Emulator (WinSock) we get EADDRNOTAVAIL instead of EADDRINUSE");
+ QVERIFY(binder3.error() == QAbstractSocket::SocketAddressNotAvailableError);
+#else
QVERIFY(binder3.error() == QAbstractSocket::AddressInUseError);
+#endif
}
//---------------------------------------------------------------------------
@@ -577,7 +592,7 @@ void tst_QNativeSocketEngine::networkError()
QVERIFY(client.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol));
- const bool isConnected = client.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143);
+ const bool isConnected = client.connectToHost(QtNetworkSettings::serverIP(), 143);
if (!isConnected) {
QVERIFY(client.state() == QAbstractSocket::ConnectingState);
QVERIFY(client.waitForWrite());
diff --git a/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp
index 197651a..eb72f64 100644
--- a/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp
+++ b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp
@@ -53,7 +53,9 @@
class tst_QNetworkAccessManager_And_QProgressDialog : public QObject
{
-Q_OBJECT
+ Q_OBJECT
+public:
+ tst_QNetworkAccessManager_And_QProgressDialog();
private slots:
void downloadCheck();
};
@@ -110,6 +112,11 @@ private:
QNetworkAccessManager netmanager;
};
+tst_QNetworkAccessManager_And_QProgressDialog::tst_QNetworkAccessManager_And_QProgressDialog()
+{
+ Q_SET_DEFAULT_IAP
+}
+
void tst_QNetworkAccessManager_And_QProgressDialog::downloadCheck()
{
DownloadCheckWidget widget;
diff --git a/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp b/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp
index e69e4dc..4783a29 100644
--- a/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp
+++ b/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp
@@ -68,12 +68,14 @@ private slots:
tst_QNetworkInterface::tst_QNetworkInterface()
{
+ Q_SET_DEFAULT_IAP
}
tst_QNetworkInterface::~tst_QNetworkInterface()
{
}
+
void tst_QNetworkInterface::dump()
{
// This is for manual testing:
@@ -125,6 +127,10 @@ void tst_QNetworkInterface::loopbackIPv4()
void tst_QNetworkInterface::loopbackIPv6()
{
+#ifdef Q_OS_SYMBIAN
+ QSKIP( "Symbian: IPv6 is not yet supported", SkipAll );
+#else
+
QList<QHostAddress> all = QNetworkInterface::allAddresses();
bool loopbackfound = false;
@@ -136,8 +142,9 @@ void tst_QNetworkInterface::loopbackIPv6()
break;
} else if (addr.protocol() == QAbstractSocket::IPv6Protocol)
anyIPv6 = true;
-
+
QVERIFY(!anyIPv6 || loopbackfound);
+#endif
}
void tst_QNetworkInterface::localAddress()
diff --git a/tests/auto/qnetworkreply/.gitattributes b/tests/auto/qnetworkreply/.gitattributes
index f0cae99..80252cf 100644
--- a/tests/auto/qnetworkreply/.gitattributes
+++ b/tests/auto/qnetworkreply/.gitattributes
@@ -1,2 +1,3 @@
-rfc3252.txt -crlf
-bigfile -crlf
+rfc3252.txt -crlf
+bigfile -crlf
+resource -crlf
diff --git a/tests/auto/qnetworkreply/echo/echo.pro b/tests/auto/qnetworkreply/echo/echo.pro
index bf791ff..74b0bfc 100644
--- a/tests/auto/qnetworkreply/echo/echo.pro
+++ b/tests/auto/qnetworkreply/echo/echo.pro
@@ -3,4 +3,4 @@ QT = core
CONFIG -= app_bundle debug_and_release_target
CONFIG += console
-
+symbian:TARGET.CAPABILITY="ALL -TCB"
diff --git a/tests/auto/qnetworkreply/test/test.pro b/tests/auto/qnetworkreply/test/test.pro
index 71f76a2..e0df503 100644
--- a/tests/auto/qnetworkreply/test/test.pro
+++ b/tests/auto/qnetworkreply/test/test.pro
@@ -10,7 +10,7 @@ win32 {
}
}
-DEFINES += SRCDIR=\\\"$$PWD/..\\\"
+!symbian:DEFINES += SRCDIR=\\\"$$PWD/..\\\"
QT = core network
RESOURCES += ../qnetworkreply.qrc
@@ -20,3 +20,15 @@ wince*: {
addFiles.path = .
DEPLOYMENT += addFiles
}
+
+symbian:{
+ addFiles.sources = ../empty ../rfc3252.txt ../resource ../bigfile
+ addFiles.path = .
+ DEPLOYMENT += addFiles
+
+ # Symbian toolchain does not support correct include semantics
+ INCPATH+=..\..\..\..\include\QtNetwork\private
+ # bigfile test case requires more heap
+ TARGET.EPOCHEAPSIZE="0x100 0x1000000"
+ TARGET.CAPABILITY="ALL -TCB"
+}
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 7a9d016..9d05fb8 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -68,8 +68,16 @@
#include "private/qnetworkaccessmanager_p.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
+//#define SRCDIR QDir::currentPath()
+#define SRCDIR "."
+#endif
+
#include "../network-settings.h"
+
Q_DECLARE_METATYPE(QNetworkReply*)
Q_DECLARE_METATYPE(QAuthenticator*)
Q_DECLARE_METATYPE(QNetworkProxy)
@@ -119,6 +127,7 @@ class tst_QNetworkReply: public QObject
public:
tst_QNetworkReply();
+ ~tst_QNetworkReply();
QString runSimpleRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request,
QNetworkReplyPtr &reply, const QByteArray &data = QByteArray());
@@ -513,11 +522,19 @@ public:
QTcpSocket *active = new QTcpSocket(this);
active->connectToHost("127.0.0.1", server.serverPort());
+#ifndef Q_OS_SYMBIAN
if (!active->waitForConnected(100))
return false;
if (!server.waitForNewConnection(100))
return false;
+#else
+ if (!active->waitForConnected(5000))
+ return false;
+
+ if (!server.waitForNewConnection(5000))
+ return false;
+#endif
QTcpSocket *passive = server.nextPendingConnection();
passive->setParent(this);
@@ -926,6 +943,8 @@ public slots:
tst_QNetworkReply::tst_QNetworkReply()
{
+ Q_SET_DEFAULT_IAP
+
testFileName = QDir::currentPath() + "/testfile";
#ifndef Q_OS_WINCE
uniqueExtension = QString("%1%2%3").arg((qulonglong)this).arg(rand()).arg((qulonglong)time(0));
@@ -954,6 +973,9 @@ tst_QNetworkReply::tst_QNetworkReply()
}
}
+tst_QNetworkReply::~tst_QNetworkReply()
+{
+}
void tst_QNetworkReply::authenticationRequired(QNetworkReply*, QAuthenticator* auth)
@@ -1121,7 +1143,7 @@ void tst_QNetworkReply::invalidProtocol()
void tst_QNetworkReply::getFromData_data()
{
- QTest::addColumn<QString>("request");
+ QTest::addColumn<QString>("request");
QTest::addColumn<QByteArray>("expected");
QTest::addColumn<QString>("mimeType");
@@ -1217,7 +1239,7 @@ void tst_QNetworkReply::getFromData()
void tst_QNetworkReply::getFromFile()
{
- // create the file:
+ // create the file:
QTemporaryFile file(QDir::currentPath() + "/temp-XXXXXX");
file.setAutoRemove(true);
QVERIFY(file.open());
@@ -1269,7 +1291,7 @@ void tst_QNetworkReply::getFromFileSpecial_data()
void tst_QNetworkReply::getFromFileSpecial()
{
- QFETCH(QString, fileName);
+ QFETCH(QString, fileName);
QFETCH(QString, url);
// open the resource so we can find out its size
@@ -1299,7 +1321,7 @@ void tst_QNetworkReply::getFromFtp_data()
void tst_QNetworkReply::getFromFtp()
{
- QFETCH(QString, referenceName);
+ QFETCH(QString, referenceName);
QFETCH(QString, url);
QFile reference(referenceName);
@@ -1328,7 +1350,7 @@ void tst_QNetworkReply::getFromHttp_data()
void tst_QNetworkReply::getFromHttp()
{
- QFETCH(QString, referenceName);
+ QFETCH(QString, referenceName);
QFETCH(QString, url);
QFile reference(referenceName);
@@ -1366,7 +1388,7 @@ void tst_QNetworkReply::getErrors_data()
<< int(QNetworkReply::ContentOperationNotPermittedError) << 0 << true;
QTest::newRow("file-exist") << QUrl::fromLocalFile(QDir::currentPath() + "/this-file-doesnt-exist.txt").toString()
<< int(QNetworkReply::ContentNotFoundError) << 0 << true;
-#if !defined Q_OS_WIN
+#if !defined Q_OS_WIN && !defined(Q_OS_SYMBIAN)
QTest::newRow("file-is-wronly") << QUrl::fromLocalFile(wronlyFileName).toString()
<< int(QNetworkReply::ContentAccessDenied) << 0 << true;
#endif
@@ -1801,7 +1823,11 @@ void tst_QNetworkReply::ioGetFromFtp()
DataReader reader(reply);
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+#ifdef Q_OS_SYMBIAN
+ QTestEventLoop::instance().enterLoop(20);
+#else
QTestEventLoop::instance().enterLoop(10);
+#endif
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(reply->url(), request.url());
@@ -1831,11 +1857,19 @@ void tst_QNetworkReply::ioGetFromFtpWithReuse()
QSignalSpy spy(reply1, SIGNAL(finished()));
connect(reply2, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+#ifdef Q_OS_SYMBIAN
+ QTestEventLoop::instance().enterLoop(20);
+#else
QTestEventLoop::instance().enterLoop(10);
+#endif
QVERIFY(!QTestEventLoop::instance().timeout());
if (spy.count() == 0) {
connect(reply1, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+#ifdef Q_OS_SYMBIAN
+ QTestEventLoop::instance().enterLoop(20);
+#else
QTestEventLoop::instance().enterLoop(10);
+#endif
QVERIFY(!QTestEventLoop::instance().timeout());
}
@@ -2527,7 +2561,11 @@ void tst_QNetworkReply::ioGetWithManyProxies()
SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
#endif
+#ifndef Q_OS_SYMBIAN
QTestEventLoop::instance().enterLoop(10);
+#else
+ QTestEventLoop::instance().enterLoop(60);
+#endif
QVERIFY(!QTestEventLoop::instance().timeout());
manager.disconnect(SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
@@ -2656,8 +2694,13 @@ void tst_QNetworkReply::ioPutToFileFromLocalSocket()
}
QLocalSocket active;
active.connectToServer(socketname);
+#ifndef Q_OS_SYMBIAN
QVERIFY2(server.waitForNewConnection(10), server.errorString().toLatin1().constData());
QVERIFY2(active.waitForConnected(10), active.errorString().toLatin1().constData());
+#else
+ QVERIFY2(server.waitForNewConnection(5000), server.errorString().toLatin1().constData());
+ QVERIFY2(active.waitForConnected(5000), active.errorString().toLatin1().constData());
+#endif
QVERIFY2(server.hasPendingConnections(), server.errorString().toLatin1().constData());
QLocalSocket *passive = server.nextPendingConnection();
@@ -2672,7 +2715,11 @@ void tst_QNetworkReply::ioPutToFileFromLocalSocket()
passive->setParent(reply);
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+#ifndef Q_OS_SYMBIAN
QTestEventLoop::instance().enterLoop(10);
+#else
+ QTestEventLoop::instance().enterLoop(30);
+#endif
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(reply->url(), url);
@@ -2693,18 +2740,19 @@ void tst_QNetworkReply::ioPutToFileFromProcess_data()
void tst_QNetworkReply::ioPutToFileFromProcess()
{
-#if defined(Q_OS_WINCE)
- QSKIP("Currently no stdin/out supported for Windows CE", SkipAll);
+#if defined(Q_OS_WINCE) || defined (Q_OS_SYMBIAN)
+ QSKIP("Currently no stdin/out supported for Windows CE / Symbian OS", SkipAll);
#endif
+
#ifdef Q_OS_WIN
if (qstrcmp(QTest::currentDataTag(), "small") == 0)
QSKIP("When passing a CR-LF-LF sequence through Windows stdio, it gets converted, "
"so this test fails. Disabled on Windows", SkipSingle);
#endif
+
#if defined(QT_NO_PROCESS)
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
#else
-
QFile file(testFileName);
QUrl url = QUrl::fromLocalFile(file.fileName());
@@ -3234,7 +3282,6 @@ void tst_QNetworkReply::downloadPerformance()
{
// unlike the above function, this one tries to send as fast as possible
// and measures how fast it was.
-
TimedSender sender(5000);
QNetworkRequest request("debugpipe://127.0.0.1:" + QString::number(sender.serverPort()) + "/?bare=1");
QNetworkReplyPtr reply = manager.get(request);
@@ -3361,7 +3408,11 @@ void tst_QNetworkReply::downloadProgress_data()
QTest::newRow("empty") << 0;
QTest::newRow("small") << 4;
+#ifndef Q_OS_SYMBIAN
QTest::newRow("big") << 4096;
+#else
+ QTest::newRow("big") << 1024;
+#endif
}
void tst_QNetworkReply::downloadProgress()
@@ -3390,11 +3441,20 @@ void tst_QNetworkReply::downloadProgress()
QFETCH(int, loopCount);
for (int i = 1; i <= loopCount; ++i) {
+#ifdef Q_OS_SYMBIAN
+ if(i % 500 == 0) {
+ qWarning("iteration %d", i);
+ }
+#endif
sender->write(data);
QVERIFY2(sender->waitForBytesWritten(2000), "Network timeout");
spy.clear();
+#ifdef Q_OS_SYMBIAN
+ QTestEventLoop::instance().enterLoop(5);
+#else
QTestEventLoop::instance().enterLoop(2);
+#endif
QVERIFY(!QTestEventLoop::instance().timeout());
QVERIFY(spy.count() > 0);
QVERIFY(!reply->isFinished());
@@ -3409,7 +3469,11 @@ void tst_QNetworkReply::downloadProgress()
delete sender;
spy.clear();
+#ifdef Q_OS_SYMBIAN
+ QTestEventLoop::instance().enterLoop(5);
+#else
QTestEventLoop::instance().enterLoop(2);
+#endif
QVERIFY(!QTestEventLoop::instance().timeout());
QVERIFY(spy.count() > 0);
QVERIFY(!reply->isRunning());
@@ -3544,7 +3608,7 @@ void tst_QNetworkReply::receiveCookiesFromHttp_data()
void tst_QNetworkReply::receiveCookiesFromHttp()
{
- QFETCH(QString, cookieString);
+ QFETCH(QString, cookieString);
QByteArray data = cookieString.toLatin1() + '\n';
QUrl url("http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/set-cookie.cgi");
@@ -3697,7 +3761,13 @@ void tst_QNetworkReply::httpProxyCommands()
// wait for the finished signal
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+
+#ifdef Q_OS_SYMBIAN
+ QTestEventLoop::instance().enterLoop(5);
+#else
QTestEventLoop::instance().enterLoop(1);
+#endif
+
QVERIFY(!QTestEventLoop::instance().timeout());
//qDebug() << reply->error() << reply->errorString();
diff --git a/tests/auto/qnumeric/qnumeric.pro b/tests/auto/qnumeric/qnumeric.pro
index 3176284..162f980 100644
--- a/tests/auto/qnumeric/qnumeric.pro
+++ b/tests/auto/qnumeric/qnumeric.pro
@@ -3,5 +3,4 @@ load(qttest_p4)
QT = core
SOURCES += tst_qnumeric.cpp
-
-
+QT = core
diff --git a/tests/auto/qobject/qobject.pro b/tests/auto/qobject/qobject.pro
index 0cafdc3..b6b3f20 100644
--- a/tests/auto/qobject/qobject.pro
+++ b/tests/auto/qobject/qobject.pro
@@ -1,4 +1,2 @@
TEMPLATE = subdirs
SUBDIRS = tst_qobject.pro signalbug.pro
-
-
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index bb00a0b..a08f620 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -1170,7 +1170,7 @@ Q_DECLARE_METATYPE(PropertyObject::Priority)
void tst_QObject::threadSignalEmissionCrash()
{
-#ifdef Q_OS_WINCE
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
int loopCount = 100;
#else
int loopCount = 1000;
@@ -1420,8 +1420,18 @@ void tst_QObject::moveToThread()
MoveToThreadObject *child = new MoveToThreadObject(object);
connect(object, SIGNAL(theSignal()), &thread, SLOT(quit()), Qt::DirectConnection);
+
+#if defined(Q_OS_SYMBIAN)
+ // Child timer will be registered after parent timer in the new
+ // thread, and 10ms is less than symbian timer resolution, so
+ // child->timerEventThread compare after thread.wait() will
+ // usually fail unless timers are farther apart.
+ child->startTimer(100);
+ object->startTimer(150);
+#else
child->startTimer(90);
object->startTimer(100);
+#endif
QCOMPARE(object->thread(), currentThread);
QCOMPARE(child->thread(), currentThread);
@@ -2428,7 +2438,9 @@ void tst_QObject::dynamicProperties()
void tst_QObject::recursiveSignalEmission()
{
-#ifdef QT_NO_PROCESS
+#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
+ QSKIP("Emulator builds in Symbian do not support launching processes linking to Qt", SkipAll);
+#elif defined(QT_NO_PROCESS)
QSKIP("Test requires QProcess", SkipAll);
#else
QProcess proc;
diff --git a/tests/auto/qobject/tst_qobject.pro b/tests/auto/qobject/tst_qobject.pro
index 0500ea2..003ee98 100644
--- a/tests/auto/qobject/tst_qobject.pro
+++ b/tests/auto/qobject/tst_qobject.pro
@@ -10,3 +10,8 @@ wince*: {
DEPLOYMENT += addFiles
}
+symbian: {
+ addFiles.sources = signalbug.exe
+ addFiles.path = \sys\bin
+ DEPLOYMENT += addFiles
+}
diff --git a/tests/auto/qobjectrace/qobjectrace.pro b/tests/auto/qobjectrace/qobjectrace.pro
index 581c63f..322adff 100644
--- a/tests/auto/qobjectrace/qobjectrace.pro
+++ b/tests/auto/qobjectrace/qobjectrace.pro
@@ -1,6 +1,5 @@
load(qttest_p4)
SOURCES += tst_qobjectrace.cpp
-
QT = core
-
+TARGET.EPOCHEAPSIZE = 20000000 40000000
diff --git a/tests/auto/qobjectrace/tst_qobjectrace.cpp b/tests/auto/qobjectrace/tst_qobjectrace.cpp
index 5f33649..f24bc7d 100644
--- a/tests/auto/qobjectrace/tst_qobjectrace.cpp
+++ b/tests/auto/qobjectrace/tst_qobjectrace.cpp
@@ -44,7 +44,10 @@
#include <QtTest/QtTest>
-enum { OneMinute = 60 * 1000, TwoMinutes = OneMinute * 2 };
+enum { OneMinute = 60 * 1000,
+ TwoMinutes = OneMinute * 2,
+ TenMinutes = OneMinute * 10,
+ TwentyFiveMinutes = OneMinute * 25 };
class tst_QObjectRace: public QObject
{
@@ -136,6 +139,11 @@ private slots:
void tst_QObjectRace::moveToThreadRace()
{
+#if defined(Q_OS_SYMBIAN)
+ // ### FIXME: task 257411 - remove xfail once this is fixed
+ QEXPECT_FAIL("", "Symbian event dispatcher can't handle this kind of race, see task: 257411", Abort);
+ QVERIFY(false);
+#endif
RaceObject *object = new RaceObject;
enum { ThreadCount = 6 };
@@ -210,9 +218,25 @@ public:
}
};
+#if defined(Q_OS_SYMBIAN)
+// Symbian needs "a bit" more time
+# define EXTRA_THREAD_WAIT TenMinutes
+# define MAIN_THREAD_WAIT TwentyFiveMinutes
+#else
+# define EXTRA_THREAD_WAIT 3000
+# define MAIN_THREAD_WAIT TwoMinutes
+#endif
+
void tst_QObjectRace::destroyRace()
{
- enum { ThreadCount = 10, ObjectCountPerThread = 733,
+#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
+ // ### FIXME: task 257411 - remove xfail once this is fixed.
+ // Oddly enough, this seems to work properly in HW, if given enough time and memory.
+ QEXPECT_FAIL("", "Symbian event dispatcher can't handle this kind of race on emulator, see task: 257411", Abort);
+ QVERIFY(false);
+#endif
+
+ enum { ThreadCount = 10, ObjectCountPerThread = 733,
ObjectCount = ThreadCount * ObjectCountPerThread };
const char *_slots[] = { SLOT(slot1()) , SLOT(slot2()) , SLOT(slot3()),
@@ -244,10 +268,10 @@ void tst_QObjectRace::destroyRace()
for (int i = 0; i < ThreadCount; ++i)
threads[i]->start();
- QVERIFY(threads[0]->wait(TwoMinutes));
+ QVERIFY(threads[0]->wait(MAIN_THREAD_WAIT));
// the other threads should finish pretty quickly now
for (int i = 1; i < ThreadCount; ++i)
- QVERIFY(threads[i]->wait(3000));
+ QVERIFY(threads[i]->wait(EXTRA_THREAD_WAIT));
for (int i = 0; i < ThreadCount; ++i)
delete threads[i];
diff --git a/tests/auto/qpainter/qpainter.pro b/tests/auto/qpainter/qpainter.pro
index 277039f..1b3659d 100644
--- a/tests/auto/qpainter/qpainter.pro
+++ b/tests/auto/qpainter/qpainter.pro
@@ -1,12 +1,15 @@
load(qttest_p4)
contains(QT_CONFIG, qt3support): QT += qt3support
SOURCES += tst_qpainter.cpp
-wince*: {
- DEFINES += SRCDIR=\\\".\\\"
+wince*|symbian*: {
addFiles.sources = drawEllipse drawLine_rop_bitmap drawPixmap_rop drawPixmap_rop_bitmap task217400.png
addFiles.path = .
DEPLOYMENT += addFiles
-} else {
+}
+
+wince* {
+ DEFINES += SRCDIR=\\\".\\\"
+} !symbian {
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 9448d38..1d0a1b4 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -50,7 +50,7 @@
#include <qbitmap.h>
#include <qimage.h>
#include <limits.h>
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
#include <qprinter.h>
#include <math.h>
#ifdef QT3_SUPPORT
@@ -67,6 +67,10 @@
#include <qqueue.h>
+#if defined(Q_OS_SYMBIAN)
+# define SRCDIR "."
+#endif
+
Q_DECLARE_METATYPE(QLine)
Q_DECLARE_METATYPE(QRect)
Q_DECLARE_METATYPE(QSize)
@@ -528,8 +532,7 @@ void tst_QPainter::qt_format_text_boundingRect()
QCOMPARE(pbr, br);
}
#endif
-
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
{
QPrinter printer(QPrinter::HighResolution);
if (printer.printerName().isEmpty()) {
@@ -1425,7 +1428,7 @@ void tst_QPainter::drawPath2()
void tst_QPainter::drawPath3()
{
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QImage imgA(400, 400, QImage::Format_RGB32);
#else
QImage imgA(100, 100, QImage::Format_RGB32);
@@ -2962,7 +2965,7 @@ void tst_QPainter::monoImages()
}
}
-#if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_CC_MSVC) && !defined(Q_OS_SOLARIS)
+#if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_CC_MSVC) && !defined(Q_OS_SOLARIS) && !defined(Q_OS_SYMBIAN)
#include <fenv.h>
static const QString fpeExceptionString(int exception)
diff --git a/tests/auto/qpathclipper/qpathclipper.pro b/tests/auto/qpathclipper/qpathclipper.pro
index dc9d60f..930a6f2 100644
--- a/tests/auto/qpathclipper/qpathclipper.pro
+++ b/tests/auto/qpathclipper/qpathclipper.pro
@@ -5,6 +5,6 @@ SOURCES += tst_qpathclipper.cpp paths.cpp
requires(contains(QT_CONFIG,private_tests))
-unix:!mac:LIBS+=-lm
+unix:!mac:!symbian*:LIBS+=-lm
diff --git a/tests/auto/qpen/tst_qpen.cpp b/tests/auto/qpen/tst_qpen.cpp
index 5fd2450..87f50f4 100644
--- a/tests/auto/qpen/tst_qpen.cpp
+++ b/tests/auto/qpen/tst_qpen.cpp
@@ -111,22 +111,22 @@ void tst_QPen::operator_eq_eq_data()
QTest::newRow("differentColor") << QPen(Qt::red)
<< QPen(Qt::blue)
- << FALSE;
+ << bool(FALSE);
QTest::newRow("differentWidth") << QPen(Qt::red, 2)
<< QPen(Qt::red, 3)
- << FALSE;
+ << bool(FALSE);
QTest::newRow("differentPenStyle") << QPen(Qt::red, 2, Qt::DashLine)
<< QPen(Qt::red, 2, Qt::DotLine)
- << FALSE;
+ << bool(FALSE);
QTest::newRow("differentCapStyle") << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin)
<< QPen(Qt::red, 2, Qt::DashLine, Qt::SquareCap, Qt::BevelJoin)
- << FALSE;
+ << bool(FALSE);
QTest::newRow("differentJoinStyle") << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin)
<< QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::MiterJoin)
- << FALSE;
+ << bool(FALSE);
QTest::newRow("same") << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin)
<< QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin)
- << TRUE;
+ << bool(TRUE);
}
diff --git a/tests/auto/qpixmap/qpixmap.pro b/tests/auto/qpixmap/qpixmap.pro
index 70be4be..02ed3f2 100644
--- a/tests/auto/qpixmap/qpixmap.pro
+++ b/tests/auto/qpixmap/qpixmap.pro
@@ -1,13 +1,19 @@
load(qttest_p4)
SOURCES += tst_qpixmap.cpp
contains(QT_CONFIG, qt3support): QT += qt3support
-wince*: {
+wince*|symbian*: {
task31722_0.sources = convertFromImage/task31722_0/*
task31722_0.path = convertFromImage/task31722_0
task31722_1.sources = convertFromImage/task31722_1/*
task31722_1.path = convertFromImage/task31722_1
DEPLOYMENT += task31722_0 task31722_1
+}
+
+wince*: {
DEFINES += SRCDIR=\\\".\\\"
+} symbian*: {
+ DEPLOYMENT_PLUGIN += qmng
+ LIBS += -lfbscli.dll -lbitgdi.dll -lgdi.dll
} else {
DEFINES += SRCDIR=\\\"$$PWD\\\"
win32:LIBS += -lgdi32 -luser32
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 281d122..35d4cf3 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -60,9 +60,19 @@
#include <qscreen_qws.h>
#endif
+#ifdef Q_OS_SYMBIAN
+#include <e32std.h>
+#include <fbs.h>
+#include <gdi.h>
+#include <bitdev.h>
+#endif
+
+
//TESTED_CLASS=
//TESTED_FILES=
-
+#if defined(Q_OS_SYMBIAN)
+# define SRCDIR ""
+#endif
Q_DECLARE_METATYPE(QImage::Format)
class tst_QPixmap : public QObject
@@ -123,6 +133,11 @@ private slots:
void fromWinHBITMAP();
#endif
+#if defined(Q_WS_S60)
+ void fromSymbianCFbsBitmap_data();
+ void fromSymbianCFbsBitmap();
+#endif
+
void onlyNullPixmapsOutsideGuiThread();
void refUnref();
@@ -307,8 +322,11 @@ void tst_QPixmap::convertFromImage_data()
{
QTest::addColumn<QImage>("img1");
QTest::addColumn<QImage>("img2");
-
+#ifdef Q_OS_SYMBIAN
+ const QString prefix = QLatin1String(SRCDIR) + "convertFromImage";
+#else
const QString prefix = QLatin1String(SRCDIR) + "/convertFromImage";
+#endif
{
QImage img1;
QImage img2;
@@ -921,6 +939,102 @@ void tst_QPixmap::fromWinHBITMAP()
#endif
+#if defined(Q_WS_S60)
+Q_DECLARE_METATYPE(TDisplayMode)
+
+void tst_QPixmap::fromSymbianCFbsBitmap_data()
+{
+ QTest::addColumn<TDisplayMode>("format");
+ QTest::addColumn<int>("width");
+ QTest::addColumn<int>("height");
+ QTest::addColumn<QColor>("color");
+
+ const int smallWidth = 20;
+ const int smallHeight = 20;
+ const int largeWidth = 240;
+ const int largeHeight = 320;
+
+ // Indexed Color Formats - Disabled since images seem to be blank -> no palette?
+// QTest::newRow("EGray2 small") << EGray2 << smallWidth << smallHeight << QColor(Qt::black);
+// QTest::newRow("EGray2 big") << EGray2 << largeWidth << largeHeight << QColor(Qt::black);
+// QTest::newRow("EGray256 small") << EGray256 << smallWidth << smallHeight << QColor(Qt::blue);
+// QTest::newRow("EGray256 big") << EGray256 << largeWidth << largeHeight << QColor(Qt::blue);
+// QTest::newRow("EColor256 small") << EColor256 << smallWidth << smallHeight << QColor(Qt::red);
+// QTest::newRow("EColor256 big") << EColor256 << largeWidth << largeHeight << QColor(Qt::red);
+
+ // Direct Color Formats
+ QTest::newRow("EColor4K small") << EColor4K << smallWidth << smallHeight << QColor(Qt::red);
+ QTest::newRow("EColor4K big") << EColor4K << largeWidth << largeHeight << QColor(Qt::red);
+ QTest::newRow("EColor64K small") << EColor64K << smallWidth << smallHeight << QColor(Qt::green);
+ QTest::newRow("EColor64K big") << EColor64K << largeWidth << largeHeight << QColor(Qt::green);
+ QTest::newRow("EColor16MU small") << EColor16MU << smallWidth << smallHeight << QColor(Qt::red);
+ QTest::newRow("EColor16MU big") << EColor16MU << largeWidth << largeHeight << QColor(Qt::red);
+ QTest::newRow("EColor16MA small opaque") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0);
+ QTest::newRow("EColor16MA big opaque") << EColor16MA << largeWidth << largeHeight << QColor(255, 255, 0);
+
+ // Semi-transparent Colors - Disabled for now, since the QCOMPARE fails, but visually confirmed to work
+// QTest::newRow("EColor16MA small semi") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0, 127);
+// QTest::newRow("EColor16MA big semi") << EColor16MA << largeWidth << largeHeight << QColor(255, 255, 0, 127);
+// QTest::newRow("EColor16MA small trans") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0, 0);
+// QTest::newRow("EColor16MA big trans") << EColor16MA << largeWidth << largeHeight << QColor(255, 255, 0, 0);
+
+#if !defined(__SERIES60_31__) && !defined(__S60_32__)
+ QTest::newRow("EColor16MAP small") << EColor16MAP << smallWidth << smallHeight << QColor(Qt::red);
+ QTest::newRow("EColor16MAP big") << EColor16MAP << largeWidth << largeHeight << QColor(Qt::red);
+#endif
+}
+
+void tst_QPixmap::fromSymbianCFbsBitmap()
+{
+ QFETCH(TDisplayMode, format);
+ QFETCH(int, width);
+ QFETCH(int, height);
+ QFETCH(QColor, color);
+ int expectedDepth = TDisplayModeUtils::NumDisplayModeBitsPerPixel(format);
+
+ CFbsBitmap *nativeBitmap = 0;
+ CFbsBitmapDevice *bitmapDevice = 0;
+ CBitmapContext *bitmapContext = 0;
+
+ nativeBitmap = new (ELeave) CFbsBitmap();
+ TInt err = nativeBitmap->Create(TSize(width, height), format);
+ CleanupStack::PushL(nativeBitmap);
+ QVERIFY(err == KErrNone);
+ bitmapDevice = CFbsBitmapDevice::NewL(nativeBitmap);
+ CleanupStack::PushL(bitmapDevice);
+
+ err = bitmapDevice->CreateBitmapContext(bitmapContext);
+ CleanupStack::PushL(bitmapContext);
+ QVERIFY(err == KErrNone);
+ TRgb symbianColor = TRgb(color.red(), color.green(), color.blue(), color.alpha());
+ bitmapContext->SetBrushColor(symbianColor);
+ bitmapContext->Clear();
+
+ __UHEAP_MARK;
+ { // Test the null case
+ CFbsBitmap *bitmap = 0;
+ QPixmap pixmap = QPixmap::fromSymbianCFbsBitmap(bitmap);
+ QVERIFY(pixmap.isNull());
+ }
+ __UHEAP_MARKEND;
+
+ __UHEAP_MARK;
+ { // Test the normal case
+ QPixmap pixmap = QPixmap::fromSymbianCFbsBitmap(nativeBitmap);
+// QCOMPARE(pixmap.depth(), expectedDepth); // Depth is not preserved now
+ QCOMPARE(pixmap.width(), width);
+ QCOMPARE(pixmap.height(), height);
+ QImage image = pixmap.toImage();
+
+ QColor actualColor(image.pixel(1, 1));
+ QCOMPARE(actualColor, color);
+ }
+ __UHEAP_MARKEND;
+
+ CleanupStack::PopAndDestroy(3);
+}
+#endif
+
void tst_QPixmap::onlyNullPixmapsOutsideGuiThread()
{
#if !defined(Q_WS_WIN)
@@ -946,9 +1060,17 @@ void tst_QPixmap::onlyNullPixmapsOutsideGuiThread()
}
};
Thread thread;
+#if defined(Q_OS_SYMBIAN)
+ thread.setStackSize(0x10000);
+#endif
thread.start();
+#if defined(Q_OS_SYMBIAN)
+ QVERIFY(thread.wait(10000));
+#else
thread.wait();
#endif
+
+#endif // !defined(Q_WS_WIN)
}
void tst_QPixmap::refUnref()
diff --git a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp
index dc9c4da..cd3a059 100644
--- a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp
+++ b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp
@@ -87,24 +87,32 @@ public slots:
void cleanup();
private slots:
void getSetCheck();
+#ifndef QT_NO_CLIPBOARD
void clearMustNotChangeClipboard();
+#endif
void clearMustNotResetRootFrameMarginToDefault();
void paragSeparatorOnPlaintextAppend();
+#ifndef QT_NO_CLIPBOARD
void selectAllSetsNotSelection();
+#endif
void asciiTab();
void setDocument();
void emptyAppend();
void appendOnEmptyDocumentShouldReuseInitialParagraph();
void cursorPositionChanged();
void setTextCursor();
+#ifndef QT_NO_CLIPBOARD
void undoAvailableAfterPaste();
+#endif
void undoRedoAvailableRepetition();
void appendShouldNotTouchTheSelection();
void backspace();
void shiftBackspace();
void undoRedo();
void preserveCharFormatInAppend();
+#ifndef QT_NO_CLIPBOARD
void copyAndSelectAllInReadonly();
+#endif
void ctrlAltInput();
void noPropertiesOnDefaultTextEditCharFormat();
void setPlainTextShouldEmitTextChangedOnce();
@@ -118,13 +126,17 @@ private slots:
void undoRedoAfterSetContent();
void numPadKeyNavigation();
void moveCursor();
+#ifndef QT_NO_CLIPBOARD
void mimeDataReimplementations();
+#endif
void shiftEnterShouldInsertLineSeparator();
void selectWordsFromStringsContainingSeparators_data();
void selectWordsFromStringsContainingSeparators();
+#ifndef QT_NO_CLIPBOARD
void canPaste();
void copyAvailable_data();
void copyAvailable();
+#endif
void ensureCursorVisibleOnInitialShow();
void setTextInsideResizeEvent();
void colorfulAppend();
@@ -209,7 +221,7 @@ void tst_QPlainTextEdit::getSetCheck()
QCOMPARE(0, obj1.tabStopWidth());
obj1.setTabStopWidth(INT_MIN);
QCOMPARE(0, obj1.tabStopWidth()); // Makes no sense to set a negative tabstop value
-#if defined(QT_ARCH_WINDOWSCE)
+#if defined(QT_ARCH_WINDOWSCE) || defined (QT_ARCH_SYMBIAN)
// due to rounding error in qRound when qreal==float
// we cannot use INT_MAX for this check
obj1.setTabStopWidth(SHRT_MAX*2);
@@ -290,7 +302,7 @@ void tst_QPlainTextEdit::createSelection()
#endif
QCOMPARE(ed->textCursor().position(), 11);
}
-
+#ifndef QT_NO_CLIPBOARD
void tst_QPlainTextEdit::clearMustNotChangeClipboard()
{
if (!nativeClipboardWorking())
@@ -301,6 +313,7 @@ void tst_QPlainTextEdit::clearMustNotChangeClipboard()
ed->clear();
QCOMPARE(QApplication::clipboard()->text(), txt);
}
+#endif
void tst_QPlainTextEdit::clearMustNotResetRootFrameMarginToDefault()
{
@@ -322,6 +335,7 @@ void tst_QPlainTextEdit::paragSeparatorOnPlaintextAppend()
QCOMPARE(cnt, 2);
}
+#ifndef QT_NO_CLIPBOARD
void tst_QPlainTextEdit::selectAllSetsNotSelection()
{
if (!QApplication::clipboard()->supportsSelection()) {
@@ -337,6 +351,7 @@ void tst_QPlainTextEdit::selectAllSetsNotSelection()
QCOMPARE(QApplication::clipboard()->text(QClipboard::Selection), QString::fromAscii("foobar"));
}
+#endif
void tst_QPlainTextEdit::asciiTab()
{
@@ -466,6 +481,7 @@ void tst_QPlainTextEdit::setTextCursor()
QCOMPARE(spy.count(), 1);
}
+#ifndef QT_NO_CLIPBOARD
void tst_QPlainTextEdit::undoAvailableAfterPaste()
{
if (!nativeClipboardWorking())
@@ -479,6 +495,7 @@ void tst_QPlainTextEdit::undoAvailableAfterPaste()
QVERIFY(spy.count() >= 1);
QCOMPARE(ed->toPlainText(), txt);
}
+#endif
class UndoRedoRecorder : public QObject
{
@@ -657,6 +674,7 @@ void tst_QPlainTextEdit::preserveCharFormatInAppend()
QCOMPARE(cursor.block().text(), QString("third para"));
}
+#ifndef QT_NO_CLIPBOARD
void tst_QPlainTextEdit::copyAndSelectAllInReadonly()
{
if (!nativeClipboardWorking())
@@ -687,6 +705,7 @@ void tst_QPlainTextEdit::copyAndSelectAllInReadonly()
QTest::keyClick(ed, Qt::Key_C, Qt::ControlModifier);
QCOMPARE(QApplication::clipboard()->text(), QString("Hello World"));
}
+#endif
void tst_QPlainTextEdit::ctrlAltInput()
{
@@ -908,6 +927,7 @@ void tst_QPlainTextEdit::implicitClear()
QVERIFY(ed->toPlainText().isEmpty());
}
+#ifndef QT_NO_CLIPBOARD
void tst_QPlainTextEdit::copyAvailable_data()
{
QTest::addColumn<pairListType>("keystrokes");
@@ -1025,6 +1045,7 @@ void tst_QPlainTextEdit::copyAvailable()
QVERIFY2(variantSpyCopyAvailable.toBool() == copyAvailable.at(i), QString("Spied singnal: %1").arg(i).toLatin1());
}
}
+#endif
void tst_QPlainTextEdit::undoRedoAfterSetContent()
{
@@ -1090,6 +1111,7 @@ public:
};
+#ifndef QT_NO_CLIPBOARD
void tst_QPlainTextEdit::mimeDataReimplementations()
{
MyTextEdit ed;
@@ -1128,6 +1150,7 @@ void tst_QPlainTextEdit::mimeDataReimplementations()
QCOMPARE(ed.insertCallCount, 1);
#endif
}
+#endif
void tst_QPlainTextEdit::shiftEnterShouldInsertLineSeparator()
{
@@ -1167,6 +1190,7 @@ void tst_QPlainTextEdit::selectWordsFromStringsContainingSeparators()
cursor.clearSelection();
}
+#ifndef QT_NO_CLIPBOARD
void tst_QPlainTextEdit::canPaste()
{
if (!nativeClipboardWorking())
@@ -1179,6 +1203,7 @@ void tst_QPlainTextEdit::canPaste()
ed->setTextInteractionFlags(Qt::NoTextInteraction);
QVERIFY(!ed->canPaste());
}
+#endif
void tst_QPlainTextEdit::ensureCursorVisibleOnInitialShow()
{
diff --git a/tests/auto/qplugin/debugplugin/debugplugin.pro b/tests/auto/qplugin/debugplugin/debugplugin.pro
index cb2ac34..d0762fc 100644
--- a/tests/auto/qplugin/debugplugin/debugplugin.pro
+++ b/tests/auto/qplugin/debugplugin/debugplugin.pro
@@ -5,3 +5,7 @@ SOURCES = main.cpp
QT = core
DESTDIR = ../plugins
+symbian: {
+ TARGET.EPOCALLOWDLLDATA=1
+ TARGET.CAPABILITY=ALL -TCB
+}
diff --git a/tests/auto/qplugin/qplugin.pro b/tests/auto/qplugin/qplugin.pro
index 818bb0d..aafcb36 100644
--- a/tests/auto/qplugin/qplugin.pro
+++ b/tests/auto/qplugin/qplugin.pro
@@ -1,3 +1,4 @@
+QT = core
TEMPLATE = subdirs
win32 {
exists($$[QT_INSTALL_LIBS]/QtCore4.dll) {
diff --git a/tests/auto/qplugin/releaseplugin/releaseplugin.pro b/tests/auto/qplugin/releaseplugin/releaseplugin.pro
index 21177b8..ce66aaf 100644
--- a/tests/auto/qplugin/releaseplugin/releaseplugin.pro
+++ b/tests/auto/qplugin/releaseplugin/releaseplugin.pro
@@ -5,3 +5,7 @@ SOURCES = main.cpp
QT = core
DESTDIR = ../plugins
+symbian: {
+ TARGET.EPOCALLOWDLLDATA=1
+ TARGET.CAPABILITY=ALL -TCB
+}
diff --git a/tests/auto/qplugin/tst_qplugin.pro b/tests/auto/qplugin/tst_qplugin.pro
index aa5842a..0d9d809 100644
--- a/tests/auto/qplugin/tst_qplugin.pro
+++ b/tests/auto/qplugin/tst_qplugin.pro
@@ -1,6 +1,7 @@
+load(qttest_p4)
+
SOURCES = tst_qplugin.cpp
QT = core
-CONFIG += qtestlib
wince*: {
plugins.sources = plugins/*
@@ -8,3 +9,8 @@ wince*: {
DEPLOYMENT += plugins
}
+symbian: {
+ rpDep.sources = releaseplugin.dll debugplugin.dll
+ rpDep.path = plugins
+ DEPLOYMENT += rpDep dpDep
+}
diff --git a/tests/auto/qpluginloader/lib/lib.pro b/tests/auto/qpluginloader/lib/lib.pro
index 7e842f2..96a9732 100644
--- a/tests/auto/qpluginloader/lib/lib.pro
+++ b/tests/auto/qpluginloader/lib/lib.pro
@@ -12,4 +12,7 @@ win32-borland: DEFINES += WIN32_BORLAND
#no special install rule for the library used by test
INSTALLS =
+symbian: {
+ TARGET.CAPABILITY=ALL -TCB
+}
diff --git a/tests/auto/qpluginloader/qpluginloader.pro b/tests/auto/qpluginloader/qpluginloader.pro
index 50c17ed..382d6e4 100644
--- a/tests/auto/qpluginloader/qpluginloader.pro
+++ b/tests/auto/qpluginloader/qpluginloader.pro
@@ -1,9 +1,10 @@
+QT = core
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS = lib \
theplugin \
tst
-!win32: !macx-*: SUBDIRS += almostplugin
+!win32: !macx-*: !symbian: SUBDIRS += almostplugin
TARGET = tst_qpluginloader
# no special install rule for subdir
diff --git a/tests/auto/qpluginloader/theplugin/theplugin.pro b/tests/auto/qpluginloader/theplugin/theplugin.pro
index d8d87b0..44b46b4 100644
--- a/tests/auto/qpluginloader/theplugin/theplugin.pro
+++ b/tests/auto/qpluginloader/theplugin/theplugin.pro
@@ -5,3 +5,7 @@ SOURCES = theplugin.cpp
TARGET = $$qtLibraryTarget(theplugin)
DESTDIR = ../bin
+symbian: {
+ TARGET.EPOCALLOWDLLDATA=1
+ TARGET.CAPABILITY=ALL -TCB
+}
diff --git a/tests/auto/qpluginloader/tst/tst.pro b/tests/auto/qpluginloader/tst/tst.pro
index 28f74d4..2de0912 100644
--- a/tests/auto/qpluginloader/tst/tst.pro
+++ b/tests/auto/qpluginloader/tst/tst.pro
@@ -2,6 +2,7 @@ load(qttest_p4)
SOURCES += ../tst_qpluginloader.cpp
TARGET = ../tst_qpluginloader
QT = core
+HEADERS += ../theplugin/plugininterface.h
win32 {
CONFIG(debug, debug|release) {
@@ -18,3 +19,11 @@ wince*: {
DEPLOYMENT += addFiles
}
+symbian: {
+ libDep.sources = mylib.dll
+ libDep.path = /sys/bin
+ pluginDep.sources = theplugin.dll
+ pluginDep.path = bin
+
+ DEPLOYMENT += libDep pluginDep
+}
diff --git a/tests/auto/qpluginloader/tst_qpluginloader.cpp b/tests/auto/qpluginloader/tst_qpluginloader.cpp
index 1514897..4b40081 100644
--- a/tests/auto/qpluginloader/tst_qpluginloader.cpp
+++ b/tests/auto/qpluginloader/tst_qpluginloader.cpp
@@ -87,6 +87,12 @@
# endif
# define PREFIX ""
+#elif defined(Q_OS_SYMBIAN)
+# undef dll_VALID
+# define dll_VALID true
+# define SUFFIX ".dll"
+# define PREFIX ""
+
#else // all other Unix
# undef so_VALID
# define so_VALID true
@@ -116,7 +122,7 @@ private slots:
void errorString();
void loadHints();
void deleteinstanceOnUnload();
-
+ void checkingStubsFromDifferentDrives();
};
tst_QPluginLoader::tst_QPluginLoader()
@@ -210,7 +216,7 @@ void tst_QPluginLoader::errorString()
QVERIFY(loader.errorString() != unknown);
}
-#if !defined Q_OS_WIN && !defined Q_OS_MAC && !defined Q_OS_HPUX
+#if !defined Q_OS_WIN && !defined Q_OS_MAC && !defined Q_OS_HPUX && !defined Q_OS_SYMBIAN
{
QPluginLoader loader( sys_qualifiedLibraryName("almostplugin")); //a plugin with unresolved symbols
loader.setLoadHints(QLibrary::ResolveAllSymbolsHint);
@@ -242,6 +248,11 @@ void tst_QPluginLoader::errorString()
QVERIFY(loader.instance() != static_cast<QObject*>(0));
QCOMPARE(loader.errorString(), unknown);
+ // Make sure that plugin really works
+ PluginInterface* theplugin = qobject_cast<PluginInterface*>(loader.instance());
+ QString pluginName = theplugin->pluginName();
+ QCOMPARE(pluginName, QLatin1String("Plugin ok"));
+
QCOMPARE(loader.unload(), true);
QCOMPARE(loader.errorString(), unknown);
}
@@ -287,6 +298,55 @@ void tst_QPluginLoader::deleteinstanceOnUnload()
}
}
+void tst_QPluginLoader::checkingStubsFromDifferentDrives()
+{
+#if defined(Q_OS_SYMBIAN)
+
+ // This test needs C-drive + some additional drive (driveForStubs)
+
+ const QString driveForStubs("E:/");// != "C:/"
+ const QString stubDir("system/temp/stubtest/");
+ const QString stubName("dummyStub.qtplugin");
+ const QString fullStubFileName(stubDir + stubName);
+ QDir dir(driveForStubs);
+ bool test1(false); bool test2(false);
+
+ // initial clean up
+ QFile::remove(driveForStubs + fullStubFileName);
+ dir.rmdir(driveForStubs + stubDir);
+
+ // create a stub dir and do stub drive check
+ if (!dir.mkpath(stubDir))
+ QSKIP("Required drive not available for this test", SkipSingle);
+
+ {// test without stub, should not be found
+ QPluginLoader loader("C:/" + fullStubFileName);
+ test1 = !loader.fileName().length();
+ }
+
+ // create a stub to defined drive
+ QFile tempFile(driveForStubs + fullStubFileName);
+ tempFile.open(QIODevice::ReadWrite);
+ QFileInfo fileInfo(tempFile);
+
+ {// now should be found even tried to find from C:
+ QPluginLoader loader("C:/" + fullStubFileName);
+ test2 = (loader.fileName() == fileInfo.absoluteFilePath());
+ }
+
+ // clean up
+ tempFile.close();
+ if (!QFile::remove(driveForStubs + fullStubFileName))
+ QWARN("Could not remove stub file");
+ if (!dir.rmdir(driveForStubs + stubDir))
+ QWARN("Could not remove stub directory");
+
+ // test after cleanup
+ QVERIFY(test1);
+ QVERIFY(test2);
+
+#endif//Q_OS_SYMBIAN
+}
+
QTEST_APPLESS_MAIN(tst_QPluginLoader)
#include "tst_qpluginloader.moc"
-
diff --git a/tests/auto/qpoint/qpoint.pro b/tests/auto/qpoint/qpoint.pro
index 734fd3c..8b006c2 100644
--- a/tests/auto/qpoint/qpoint.pro
+++ b/tests/auto/qpoint/qpoint.pro
@@ -3,8 +3,5 @@
############################################################
load(qttest_p4)
-QT = core
-
SOURCES += tst_qpoint.cpp
-
-
+QT = core
diff --git a/tests/auto/qpolygon/qpolygon.pro b/tests/auto/qpolygon/qpolygon.pro
index 311958d..e832666 100644
--- a/tests/auto/qpolygon/qpolygon.pro
+++ b/tests/auto/qpolygon/qpolygon.pro
@@ -1,6 +1,6 @@
load(qttest_p4)
SOURCES += tst_qpolygon.cpp
-unix:!mac:LIBS+=-lm
+unix:!mac:!symbian:LIBS+=-lm
diff --git a/tests/auto/qprocess/qprocess.pro b/tests/auto/qprocess/qprocess.pro
index ed59f10..047828a 100644
--- a/tests/auto/qprocess/qprocess.pro
+++ b/tests/auto/qprocess/qprocess.pro
@@ -1,4 +1,5 @@
TEMPLATE = subdirs
+
SUBDIRS = testProcessCrash \
testProcessEcho \
testProcessEcho2 \
@@ -9,10 +10,7 @@ SUBDIRS = testProcessCrash \
testProcessOutput \
testProcessDeadWhileReading \
testProcessEOF \
- testSoftExit \
testProcessSpacesArgs/nospace.pro \
- testProcessSpacesArgs/onespace.pro \
- testProcessSpacesArgs/twospaces.pro \
testExitCodes \
testSpaceInName \
testGuiProcess \
@@ -20,6 +18,11 @@ SUBDIRS = testProcessCrash \
fileWriterProcess \
testSetWorkingDirectory
+!symbian: {
+SUBDIRS +=testProcessSpacesArgs/onespace.pro \
+ testProcessSpacesArgs/twospaces.pro \
+ testSoftExit
+}
win32:!wince*:SUBDIRS+=testProcessEchoGui
diff --git a/tests/auto/qprocess/test/test.pro b/tests/auto/qprocess/test/test.pro
index 3741e3c..82f91f8 100644
--- a/tests/auto/qprocess/test/test.pro
+++ b/tests/auto/qprocess/test/test.pro
@@ -18,7 +18,11 @@ win32: {
QT = core
-QT += network
+
+!symbian: {
+ QT += network
+}
+
embedded: QT += gui
wince*: {
@@ -47,3 +51,18 @@ wince*: {
DEPLOYMENT += addFiles
}
+symbian: {
+ binDep.sources = \
+ fileWriterProcess.exe \
+ testDetached.exe \
+ testExitCodes.exe \
+ testProcessCrash.exe \
+ testProcessEcho.exe \
+ testProcessNormal.exe \
+ testProcessOutput.exe \
+ nospace.exe \
+ testSpaceInName.exe
+ binDep.path = \sys\bin
+
+ DEPLOYMENT += binDep
+}
diff --git a/tests/auto/qprocess/testDetached/testDetached.pro b/tests/auto/qprocess/testDetached/testDetached.pro
index 6792ef4..319cfa6 100644
--- a/tests/auto/qprocess/testDetached/testDetached.pro
+++ b/tests/auto/qprocess/testDetached/testDetached.pro
@@ -5,3 +5,6 @@ CONFIG -= app_bundle
INSTALLS =
DESTDIR = ./
+symbian*: {
+TARGET.EPOCSTACKSIZE =0x14000
+}
diff --git a/tests/auto/qprocess/testProcessOutput/main.cpp b/tests/auto/qprocess/testProcessOutput/main.cpp
index b6c132b..c90ec08 100644
--- a/tests/auto/qprocess/testProcessOutput/main.cpp
+++ b/tests/auto/qprocess/testProcessOutput/main.cpp
@@ -44,13 +44,23 @@
int main()
{
-#ifndef _WIN32_WCE
- for (int i=0; i<10240; i++) {
-#else //fprintf Output is very slow on Windows CE
+#if defined(__SYMBIAN32__)
+ // Printing to stdout messes up the out.txt, so open a file and print there.
+ FILE* file = fopen("c:\\logs\\qprocess_output_test.txt","w+");
+ for (int i=0; i<200; i++) {
+ fprintf(file, "%d -this is a number\n", i);
+ fflush(file);
+ }
+ fclose(file);
+#else
+# if defined(_WIN32_WCE)
for (int i=0; i<240; i++) {
-#endif
+# else //fprintf Output is very slow on Windows CE/Symbian
+ for (int i=0; i<10240; i++) {
+# endif
fprintf(stdout, "%d -this is a number\n", i);
fflush(stderr);
}
+#endif
return 0;
}
diff --git a/tests/auto/qprocess/testProcessSpacesArgs/main.cpp b/tests/auto/qprocess/testProcessSpacesArgs/main.cpp
index ab9ba6e..add8384 100644
--- a/tests/auto/qprocess/testProcessSpacesArgs/main.cpp
+++ b/tests/auto/qprocess/testProcessSpacesArgs/main.cpp
@@ -44,11 +44,21 @@
int main(int argc, char ** argv)
{
+#if defined(__SYMBIAN32__)
+ // Printing to stdout messes up the out.txt, so open a file and print there.
+ FILE* file = fopen("c:\\logs\\qprocess_args_test.txt","w+");
+ for (int i = 0; i < argc; ++i) {
+ if (i)
+ fprintf(file, "|");
+ fprintf(file, argv[i]);
+ }
+ fclose(file);
+#else
for (int i = 0; i < argc; ++i) {
if (i)
printf("|");
printf(argv[i]);
}
-
+#endif
return 0;
}
diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp
index b57139b..368b2a0 100644
--- a/tests/auto/qprocess/tst_qprocess.cpp
+++ b/tests/auto/qprocess/tst_qprocess.cpp
@@ -47,7 +47,11 @@
#include <QtCore/QThread>
#include <QtCore/QRegExp>
#include <QtCore/QDebug>
+#include <QtCore/QMetaType>
+#if !defined(Q_OS_SYMBIAN)
+// Network test unnecessary?
#include <QtNetwork/QHostInfo>
+#endif
#include <stdlib.h>
#ifdef QT_NO_PROCESS
@@ -160,7 +164,7 @@ protected slots:
void restartProcess();
void waitForReadyReadInAReadyReadSlotSlot();
void waitForBytesWrittenInABytesWrittenSlotSlot();
-
+
private:
QProcess *process;
qint64 bytesAvailable;
@@ -197,6 +201,12 @@ tst_QProcess::~tst_QProcess()
void tst_QProcess::init()
{
+#ifdef Q_OS_SYMBIAN
+ QString dirStr = QString::fromLatin1("c:\\logs");
+ QDir dir;
+ if (!dir.exists(dirStr))
+ dir.mkpath(dirStr);
+#endif
}
void tst_QProcess::cleanup()
@@ -252,8 +262,11 @@ void tst_QProcess::simpleStart()
QVERIFY(process->waitForStarted(5000));
QCOMPARE(process->state(), QProcess::Running);
#if defined(Q_OS_WINCE)
+ // Note: This actually seems incorrect, it will only exit the while loop when finishing fails
while (process->waitForFinished(5000))
{ }
+#elif defined(Q_OS_SYMBIAN)
+ QVERIFY(process->waitForFinished(5000));
#else
while (process->waitForReadyRead(5000))
{ }
@@ -379,6 +392,9 @@ void tst_QProcess::echoTest()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
QFETCH(QByteArray, input);
@@ -437,6 +453,9 @@ void tst_QProcess::echoTest2()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
process = new QProcess;
connect(process, SIGNAL(readyRead()), this, SLOT(exitLoopSlot()));
@@ -488,6 +507,9 @@ void tst_QProcess::echoTest_performance()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
QProcess process;
#ifdef Q_OS_MAC
@@ -542,6 +564,9 @@ void tst_QProcess::echoTestGui()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
QProcess process;
@@ -572,11 +597,14 @@ void tst_QProcess::batFiles()
#if defined(Q_OS_WINCE)
QSKIP("Batch files are not supported on Windows CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Batch files are not supported on Symbian", SkipAll);
+#endif
QFETCH(QString, batFile);
QFETCH(QByteArray, output);
QProcess proc;
-
+
proc.start(batFile, QStringList());
QVERIFY(proc.waitForFinished(5000));
@@ -642,6 +670,9 @@ void tst_QProcess::loopBackTest()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
process = new QProcess;
#ifdef Q_OS_MAC
@@ -672,6 +703,9 @@ void tst_QProcess::readTimeoutAndThenCrash()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
process = new QProcess;
#ifdef Q_OS_MAC
@@ -713,18 +747,30 @@ void tst_QProcess::waitForFinished()
process.start("testProcessOutput/testProcessOutput");
#endif
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QVERIFY(process.waitForFinished(5000));
#else
- QVERIFY(process.waitForFinished(15000));
+ QVERIFY(process.waitForFinished(30000));
#endif
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
-#if defined (Q_OS_WINCE)
+#if defined(Q_OS_SYMBIAN)
+ // Symbian test outputs to a file, so check that
+ FILE* file = fopen("c:\\logs\\qprocess_output_test.txt","r");
+ int retval = 0;
+ int count = 0;
+ while((int)(retval = fgetc(file) )!= EOF)
+ if (retval == '\n')
+ count++;
+ fclose(file);
+ QCOMPARE(count, 200);
+#else
+# if defined (Q_OS_WINCE)
QEXPECT_FAIL("", "Reading and writing to a process is not supported on Qt/CE", Continue);
-#endif
+# endif
QString output = process.readAll();
QCOMPARE(output.count("\n"), 10*1024);
+#endif
process.start("blurdybloop");
QVERIFY(!process.waitForFinished());
@@ -737,6 +783,9 @@ void tst_QProcess::deadWhileReading()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
QProcess process;
@@ -762,6 +811,10 @@ void tst_QProcess::restartProcessDeadlock()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
+
// The purpose of this test is to detect whether restarting a
// process in the finished() connected slot causes a deadlock
// because of the way QProcessManager uses its locks.
@@ -799,6 +852,9 @@ void tst_QProcess::closeWriteChannel()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
QProcess more;
more.start("testProcessEOF/testProcessEOF");
@@ -828,6 +884,9 @@ void tst_QProcess::closeReadChannel()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
for (int i = 0; i < 10; ++i) {
QProcess::ProcessChannel channel1 = QProcess::StandardOutput;
@@ -865,6 +924,9 @@ void tst_QProcess::openModes()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
QProcess proc;
QVERIFY(!proc.isOpen());
@@ -915,6 +977,9 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
QProcess proc;
connect(&proc, SIGNAL(readyRead()), this, SLOT(exitLoopSlot()));
@@ -951,6 +1016,9 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
//-----------------------------------------------------------------------------
void tst_QProcess::hardExit()
{
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Killing started processes is not supported on Qt/Symbian due platform security", SkipAll);
+#endif
QProcess proc;
#if defined(Q_OS_MAC)
@@ -977,6 +1045,9 @@ void tst_QProcess::hardExit()
//-----------------------------------------------------------------------------
void tst_QProcess::softExit()
{
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Terminating started processes is not supported on Qt/Symbian due platform security", SkipAll);
+#endif
QProcess proc;
proc.start("testSoftExit/testSoftExit");
@@ -998,7 +1069,7 @@ class SoftExitProcess : public QProcess
Q_OBJECT
public:
bool waitedForFinished;
-
+
SoftExitProcess(int n) : waitedForFinished(false), n(n), killing(false)
{
connect(this, SIGNAL(finished(int, QProcess::ExitStatus)),
@@ -1081,6 +1152,9 @@ void tst_QProcess::softExitInSlots()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
QFETCH(QString, appName);
@@ -1100,6 +1174,9 @@ void tst_QProcess::mergedChannels()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
QProcess process;
process.setReadChannelMode(QProcess::MergedChannels);
@@ -1130,11 +1207,14 @@ void tst_QProcess::forwardedChannels()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
QProcess process;
process.setReadChannelMode(QProcess::ForwardedChannels);
QCOMPARE(process.readChannelMode(), QProcess::ForwardedChannels);
-
+
#ifdef Q_OS_MAC
process.start("testProcessEcho2/testProcessEcho2.app");
#else
@@ -1157,6 +1237,9 @@ void tst_QProcess::atEnd()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
QProcess process;
@@ -1189,6 +1272,10 @@ public:
return exitCode;
}
+#if defined(Q_OS_SYMBIAN)
+ int serial;
+#endif
+
protected:
inline void run()
{
@@ -1200,11 +1287,21 @@ protected:
#ifdef Q_OS_MAC
process.start("testProcessEcho/testProcessEcho.app");
+#elif defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
+ // WINSCW builds in Symbian do not allow multiple processes to load Qt libraries,
+ // so use just a simple process instead of testDetached.
+ process.start("testProcessNormal");
+#elif defined(Q_OS_SYMBIAN)
+ // testDetached used because it does something, but doesn't take too long.
+ QFile infoFile(QString("c:\\logs\\detinfo%1").arg(serial));
+ QStringList args;
+ args << infoFile.fileName();
+ process.start("testDetached", args);
#else
process.start("testProcessEcho/testProcessEcho");
#endif
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QCOMPARE(process.write("abc\0", 4), qint64(4));
#endif
exitCode = exec();
@@ -1219,6 +1316,15 @@ protected slots:
private:
int exitCode;
+#ifdef Q_OS_SYMBIAN
+ enum
+ {
+ /**
+ * The maximum stack size.
+ */
+ SymbianStackSize = 0x14000
+ };
+#endif
};
//-----------------------------------------------------------------------------
@@ -1226,6 +1332,9 @@ void tst_QProcess::processInAThread()
{
for (int i = 0; i < 10; ++i) {
TestThread thread;
+#if defined(Q_OS_SYMBIAN)
+ thread.setStackSize(SymbianStackSize);
+#endif
thread.start();
QVERIFY(thread.wait(10000));
QCOMPARE(thread.code(), 0);
@@ -1235,11 +1344,24 @@ void tst_QProcess::processInAThread()
//-----------------------------------------------------------------------------
void tst_QProcess::processesInMultipleThreads()
{
+#if defined(Q_OS_SYMBIAN)
+ int serialCounter = 0;
+#endif
+
for (int i = 0; i < 10; ++i) {
TestThread thread1;
TestThread thread2;
TestThread thread3;
+#if defined(Q_OS_SYMBIAN)
+ thread1.serial = serialCounter++;
+ thread2.serial = serialCounter++;
+ thread3.serial = serialCounter++;
+
+ thread1.setStackSize(SymbianStackSize);
+ thread2.setStackSize(SymbianStackSize);
+ thread3.setStackSize(SymbianStackSize);
+#endif
thread1.start();
thread2.start();
thread3.start();
@@ -1265,14 +1387,26 @@ void tst_QProcess::waitForFinishedWithTimeout()
#ifdef Q_OS_MAC
process->start("testProcessEcho/testProcessEcho.app");
+#elif defined(Q_OS_SYMBIAN)
+ process->start("testProcessOutput");
#else
process->start("testProcessEcho/testProcessEcho");
#endif
+
+#if defined(Q_OS_SYMBIAN)
+ QVERIFY(process->waitForStarted(50));
+ QVERIFY(!process->waitForFinished(1));
+#else
QVERIFY(process->waitForStarted(5000));
QVERIFY(!process->waitForFinished(1));
process->write("", 1);
+#endif
+
QVERIFY(process->waitForFinished());
+
+ delete process;
+ process = 0;
}
//-----------------------------------------------------------------------------
@@ -1281,6 +1415,9 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
process = new QProcess(this);
connect(process, SIGNAL(readyRead()), this, SLOT(waitForReadyReadInAReadyReadSlotSlot()));
@@ -1300,7 +1437,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot()
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(spy.count(), 1);
-
+
process->disconnect();
QVERIFY(process->waitForFinished(5000));
QVERIFY(process->bytesAvailable() > bytesAvailable);
@@ -1314,6 +1451,9 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
bytesAvailable = process->bytesAvailable();
process->write("bar", 4);
@@ -1327,6 +1467,9 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
process = new QProcess(this);
connect(process, SIGNAL(bytesWritten(qint64)), this, SLOT(waitForBytesWrittenInABytesWrittenSlotSlot()));
@@ -1359,6 +1502,9 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
process->write("b");
QVERIFY(process->waitForBytesWritten(5000));
@@ -1417,18 +1563,20 @@ void tst_QProcess::spaceArgsTest()
QStringList programs;
programs << QString::fromLatin1("testProcessSpacesArgs/nospace")
+#if defined(Q_OS_SYMBIAN)
+ ; // Symbian toolchain doesn't like exes with spaces in the name
+#else
<< QString::fromLatin1("testProcessSpacesArgs/one space")
<< QString::fromLatin1("testProcessSpacesArgs/two space s");
+#endif
process = new QProcess(this);
for (int i = 0; i < programs.size(); ++i) {
-
QString program = programs.at(i);
-
process->start(program, args);
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QVERIFY(process->waitForStarted(5000));
QVERIFY(process->waitForFinished(5000));
#else
@@ -1436,10 +1584,19 @@ void tst_QProcess::spaceArgsTest()
QVERIFY(process->waitForFinished(10000));
#endif
-#if !defined(Q_OS_WINCE)
+#if defined(Q_OS_SYMBIAN)
+ // Symbian test outputs to a file, so check that
+ FILE* file = fopen("c:\\logs\\qprocess_args_test.txt","r");
+ char buf[256];
+ fgets(buf, 256, file);
+ fclose(file);
+ QStringList actual = QString::fromLatin1(buf).split("|");
+#elif !defined(Q_OS_WINCE)
QStringList actual = QString::fromLatin1(process->readAll()).split("|");
+#endif
+#if !defined(Q_OS_WINCE)
QVERIFY(!actual.isEmpty());
- // not onterested in the program name, it might be different.
+ // not interested in the program name, it might be different.
actual.removeFirst();
QCOMPARE(actual, args);
@@ -1456,10 +1613,18 @@ void tst_QProcess::spaceArgsTest()
QVERIFY(process->waitForStarted(5000));
QVERIFY(process->waitForFinished(5000));
-#if !defined(Q_OS_WINCE)
+#if defined(Q_OS_SYMBIAN)
+ // Symbian test outputs to a file, so check that
+ file = fopen("c:\\logs\\qprocess_args_test.txt","r");
+ fgets(buf, 256, file);
+ fclose(file);
+ actual = QString::fromLatin1(buf).split("|");
+#elif !defined(Q_OS_WINCE)
actual = QString::fromLatin1(process->readAll()).split("|");
+#endif
+#if !defined(Q_OS_WINCE)
QVERIFY(!actual.isEmpty());
- // not onterested in the program name, it might be different.
+ // not interested in the program name, it might be different.
actual.removeFirst();
QCOMPARE(actual, args);
@@ -1473,7 +1638,13 @@ void tst_QProcess::spaceArgsTest()
//-----------------------------------------------------------------------------
void tst_QProcess::exitCodeTest()
{
+#if defined(Q_OS_SYMBIAN)
+ // Kernel will run out of process handles on some hw, as there is some
+ // delay before they are recycled, so limit the amount of processes.
+ for (int i = 0; i < 50; ++i) {
+#else
for (int i = 0; i < 255; ++i) {
+#endif
QProcess process;
process.start("testExitCodes/testExitCodes " + QString::number(i));
QVERIFY(process.waitForFinished(5000));
@@ -1495,10 +1666,10 @@ void tst_QProcess::failToStart()
QSignalSpy finishedSpy(&process, SIGNAL(finished(int)));
QSignalSpy finishedSpy2(&process, SIGNAL(finished(int, QProcess::ExitStatus)));
-// Mac OS X and HP-UX have a really low defualt process limit (~100), so spawning
+// Mac OS X and HP-UX have a really low defualt process limit (~100), so spawning
// to many processes here will cause test failures later on.
#if defined Q_OS_HPUX
- const int attempts = 15;
+ const int attempts = 15;
#elif defined Q_OS_MAC
const int attempts = 15;
#else
@@ -1536,7 +1707,7 @@ void tst_QProcess::failToStart()
QCOMPARE(finishedSpy2.count(), 0);
int it = j * attempts + i + 1;
-
+
QCOMPARE(stateSpy.count(), it * 2);
QCOMPARE(qVariantValue<QProcess::ProcessState>(stateSpy.at(it * 2 - 2).at(0)), QProcess::Starting);
QCOMPARE(qVariantValue<QProcess::ProcessState>(stateSpy.at(it * 2 - 1).at(0)), QProcess::NotRunning);
@@ -1601,6 +1772,9 @@ void tst_QProcess::removeFileWhileProcessIsRunning()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
QFile file("removeFile.txt");
QVERIFY(file.open(QFile::WriteOnly));
@@ -1640,8 +1814,9 @@ void tst_QProcess::setEnvironment_data()
void tst_QProcess::setEnvironment()
{
-#if !defined (Q_OS_WINCE)
- // there is no concept of system variables on Windows CE as there is no console
+#if defined (Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+ QSKIP("OS doesn't support environment variables", SkipAll);
+#endif
// make sure our environment variables are correct
QVERIFY(qgetenv("tst_QProcess").isEmpty());
@@ -1717,12 +1892,11 @@ void tst_QProcess::setEnvironment()
QCOMPARE(process.readAll(), value.toLocal8Bit());
}
-#endif
}
//-----------------------------------------------------------------------------
void tst_QProcess::systemEnvironment()
{
-#if defined (Q_OS_WINCE)
+#if defined (Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
// there is no concept of system variables on Windows CE as there is no console
QVERIFY(QProcess::systemEnvironment().isEmpty());
QVERIFY(QProcess::systemEnvironmentHash().isEmpty());
@@ -1741,6 +1915,9 @@ void tst_QProcess::spaceInName()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
QProcess process;
process.start("test Space In Name/testSpaceInName", QStringList());
QVERIFY(process.waitForStarted());
@@ -1751,7 +1928,10 @@ void tst_QProcess::spaceInName()
//-----------------------------------------------------------------------------
void tst_QProcess::lockupsInStartDetached()
{
+#if !defined(Q_OS_SYMBIAN)
+ // What exactly is this call supposed to achieve anyway?
QHostInfo::lookupHost(QString("something.invalid"), 0, 0);
+#endif
QProcess::execute("yjhbrty");
QProcess::startDetached("yjhbrty");
}
@@ -1762,6 +1942,9 @@ void tst_QProcess::atEnd2()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
QProcess process;
@@ -1787,7 +1970,7 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess()
// Start a program that doesn't exist, process events and then try to waitForReadyRead
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
-
+
QProcess process;
QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError)));
QSignalSpy finishedSpy1(&process, SIGNAL(finished(int)));
@@ -1807,11 +1990,14 @@ void tst_QProcess::setStandardInputFile()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
static const char data[] = "A bunch\1of\2data\3\4\5\6\7...";
QProcess process;
QFile file("data");
-
+
QVERIFY(file.open(QIODevice::WriteOnly));
file.write(data, sizeof data);
file.close();
@@ -1823,7 +2009,7 @@ void tst_QProcess::setStandardInputFile()
process.start("testProcessEcho/testProcessEcho");
#endif
- QPROCESS_VERIFY(process, waitForFinished());
+ QPROCESS_VERIFY(process, waitForFinished());
QByteArray all = process.readAll();
QCOMPARE(all.size(), int(sizeof data) - 1); // testProcessEcho drops the ending \0
QVERIFY(all == data);
@@ -1863,6 +2049,9 @@ void tst_QProcess::setStandardOutputFile()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
static const char data[] = "Original data. ";
static const char testdata[] = "Test data.";
@@ -1894,7 +2083,7 @@ void tst_QProcess::setStandardOutputFile()
process.start("testProcessEcho2/testProcessEcho2");
#endif
process.write(testdata, sizeof testdata);
- QPROCESS_VERIFY(process,waitForFinished());
+ QPROCESS_VERIFY(process,waitForFinished());
// open the file again and verify the data
QVERIFY(file.open(QIODevice::ReadOnly));
@@ -1928,10 +2117,13 @@ void tst_QProcess::setStandardOutputProcess()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
QProcess source;
QProcess sink;
-
+
QFETCH(bool, merged);
source.setReadChannelMode(merged ? QProcess::MergedChannels : QProcess::SeparateChannels);
source.setStandardOutputProcess(&sink);
@@ -1963,6 +2155,9 @@ void tst_QProcess::fileWriterProcess()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
QString stdinStr;
for (int i = 0; i < 5000; ++i)
@@ -1989,17 +2184,30 @@ void tst_QProcess::fileWriterProcess()
//-----------------------------------------------------------------------------
void tst_QProcess::detachedWorkingDirectoryAndPid()
{
+#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
+ // WINSCW builds in Symbian do not allow multiple processes to load Qt libraries,
+ // so this test must be skipped.
+ QSKIP("Multiple processes loading Qt are not allowed in Qt/Symbian emulator.", SkipAll);
+#endif
qint64 pid;
#ifdef Q_OS_WINCE
QTest::qSleep(1000);
#endif
+#if defined(Q_OS_SYMBIAN)
+ // Symbian has no working directory support, so use logs dir as a shared directory
+ QFile infoFile(QLatin1String("c:\\logs\\detachedinfo.txt"));
+#else
QFile infoFile(QDir::currentPath() + QLatin1String("/detachedinfo.txt"));
+#endif
infoFile.remove();
QString workingDir = QDir::currentPath() + "/testDetached";
+
+#ifndef Q_OS_SYMBIAN
QVERIFY(QFile::exists(workingDir));
+#endif
QStringList args;
args << infoFile.fileName();
@@ -2023,6 +2231,9 @@ void tst_QProcess::detachedWorkingDirectoryAndPid()
qint64 actualPid = processIdString.toLongLong(&ok);
QVERIFY(ok);
+#if defined(Q_OS_SYMBIAN)
+ QEXPECT_FAIL("", "Working directory is not supported on Qt/symbian", Continue);
+#endif
QCOMPARE(actualWorkingDir, workingDir);
QCOMPARE(actualPid, pid);
}
@@ -2033,8 +2244,11 @@ void tst_QProcess::switchReadChannels()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Reading and writing to a process is not supported on Qt/Symbian", SkipAll);
+#endif
const char data[] = "ABCD";
-
+
QProcess process;
#ifdef Q_OS_MAC
@@ -2052,7 +2266,7 @@ void tst_QProcess::switchReadChannels()
process.setReadChannel(QProcess::StandardError);
QCOMPARE(process.read(1), QByteArray(&data[i], 1));
}
-
+
process.ungetChar('D');
process.setReadChannel(QProcess::StandardOutput);
process.ungetChar('D');
@@ -2068,6 +2282,9 @@ void tst_QProcess::setWorkingDirectory()
#ifdef Q_OS_WINCE
QSKIP("Windows CE does not support working directory logic", SkipAll);
#endif
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Symbian does not support working directory logic", SkipAll);
+#endif
process = new QProcess;
process->setWorkingDirectory("test");
#ifdef Q_OS_MAC
@@ -2100,13 +2317,22 @@ void tst_QProcess::startFinishStartFinish()
#else
process.start("testProcessOutput/testProcessOutput");
#endif
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QVERIFY(process.waitForReadyRead(10000));
QCOMPARE(QString::fromLatin1(process.readLine().trimmed()),
QString("0 -this is a number"));
#endif
if (process.state() != QProcess::NotRunning)
QVERIFY(process.waitForFinished(10000));
+#if defined(Q_OS_SYMBIAN)
+ // Symbian test outputs to a file, so check that
+ FILE* file = fopen("c:\\logs\\qprocess_output_test.txt","r");
+ char buf[30];
+ fgets(buf, 30, file);
+ QCOMPARE(QString::fromLatin1(buf),
+ QString("0 -this is a number\n"));
+ fclose(file);
+#endif
}
}
diff --git a/tests/auto/qqueue/qqueue.pro b/tests/auto/qqueue/qqueue.pro
index f6561d3..ed489f9 100644
--- a/tests/auto/qqueue/qqueue.pro
+++ b/tests/auto/qqueue/qqueue.pro
@@ -3,5 +3,4 @@ load(qttest_p4)
QT = core
SOURCES += tst_qqueue.cpp
-
-
+QT = core
diff --git a/tests/auto/qrand/qrand.pro b/tests/auto/qrand/qrand.pro
index 8f90fbc..c868ed4 100644
--- a/tests/auto/qrand/qrand.pro
+++ b/tests/auto/qrand/qrand.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qrand.cpp
QT = core
-
-
diff --git a/tests/auto/qreadlocker/qreadlocker.pro b/tests/auto/qreadlocker/qreadlocker.pro
index 33b0987..5919102 100644
--- a/tests/auto/qreadlocker/qreadlocker.pro
+++ b/tests/auto/qreadlocker/qreadlocker.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qreadlocker.cpp
QT = core
-
-
diff --git a/tests/auto/qreadwritelock/qreadwritelock.pro b/tests/auto/qreadwritelock/qreadwritelock.pro
index 2f75c64..4318b18 100644
--- a/tests/auto/qreadwritelock/qreadwritelock.pro
+++ b/tests/auto/qreadwritelock/qreadwritelock.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qreadwritelock.cpp
QT = core
-
-
diff --git a/tests/auto/qrect/qrect.pro b/tests/auto/qrect/qrect.pro
index 16dd550..75940b3 100644
--- a/tests/auto/qrect/qrect.pro
+++ b/tests/auto/qrect/qrect.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qrect.cpp
QT = core
-
-
diff --git a/tests/auto/qrect/tst_qrect.cpp b/tests/auto/qrect/tst_qrect.cpp
index 4e79126..d9fdab2 100644
--- a/tests/auto/qrect/tst_qrect.cpp
+++ b/tests/auto/qrect/tst_qrect.cpp
@@ -321,17 +321,17 @@ void tst_QRect::isNull_data()
QTest::addColumn<QRect>("r");
QTest::addColumn<bool>("isNull");
- QTest::newRow( "InvalidQRect" ) << getQRectCase( InvalidQRect ) << TRUE;
- QTest::newRow( "SmallestQRect" ) << getQRectCase( SmallestQRect ) << FALSE;
- QTest::newRow( "MiddleQRect" ) << getQRectCase( MiddleQRect ) << FALSE;
- QTest::newRow( "LargestQRect" ) << getQRectCase( LargestQRect ) << FALSE;
- QTest::newRow( "SmallestCoordQRect" ) << getQRectCase( SmallestCoordQRect ) << FALSE;
- QTest::newRow( "LargestCoordQRect" ) << getQRectCase( LargestCoordQRect ) << TRUE; // Due to overflow
- QTest::newRow( "RandomQRect" ) << getQRectCase( RandomQRect ) << FALSE;
- QTest::newRow( "NegativeSizeQRect" ) << getQRectCase( NegativeSizeQRect ) << FALSE;
- QTest::newRow( "NegativePointQRect" ) << getQRectCase( NegativePointQRect ) << FALSE;
- QTest::newRow( "NullQRect" ) << getQRectCase( NullQRect ) << TRUE;
- QTest::newRow( "EmptyQRect" ) << getQRectCase( EmptyQRect ) << TRUE;
+ QTest::newRow( "InvalidQRect" ) << getQRectCase( InvalidQRect ) << true;
+ QTest::newRow( "SmallestQRect" ) << getQRectCase( SmallestQRect ) << false;
+ QTest::newRow( "MiddleQRect" ) << getQRectCase( MiddleQRect ) << false;
+ QTest::newRow( "LargestQRect" ) << getQRectCase( LargestQRect ) << false;
+ QTest::newRow( "SmallestCoordQRect" ) << getQRectCase( SmallestCoordQRect ) << false;
+ QTest::newRow( "LargestCoordQRect" ) << getQRectCase( LargestCoordQRect ) << true; // Due to overflow
+ QTest::newRow( "RandomQRect" ) << getQRectCase( RandomQRect ) << false;
+ QTest::newRow( "NegativeSizeQRect" ) << getQRectCase( NegativeSizeQRect ) << false;
+ QTest::newRow( "NegativePointQRect" ) << getQRectCase( NegativePointQRect ) << false;
+ QTest::newRow( "NullQRect" ) << getQRectCase( NullQRect ) << true;
+ QTest::newRow( "EmptyQRect" ) << getQRectCase( EmptyQRect ) << true;
}
void tst_QRect::isNull()
@@ -350,17 +350,17 @@ void tst_QRect::newIsEmpty_data()
QTest::addColumn<QRect>("r");
QTest::addColumn<bool>("isEmpty");
- QTest::newRow( "InvalidQRect" ) << getQRectCase( InvalidQRect ) << TRUE;
- QTest::newRow( "SmallestQRect" ) << getQRectCase( SmallestQRect ) << FALSE;
- QTest::newRow( "MiddleQRect" ) << getQRectCase( MiddleQRect ) << FALSE;
- QTest::newRow( "LargestQRect" ) << getQRectCase( LargestQRect ) << FALSE;
- QTest::newRow( "SmallestCoordQRect" ) << getQRectCase( SmallestCoordQRect ) << FALSE;
- QTest::newRow( "LargestCoordQRect" ) << getQRectCase( LargestCoordQRect ) << FALSE;
- QTest::newRow( "RandomQRect" ) << getQRectCase( RandomQRect ) << FALSE;
- QTest::newRow( "NegativeSizeQRect" ) << getQRectCase( NegativeSizeQRect ) << TRUE;
- QTest::newRow( "NegativePointQRect" ) << getQRectCase( NegativePointQRect ) << FALSE;
- QTest::newRow( "NullQRect" ) << getQRectCase( NullQRect ) << TRUE;
- QTest::newRow( "EmptyQRect" ) << getQRectCase( EmptyQRect ) << TRUE;
+ QTest::newRow( "InvalidQRect" ) << getQRectCase( InvalidQRect ) << true;
+ QTest::newRow( "SmallestQRect" ) << getQRectCase( SmallestQRect ) << false;
+ QTest::newRow( "MiddleQRect" ) << getQRectCase( MiddleQRect ) << false;
+ QTest::newRow( "LargestQRect" ) << getQRectCase( LargestQRect ) << false;
+ QTest::newRow( "SmallestCoordQRect" ) << getQRectCase( SmallestCoordQRect ) << false;
+ QTest::newRow( "LargestCoordQRect" ) << getQRectCase( LargestCoordQRect ) << false;
+ QTest::newRow( "RandomQRect" ) << getQRectCase( RandomQRect ) << false;
+ QTest::newRow( "NegativeSizeQRect" ) << getQRectCase( NegativeSizeQRect ) << true;
+ QTest::newRow( "NegativePointQRect" ) << getQRectCase( NegativePointQRect ) << false;
+ QTest::newRow( "NullQRect" ) << getQRectCase( NullQRect ) << true;
+ QTest::newRow( "EmptyQRect" ) << getQRectCase( EmptyQRect ) << true;
}
void tst_QRect::newIsEmpty()
@@ -383,17 +383,17 @@ void tst_QRect::newIsValid_data()
QTest::addColumn<QRect>("r");
QTest::addColumn<bool>("isValid");
- QTest::newRow( "InvalidQRect" ) << getQRectCase( InvalidQRect ) << FALSE;
- QTest::newRow( "SmallestQRect" ) << getQRectCase( SmallestQRect ) << TRUE;
- QTest::newRow( "MiddleQRect" ) << getQRectCase( MiddleQRect ) << TRUE;
- QTest::newRow( "LargestQRect" ) << getQRectCase( LargestQRect ) << TRUE;
- QTest::newRow( "SmallestCoordQRect" ) << getQRectCase( SmallestCoordQRect ) << TRUE;
- QTest::newRow( "LargestCoordQRect" ) << getQRectCase( LargestCoordQRect ) << TRUE;
- QTest::newRow( "RandomQRect" ) << getQRectCase( RandomQRect ) << TRUE;
- QTest::newRow( "NegativeSizeQRect" ) << getQRectCase( NegativeSizeQRect ) << FALSE;
- QTest::newRow( "NegativePointQRect" ) << getQRectCase( NegativePointQRect ) << TRUE;
- QTest::newRow( "NullQRect" ) << getQRectCase( NullQRect ) << FALSE;
- QTest::newRow( "EmptyQRect" ) << getQRectCase( EmptyQRect ) << FALSE;
+ QTest::newRow( "InvalidQRect" ) << getQRectCase( InvalidQRect ) << false;
+ QTest::newRow( "SmallestQRect" ) << getQRectCase( SmallestQRect ) << true;
+ QTest::newRow( "MiddleQRect" ) << getQRectCase( MiddleQRect ) << true;
+ QTest::newRow( "LargestQRect" ) << getQRectCase( LargestQRect ) << true;
+ QTest::newRow( "SmallestCoordQRect" ) << getQRectCase( SmallestCoordQRect ) << true;
+ QTest::newRow( "LargestCoordQRect" ) << getQRectCase( LargestCoordQRect ) << true;
+ QTest::newRow( "RandomQRect" ) << getQRectCase( RandomQRect ) << true;
+ QTest::newRow( "NegativeSizeQRect" ) << getQRectCase( NegativeSizeQRect ) << false;
+ QTest::newRow( "NegativePointQRect" ) << getQRectCase( NegativePointQRect ) << true;
+ QTest::newRow( "NullQRect" ) << getQRectCase( NullQRect ) << false;
+ QTest::newRow( "EmptyQRect" ) << getQRectCase( EmptyQRect ) << false;
}
void tst_QRect::newIsValid()
@@ -4179,28 +4179,28 @@ void tst_QRect::intersectsRect_data()
QTest::addColumn<QRect>("rect2");
QTest::addColumn<bool>("intersects");
- QTest::newRow("test 01") << QRect(0, 0, 10, 10) << QRect( 2, 2, 6, 6) << TRUE;
- QTest::newRow("test 02") << QRect(0, 0, 10, 10) << QRect( 0, 0, 10, 10) << TRUE;
- QTest::newRow("test 03") << QRect(0, 0, 10, 10) << QRect( 2, 2, 10, 10) << TRUE;
- QTest::newRow("test 04") << QRect(0, 0, 10, 10) << QRect(20, 20, 10, 10) << FALSE;
+ QTest::newRow("test 01") << QRect(0, 0, 10, 10) << QRect( 2, 2, 6, 6) << true;
+ QTest::newRow("test 02") << QRect(0, 0, 10, 10) << QRect( 0, 0, 10, 10) << true;
+ QTest::newRow("test 03") << QRect(0, 0, 10, 10) << QRect( 2, 2, 10, 10) << true;
+ QTest::newRow("test 04") << QRect(0, 0, 10, 10) << QRect(20, 20, 10, 10) << false;
- QTest::newRow("test 05") << QRect(9, 9, -8, -8) << QRect( 2, 2, 6, 6) << TRUE;
- QTest::newRow("test 06") << QRect(9, 9, -8, -8) << QRect( 0, 0, 10, 10) << TRUE;
- QTest::newRow("test 07") << QRect(9, 9, -8, -8) << QRect( 2, 2, 10, 10) << TRUE;
- QTest::newRow("test 08") << QRect(9, 9, -8, -8) << QRect(20, 20, 10, 10) << FALSE;
+ QTest::newRow("test 05") << QRect(9, 9, -8, -8) << QRect( 2, 2, 6, 6) << true;
+ QTest::newRow("test 06") << QRect(9, 9, -8, -8) << QRect( 0, 0, 10, 10) << true;
+ QTest::newRow("test 07") << QRect(9, 9, -8, -8) << QRect( 2, 2, 10, 10) << true;
+ QTest::newRow("test 08") << QRect(9, 9, -8, -8) << QRect(20, 20, 10, 10) << false;
- QTest::newRow("test 09") << QRect(0, 0, 10, 10) << QRect( 7, 7, -4, -4) << TRUE;
- QTest::newRow("test 10") << QRect(0, 0, 10, 10) << QRect( 9, 9, -8, -8) << TRUE;
- QTest::newRow("test 11") << QRect(0, 0, 10, 10) << QRect(11, 11, -8, -8) << TRUE;
- QTest::newRow("test 12") << QRect(0, 0, 10, 10) << QRect(29, 29, -8, -8) << FALSE;
+ QTest::newRow("test 09") << QRect(0, 0, 10, 10) << QRect( 7, 7, -4, -4) << true;
+ QTest::newRow("test 10") << QRect(0, 0, 10, 10) << QRect( 9, 9, -8, -8) << true;
+ QTest::newRow("test 11") << QRect(0, 0, 10, 10) << QRect(11, 11, -8, -8) << true;
+ QTest::newRow("test 12") << QRect(0, 0, 10, 10) << QRect(29, 29, -8, -8) << false;
- QTest::newRow("test 13") << QRect() << QRect(10, 10, 10, 10) << FALSE;
- QTest::newRow("test 14") << QRect(10, 10, 10, 10) << QRect() << FALSE;
- QTest::newRow("test 15") << QRect() << QRect() << FALSE;
- QTest::newRow("test 16") << QRect(10, 10, 10, 10) << QRect(19, 15, 1, 5) << TRUE;
+ QTest::newRow("test 13") << QRect() << QRect(10, 10, 10, 10) << false;
+ QTest::newRow("test 14") << QRect(10, 10, 10, 10) << QRect() << false;
+ QTest::newRow("test 15") << QRect() << QRect() << false;
+ QTest::newRow("test 16") << QRect(10, 10, 10, 10) << QRect(19, 15, 1, 5) << true;
- QTest::newRow("test 17") << QRect(10, 10, 10, 10) << QRect(15, 19, 5, 1) << TRUE;
- QTest::newRow("test 18") << QRect(2, 0, 1, 652) << QRect(2, 0, 1, 652) << TRUE;
+ QTest::newRow("test 17") << QRect(10, 10, 10, 10) << QRect(15, 19, 5, 1) << true;
+ QTest::newRow("test 18") << QRect(2, 0, 1, 652) << QRect(2, 0, 1, 652) << true;
}
void tst_QRect::intersectsRect()
@@ -4218,28 +4218,28 @@ void tst_QRect::intersectsRectF_data()
QTest::addColumn<QRectF>("rect2");
QTest::addColumn<bool>("intersects");
- QTest::newRow("test 01") << QRectF(0, 0, 10, 10) << QRectF( 2, 2, 6, 6) << TRUE;
- QTest::newRow("test 02") << QRectF(0, 0, 10, 10) << QRectF( 0, 0, 10, 10) << TRUE;
- QTest::newRow("test 03") << QRectF(0, 0, 10, 10) << QRectF( 2, 2, 10, 10) << TRUE;
- QTest::newRow("test 04") << QRectF(0, 0, 10, 10) << QRectF(20, 20, 10, 10) << FALSE;
+ QTest::newRow("test 01") << QRectF(0, 0, 10, 10) << QRectF( 2, 2, 6, 6) << true;
+ QTest::newRow("test 02") << QRectF(0, 0, 10, 10) << QRectF( 0, 0, 10, 10) << true;
+ QTest::newRow("test 03") << QRectF(0, 0, 10, 10) << QRectF( 2, 2, 10, 10) << true;
+ QTest::newRow("test 04") << QRectF(0, 0, 10, 10) << QRectF(20, 20, 10, 10) << false;
- QTest::newRow("test 05") << QRectF(10, 10, -10, -10) << QRectF( 2, 2, 6, 6) << TRUE;
- QTest::newRow("test 06") << QRectF(10, 10, -10, -10) << QRectF( 0, 0, 10, 10) << TRUE;
- QTest::newRow("test 07") << QRectF(10, 10, -10, -10) << QRectF( 2, 2, 10, 10) << TRUE;
- QTest::newRow("test 08") << QRectF(10, 10, -10, -10) << QRectF(20, 20, 10, 10) << FALSE;
+ QTest::newRow("test 05") << QRectF(10, 10, -10, -10) << QRectF( 2, 2, 6, 6) << true;
+ QTest::newRow("test 06") << QRectF(10, 10, -10, -10) << QRectF( 0, 0, 10, 10) << true;
+ QTest::newRow("test 07") << QRectF(10, 10, -10, -10) << QRectF( 2, 2, 10, 10) << true;
+ QTest::newRow("test 08") << QRectF(10, 10, -10, -10) << QRectF(20, 20, 10, 10) << false;
- QTest::newRow("test 09") << QRectF(0, 0, 10, 10) << QRectF( 8, 8, -6, -6) << TRUE;
- QTest::newRow("test 10") << QRectF(0, 0, 10, 10) << QRectF(10, 10, -10, -10) << TRUE;
- QTest::newRow("test 11") << QRectF(0, 0, 10, 10) << QRectF(12, 12, -10, -10) << TRUE;
- QTest::newRow("test 12") << QRectF(0, 0, 10, 10) << QRectF(30, 30, -10, -10) << FALSE;
+ QTest::newRow("test 09") << QRectF(0, 0, 10, 10) << QRectF( 8, 8, -6, -6) << true;
+ QTest::newRow("test 10") << QRectF(0, 0, 10, 10) << QRectF(10, 10, -10, -10) << true;
+ QTest::newRow("test 11") << QRectF(0, 0, 10, 10) << QRectF(12, 12, -10, -10) << true;
+ QTest::newRow("test 12") << QRectF(0, 0, 10, 10) << QRectF(30, 30, -10, -10) << false;
- QTest::newRow("test 13") << QRectF() << QRectF(10, 10, 10, 10) << FALSE;
- QTest::newRow("test 14") << QRectF(10, 10, 10, 10) << QRectF() << FALSE;
- QTest::newRow("test 15") << QRectF() << QRectF() << FALSE;
+ QTest::newRow("test 13") << QRectF() << QRectF(10, 10, 10, 10) << false;
+ QTest::newRow("test 14") << QRectF(10, 10, 10, 10) << QRectF() << false;
+ QTest::newRow("test 15") << QRectF() << QRectF() << false;
- QTest::newRow("test 16") << QRectF(0, 0, 10, 10) << QRectF(10, 10, 10, 10) << FALSE;
- QTest::newRow("test 17") << QRectF(0, 0, 10, 10) << QRectF(0, 10, 10, 10) << FALSE;
- QTest::newRow("test 18") << QRectF(0, 0, 10, 10) << QRectF(10, 0, 10, 10) << FALSE;
+ QTest::newRow("test 16") << QRectF(0, 0, 10, 10) << QRectF(10, 10, 10, 10) << false;
+ QTest::newRow("test 17") << QRectF(0, 0, 10, 10) << QRectF(0, 10, 10, 10) << false;
+ QTest::newRow("test 18") << QRectF(0, 0, 10, 10) << QRectF(10, 0, 10, 10) << false;
}
void tst_QRect::intersectsRectF()
@@ -4257,24 +4257,24 @@ void tst_QRect::containsRect_data()
QTest::addColumn<QRect>("rect2");
QTest::addColumn<bool>("contains");
- QTest::newRow("test 01") << QRect(0, 0, 10, 10) << QRect( 2, 2, 6, 6) << TRUE;
- QTest::newRow("test 02") << QRect(0, 0, 10, 10) << QRect( 0, 0, 10, 10) << TRUE;
- QTest::newRow("test 03") << QRect(0, 0, 10, 10) << QRect( 2, 2, 10, 10) << FALSE;
- QTest::newRow("test 04") << QRect(0, 0, 10, 10) << QRect(20, 20, 10, 10) << FALSE;
+ QTest::newRow("test 01") << QRect(0, 0, 10, 10) << QRect( 2, 2, 6, 6) << true;
+ QTest::newRow("test 02") << QRect(0, 0, 10, 10) << QRect( 0, 0, 10, 10) << true;
+ QTest::newRow("test 03") << QRect(0, 0, 10, 10) << QRect( 2, 2, 10, 10) << false;
+ QTest::newRow("test 04") << QRect(0, 0, 10, 10) << QRect(20, 20, 10, 10) << false;
- QTest::newRow("test 05") << QRect(9, 9, -8, -8) << QRect( 2, 2, 6, 6) << TRUE;
- QTest::newRow("test 06") << QRect(9, 9, -8, -8) << QRect( 0, 0, 10, 10) << TRUE;
- QTest::newRow("test 07") << QRect(9, 9, -8, -8) << QRect( 2, 2, 10, 10) << FALSE;
- QTest::newRow("test 08") << QRect(9, 9, -8, -8) << QRect(20, 20, 10, 10) << FALSE;
+ QTest::newRow("test 05") << QRect(9, 9, -8, -8) << QRect( 2, 2, 6, 6) << true;
+ QTest::newRow("test 06") << QRect(9, 9, -8, -8) << QRect( 0, 0, 10, 10) << true;
+ QTest::newRow("test 07") << QRect(9, 9, -8, -8) << QRect( 2, 2, 10, 10) << false;
+ QTest::newRow("test 08") << QRect(9, 9, -8, -8) << QRect(20, 20, 10, 10) << false;
- QTest::newRow("test 09") << QRect(0, 0, 10, 10) << QRect( 7, 7, -4, -4) << TRUE;
- QTest::newRow("test 10") << QRect(0, 0, 10, 10) << QRect( 9, 9, -8, -8) << TRUE;
- QTest::newRow("test 11") << QRect(0, 0, 10, 10) << QRect(11, 11, -8, -8) << FALSE;
- QTest::newRow("test 12") << QRect(0, 0, 10, 10) << QRect(29, 29, -8, -8) << FALSE;
+ QTest::newRow("test 09") << QRect(0, 0, 10, 10) << QRect( 7, 7, -4, -4) << true;
+ QTest::newRow("test 10") << QRect(0, 0, 10, 10) << QRect( 9, 9, -8, -8) << true;
+ QTest::newRow("test 11") << QRect(0, 0, 10, 10) << QRect(11, 11, -8, -8) << false;
+ QTest::newRow("test 12") << QRect(0, 0, 10, 10) << QRect(29, 29, -8, -8) << false;
- QTest::newRow("test 13") << QRect(-1, 1, 10, 10) << QRect() << FALSE;
- QTest::newRow("test 14") << QRect() << QRect(0, 0, 10, 10) << FALSE;
- QTest::newRow("test 15") << QRect() << QRect() << FALSE;
+ QTest::newRow("test 13") << QRect(-1, 1, 10, 10) << QRect() << false;
+ QTest::newRow("test 14") << QRect() << QRect(0, 0, 10, 10) << false;
+ QTest::newRow("test 15") << QRect() << QRect() << false;
}
void tst_QRect::containsRect()
@@ -4292,24 +4292,24 @@ void tst_QRect::containsRectF_data()
QTest::addColumn<QRectF>("rect2");
QTest::addColumn<bool>("contains");
- QTest::newRow("test 01") << QRectF(0, 0, 10, 10) << QRectF( 2, 2, 6, 6) << TRUE;
- QTest::newRow("test 02") << QRectF(0, 0, 10, 10) << QRectF( 0, 0, 10, 10) << TRUE;
- QTest::newRow("test 03") << QRectF(0, 0, 10, 10) << QRectF( 2, 2, 10, 10) << FALSE;
- QTest::newRow("test 04") << QRectF(0, 0, 10, 10) << QRectF(20, 20, 10, 10) << FALSE;
+ QTest::newRow("test 01") << QRectF(0, 0, 10, 10) << QRectF( 2, 2, 6, 6) << true;
+ QTest::newRow("test 02") << QRectF(0, 0, 10, 10) << QRectF( 0, 0, 10, 10) << true;
+ QTest::newRow("test 03") << QRectF(0, 0, 10, 10) << QRectF( 2, 2, 10, 10) << false;
+ QTest::newRow("test 04") << QRectF(0, 0, 10, 10) << QRectF(20, 20, 10, 10) << false;
- QTest::newRow("test 05") << QRectF(10, 10, -10, -10) << QRectF( 2, 2, 6, 6) << TRUE;
- QTest::newRow("test 06") << QRectF(10, 10, -10, -10) << QRectF( 0, 0, 10, 10) << TRUE;
- QTest::newRow("test 07") << QRectF(10, 10, -10, -10) << QRectF( 2, 2, 10, 10) << FALSE;
- QTest::newRow("test 08") << QRectF(10, 10, -10, -10) << QRectF(20, 20, 10, 10) << FALSE;
+ QTest::newRow("test 05") << QRectF(10, 10, -10, -10) << QRectF( 2, 2, 6, 6) << true;
+ QTest::newRow("test 06") << QRectF(10, 10, -10, -10) << QRectF( 0, 0, 10, 10) << true;
+ QTest::newRow("test 07") << QRectF(10, 10, -10, -10) << QRectF( 2, 2, 10, 10) << false;
+ QTest::newRow("test 08") << QRectF(10, 10, -10, -10) << QRectF(20, 20, 10, 10) << false;
- QTest::newRow("test 09") << QRectF(0, 0, 10, 10) << QRectF( 8, 8, -6, -6) << TRUE;
- QTest::newRow("test 10") << QRectF(0, 0, 10, 10) << QRectF(10, 10, -10, -10) << TRUE;
- QTest::newRow("test 11") << QRectF(0, 0, 10, 10) << QRectF(12, 12, -10, -10) << FALSE;
- QTest::newRow("test 12") << QRectF(0, 0, 10, 10) << QRectF(30, 30, -10, -10) << FALSE;
+ QTest::newRow("test 09") << QRectF(0, 0, 10, 10) << QRectF( 8, 8, -6, -6) << true;
+ QTest::newRow("test 10") << QRectF(0, 0, 10, 10) << QRectF(10, 10, -10, -10) << true;
+ QTest::newRow("test 11") << QRectF(0, 0, 10, 10) << QRectF(12, 12, -10, -10) << false;
+ QTest::newRow("test 12") << QRectF(0, 0, 10, 10) << QRectF(30, 30, -10, -10) << false;
- QTest::newRow("test 13") << QRectF(-1, 1, 10, 10) << QRectF() << FALSE;
- QTest::newRow("test 14") << QRectF() << QRectF(0, 0, 10, 10) << FALSE;
- QTest::newRow("test 15") << QRectF() << QRectF() << FALSE;
+ QTest::newRow("test 13") << QRectF(-1, 1, 10, 10) << QRectF() << false;
+ QTest::newRow("test 14") << QRectF() << QRectF(0, 0, 10, 10) << false;
+ QTest::newRow("test 15") << QRectF() << QRectF() << false;
}
void tst_QRect::containsRectF()
@@ -4328,35 +4328,35 @@ void tst_QRect::containsPoint_data()
QTest::addColumn<bool>("contains");
QTest::addColumn<bool>("containsProper");
- QTest::newRow("test 01") << QRect(0, 0, 10, 10) << QPoint( 0, 0) << TRUE << FALSE;
- QTest::newRow("test 02") << QRect(0, 0, 10, 10) << QPoint( 0, 10) << FALSE << FALSE;
- QTest::newRow("test 03") << QRect(0, 0, 10, 10) << QPoint(10, 0) << FALSE << FALSE;
- QTest::newRow("test 04") << QRect(0, 0, 10, 10) << QPoint(10, 10) << FALSE << FALSE;
- QTest::newRow("test 05") << QRect(0, 0, 10, 10) << QPoint( 0, 9) << TRUE << FALSE;
- QTest::newRow("test 06") << QRect(0, 0, 10, 10) << QPoint( 9, 0) << TRUE << FALSE;
- QTest::newRow("test 07") << QRect(0, 0, 10, 10) << QPoint( 9, 9) << TRUE << FALSE;
- QTest::newRow("test 08") << QRect(0, 0, 10, 10) << QPoint( 1, 0) << TRUE << FALSE;
- QTest::newRow("test 09") << QRect(0, 0, 10, 10) << QPoint( 9, 1) << TRUE << FALSE;
- QTest::newRow("test 10") << QRect(0, 0, 10, 10) << QPoint( 1, 1) << TRUE << TRUE;
- QTest::newRow("test 11") << QRect(0, 0, 10, 10) << QPoint( 1, 8) << TRUE << TRUE;
- QTest::newRow("test 12") << QRect(0, 0, 10, 10) << QPoint( 8, 8) << TRUE << TRUE;
-
- QTest::newRow("test 13") << QRect(9, 9, -8, -8) << QPoint( 0, 0) << TRUE << FALSE;
- QTest::newRow("test 14") << QRect(9, 9, -8, -8) << QPoint( 0, 10) << FALSE << FALSE;
- QTest::newRow("test 15") << QRect(9, 9, -8, -8) << QPoint(10, 0) << FALSE << FALSE;
- QTest::newRow("test 16") << QRect(9, 9, -8, -8) << QPoint(10, 10) << FALSE << FALSE;
- QTest::newRow("test 17") << QRect(9, 9, -8, -8) << QPoint( 0, 9) << TRUE << FALSE;
- QTest::newRow("test 18") << QRect(9, 9, -8, -8) << QPoint( 9, 0) << TRUE << FALSE;
- QTest::newRow("test 19") << QRect(9, 9, -8, -8) << QPoint( 9, 9) << TRUE << FALSE;
- QTest::newRow("test 20") << QRect(9, 9, -8, -8) << QPoint( 1, 0) << TRUE << FALSE;
- QTest::newRow("test 21") << QRect(9, 9, -8, -8) << QPoint( 9, 1) << TRUE << FALSE;
- QTest::newRow("test 22") << QRect(9, 9, -8, -8) << QPoint( 1, 1) << TRUE << TRUE;
- QTest::newRow("test 23") << QRect(9, 9, -8, -8) << QPoint( 1, 8) << TRUE << TRUE;
- QTest::newRow("test 24") << QRect(9, 9, -8, -8) << QPoint( 8, 8) << TRUE << TRUE;
-
- QTest::newRow("test 25") << QRect(-1, 1, 10, 10) << QPoint() << FALSE << FALSE;
- QTest::newRow("test 26") << QRect() << QPoint(1, 1) << FALSE << FALSE;
- QTest::newRow("test 27") << QRect() << QPoint() << FALSE << FALSE;
+ QTest::newRow("test 01") << QRect(0, 0, 10, 10) << QPoint( 0, 0) << true << false;
+ QTest::newRow("test 02") << QRect(0, 0, 10, 10) << QPoint( 0, 10) << false << false;
+ QTest::newRow("test 03") << QRect(0, 0, 10, 10) << QPoint(10, 0) << false << false;
+ QTest::newRow("test 04") << QRect(0, 0, 10, 10) << QPoint(10, 10) << false << false;
+ QTest::newRow("test 05") << QRect(0, 0, 10, 10) << QPoint( 0, 9) << true << false;
+ QTest::newRow("test 06") << QRect(0, 0, 10, 10) << QPoint( 9, 0) << true << false;
+ QTest::newRow("test 07") << QRect(0, 0, 10, 10) << QPoint( 9, 9) << true << false;
+ QTest::newRow("test 08") << QRect(0, 0, 10, 10) << QPoint( 1, 0) << true << false;
+ QTest::newRow("test 09") << QRect(0, 0, 10, 10) << QPoint( 9, 1) << true << false;
+ QTest::newRow("test 10") << QRect(0, 0, 10, 10) << QPoint( 1, 1) << true << true;
+ QTest::newRow("test 11") << QRect(0, 0, 10, 10) << QPoint( 1, 8) << true << true;
+ QTest::newRow("test 12") << QRect(0, 0, 10, 10) << QPoint( 8, 8) << true << true;
+
+ QTest::newRow("test 13") << QRect(9, 9, -8, -8) << QPoint( 0, 0) << true << false;
+ QTest::newRow("test 14") << QRect(9, 9, -8, -8) << QPoint( 0, 10) << false << false;
+ QTest::newRow("test 15") << QRect(9, 9, -8, -8) << QPoint(10, 0) << false << false;
+ QTest::newRow("test 16") << QRect(9, 9, -8, -8) << QPoint(10, 10) << false << false;
+ QTest::newRow("test 17") << QRect(9, 9, -8, -8) << QPoint( 0, 9) << true << false;
+ QTest::newRow("test 18") << QRect(9, 9, -8, -8) << QPoint( 9, 0) << true << false;
+ QTest::newRow("test 19") << QRect(9, 9, -8, -8) << QPoint( 9, 9) << true << false;
+ QTest::newRow("test 20") << QRect(9, 9, -8, -8) << QPoint( 1, 0) << true << false;
+ QTest::newRow("test 21") << QRect(9, 9, -8, -8) << QPoint( 9, 1) << true << false;
+ QTest::newRow("test 22") << QRect(9, 9, -8, -8) << QPoint( 1, 1) << true << true;
+ QTest::newRow("test 23") << QRect(9, 9, -8, -8) << QPoint( 1, 8) << true << true;
+ QTest::newRow("test 24") << QRect(9, 9, -8, -8) << QPoint( 8, 8) << true << true;
+
+ QTest::newRow("test 25") << QRect(-1, 1, 10, 10) << QPoint() << false << false;
+ QTest::newRow("test 26") << QRect() << QPoint(1, 1) << false << false;
+ QTest::newRow("test 27") << QRect() << QPoint() << false << false;
}
void tst_QRect::containsPoint()
@@ -4367,7 +4367,7 @@ void tst_QRect::containsPoint()
QFETCH(bool, containsProper);
QVERIFY(rect.contains(point) == contains);
- QVERIFY(rect.contains(point, TRUE) == containsProper);
+ QVERIFY(rect.contains(point, true) == containsProper);
}
void tst_QRect::containsPointF_data()
@@ -4376,37 +4376,37 @@ void tst_QRect::containsPointF_data()
QTest::addColumn<QPointF>("point");
QTest::addColumn<bool>("contains");
- QTest::newRow("test 27") << QRectF() << QPointF() << FALSE;
-
- QTest::newRow("test 01") << QRectF(0, 0, 10, 10) << QPointF( 0, 0) << TRUE;
- QTest::newRow("test 02") << QRectF(0, 0, 10, 10) << QPointF( 0, 10) << TRUE;
- QTest::newRow("test 03") << QRectF(0, 0, 10, 10) << QPointF(10, 0) << TRUE;
- QTest::newRow("test 04") << QRectF(0, 0, 10, 10) << QPointF(10, 10) << TRUE;
- QTest::newRow("test 05") << QRectF(0, 0, 10, 10) << QPointF( 0, 9) << TRUE;
- QTest::newRow("test 06") << QRectF(0, 0, 10, 10) << QPointF( 9, 0) << TRUE;
- QTest::newRow("test 07") << QRectF(0, 0, 10, 10) << QPointF( 9, 9) << TRUE;
- QTest::newRow("test 08") << QRectF(0, 0, 10, 10) << QPointF( 1, 0) << TRUE;
- QTest::newRow("test 09") << QRectF(0, 0, 10, 10) << QPointF( 9, 1) << TRUE;
- QTest::newRow("test 10") << QRectF(0, 0, 10, 10) << QPointF( 1, 1) << TRUE;
- QTest::newRow("test 11") << QRectF(0, 0, 10, 10) << QPointF( 1, 8) << TRUE;
- QTest::newRow("test 12") << QRectF(0, 0, 10, 10) << QPointF( 8, 8) << TRUE;
-
- QTest::newRow("test 13") << QRectF(10, 10, -10, -10) << QPointF( 0, 0) << TRUE;
- QTest::newRow("test 14") << QRectF(10, 10, -10, -10) << QPointF( 0, 10) << TRUE;
- QTest::newRow("test 15") << QRectF(10, 10, -10, -10) << QPointF(10, 0) << TRUE;
- QTest::newRow("test 16") << QRectF(10, 10, -10, -10) << QPointF(10, 10) << TRUE;
- QTest::newRow("test 17") << QRectF(10, 10, -10, -10) << QPointF( 0, 9) << TRUE;
- QTest::newRow("test 18") << QRectF(10, 10, -10, -10) << QPointF( 9, 0) << TRUE;
- QTest::newRow("test 19") << QRectF(10, 10, -10, -10) << QPointF( 9, 9) << TRUE;
- QTest::newRow("test 20") << QRectF(10, 10, -10, -10) << QPointF( 1, 0) << TRUE;
- QTest::newRow("test 21") << QRectF(10, 10, -10, -10) << QPointF( 9, 1) << TRUE;
- QTest::newRow("test 22") << QRectF(10, 10, -10, -10) << QPointF( 1, 1) << TRUE;
- QTest::newRow("test 23") << QRectF(10, 10, -10, -10) << QPointF( 1, 8) << TRUE;
- QTest::newRow("test 24") << QRectF(10, 10, -10, -10) << QPointF( 8, 8) << TRUE;
-
- QTest::newRow("test 25") << QRectF(-1, 1, 10, 10) << QPointF() << FALSE;
- QTest::newRow("test 26") << QRectF() << QPointF(1, 1) << FALSE;
- QTest::newRow("test 27") << QRectF() << QPointF() << FALSE;
+ QTest::newRow("test 27") << QRectF() << QPointF() << false;
+
+ QTest::newRow("test 01") << QRectF(0, 0, 10, 10) << QPointF( 0, 0) << true;
+ QTest::newRow("test 02") << QRectF(0, 0, 10, 10) << QPointF( 0, 10) << true;
+ QTest::newRow("test 03") << QRectF(0, 0, 10, 10) << QPointF(10, 0) << true;
+ QTest::newRow("test 04") << QRectF(0, 0, 10, 10) << QPointF(10, 10) << true;
+ QTest::newRow("test 05") << QRectF(0, 0, 10, 10) << QPointF( 0, 9) << true;
+ QTest::newRow("test 06") << QRectF(0, 0, 10, 10) << QPointF( 9, 0) << true;
+ QTest::newRow("test 07") << QRectF(0, 0, 10, 10) << QPointF( 9, 9) << true;
+ QTest::newRow("test 08") << QRectF(0, 0, 10, 10) << QPointF( 1, 0) << true;
+ QTest::newRow("test 09") << QRectF(0, 0, 10, 10) << QPointF( 9, 1) << true;
+ QTest::newRow("test 10") << QRectF(0, 0, 10, 10) << QPointF( 1, 1) << true;
+ QTest::newRow("test 11") << QRectF(0, 0, 10, 10) << QPointF( 1, 8) << true;
+ QTest::newRow("test 12") << QRectF(0, 0, 10, 10) << QPointF( 8, 8) << true;
+
+ QTest::newRow("test 13") << QRectF(10, 10, -10, -10) << QPointF( 0, 0) << true;
+ QTest::newRow("test 14") << QRectF(10, 10, -10, -10) << QPointF( 0, 10) << true;
+ QTest::newRow("test 15") << QRectF(10, 10, -10, -10) << QPointF(10, 0) << true;
+ QTest::newRow("test 16") << QRectF(10, 10, -10, -10) << QPointF(10, 10) << true;
+ QTest::newRow("test 17") << QRectF(10, 10, -10, -10) << QPointF( 0, 9) << true;
+ QTest::newRow("test 18") << QRectF(10, 10, -10, -10) << QPointF( 9, 0) << true;
+ QTest::newRow("test 19") << QRectF(10, 10, -10, -10) << QPointF( 9, 9) << true;
+ QTest::newRow("test 20") << QRectF(10, 10, -10, -10) << QPointF( 1, 0) << true;
+ QTest::newRow("test 21") << QRectF(10, 10, -10, -10) << QPointF( 9, 1) << true;
+ QTest::newRow("test 22") << QRectF(10, 10, -10, -10) << QPointF( 1, 1) << true;
+ QTest::newRow("test 23") << QRectF(10, 10, -10, -10) << QPointF( 1, 8) << true;
+ QTest::newRow("test 24") << QRectF(10, 10, -10, -10) << QPointF( 8, 8) << true;
+
+ QTest::newRow("test 25") << QRectF(-1, 1, 10, 10) << QPointF() << false;
+ QTest::newRow("test 26") << QRectF() << QPointF(1, 1) << false;
+ QTest::newRow("test 27") << QRectF() << QPointF() << false;
}
void tst_QRect::containsPointF()
diff --git a/tests/auto/qregexp/qregexp.pro b/tests/auto/qregexp/qregexp.pro
index d467cda..80b6827 100644
--- a/tests/auto/qregexp/qregexp.pro
+++ b/tests/auto/qregexp/qregexp.pro
@@ -6,6 +6,3 @@ QT = core
QT = core
SOURCES += tst_qregexp.cpp
-QT -= gui
-
-
diff --git a/tests/auto/qregexp/tst_qregexp.cpp b/tests/auto/qregexp/tst_qregexp.cpp
index 0ab37ca..f97b95d 100644
--- a/tests/auto/qregexp/tst_qregexp.cpp
+++ b/tests/auto/qregexp/tst_qregexp.cpp
@@ -969,7 +969,7 @@ void tst_QRegExp::rainersSlowRegExpCopyBug()
{
// this test should take an extreme amount of time if QRegExp is broken
QRegExp original(email);
-#if defined(Q_OS_WINCE)
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
for (int i = 0; i < 100; ++i) {
#else
for (int i = 0; i < 100000; ++i) {
@@ -1022,7 +1022,7 @@ void Thread::run()
str += "abbbdekcz";
int x;
-#if defined(Q_OS_WINCE)
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
for (int j = 0; j < 100; ++j) {
#else
for (int j = 0; j < 10000; ++j) {
diff --git a/tests/auto/qregion/tst_qregion.cpp b/tests/auto/qregion/tst_qregion.cpp
index fce9234..8c49146 100644
--- a/tests/auto/qregion/tst_qregion.cpp
+++ b/tests/auto/qregion/tst_qregion.cpp
@@ -279,7 +279,7 @@ void tst_QRegion::emptyPolygonRegion_data()
QPolygon pa;
- QTest::newRow("no points") << pa << TRUE << 0 << QVector<QRect>();
+ QTest::newRow("no points") << pa << true << 0 << QVector<QRect>();
pa = QPolygon() << QPoint(10,10);
QTest::newRow("one point") << pa << true << 0 << QVector<QRect>();
pa = QPolygon() << QPoint(10,10) << QPoint(10,20);
@@ -381,7 +381,7 @@ void tst_QRegion::intersected_data()
QPolygon ps2(8);
ps1.putPoints(0,8, 20,20, 50,20, 50,100, 70,100, 70,20, 120,20, 120,200, 20, 200);
ps2.putPoints(0,8, 100,150, 140,150, 140,160, 160,160, 160,150, 200,150, 200,180, 100,180);
- QTest::newRow("task30716") << QRegion(ps1) << QRegion(ps2) << TRUE;
+ QTest::newRow("task30716") << QRegion(ps1) << QRegion(ps2) << true;
}
void tst_QRegion::intersected()
diff --git a/tests/auto/qresourceengine/qresourceengine.pro b/tests/auto/qresourceengine/qresourceengine.pro
index 1d53e19..3e47b52 100644
--- a/tests/auto/qresourceengine/qresourceengine.pro
+++ b/tests/auto/qresourceengine/qresourceengine.pro
@@ -7,26 +7,30 @@ load(resources)
# Input
SOURCES += tst_qresourceengine.cpp
-RESOURCES += testqrc/test.qrc
+RESOURCES += testqrc/test.qrc
-runtime_resource.target = runtime_resource.rcc
+symbian-sbsv2 {
+ runtime_resource.target = $$PWD/runtime_resource.rcc
+} else {
+ runtime_resource.target = runtime_resource.rcc
+}
runtime_resource.depends = $$PWD/testqrc/test.qrc
runtime_resource.commands = $$QMAKE_RCC -root /runtime_resource/ -binary $${runtime_resource.depends} -o $${runtime_resource.target}
QMAKE_EXTRA_TARGETS = runtime_resource
-ALL_DEPS += $${runtime_resource.target}
+PRE_TARGETDEPS += $${runtime_resource.target}
QT = core
-wince*:{
+wince*|symbian*:{
deploy.sources += runtime_resource.rcc parentdir.txt
- test.sources = testqrc/*
+ test.sources = testqrc/*
test.path = testqrc
alias.sources = testqrc/aliasdir/*
alias.path = testqrc/aliasdir
- other.sources = testqrc/otherdir/*
+ other.sources = testqrc/otherdir/*
other.path = testqrc/otherdir
- search1.sources = testqrc/searchpath1/*
+ search1.sources = testqrc/searchpath1/*
search1.path = testqrc/searchpath1
- search2.sources = testqrc/searchpath2/*
+ search2.sources = testqrc/searchpath2/*
search2.path = testqrc/searchpath2
sub.sources = testqrc/subdir/*
sub.path = testqrc/subdir
@@ -35,7 +39,7 @@ wince*:{
testsub2.sources = testqrc/test/test/*
testsub2.path = testqrc/test/test
DEPLOYMENT = deploy test alias other search1 search2 sub testsub testsub2
- DEFINES += SRCDIR=\\\"\\\"
+ !symbian:DEFINES += SRCDIR=\\\"\\\"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qresourceengine/tst_qresourceengine.cpp b/tests/auto/qresourceengine/tst_qresourceengine.cpp
index 5d2b821..8701c51 100644
--- a/tests/auto/qresourceengine/tst_qresourceengine.cpp
+++ b/tests/auto/qresourceengine/tst_qresourceengine.cpp
@@ -43,6 +43,10 @@
#include <QtTest/QtTest>
#include <QtCore>
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR "."
+#endif
+
class tst_QResourceEngine: public QObject
{
Q_OBJECT
diff --git a/tests/auto/qscopedpointer/.gitignore b/tests/auto/qscopedpointer/.gitignore
new file mode 100644
index 0000000..9f2324c
--- /dev/null
+++ b/tests/auto/qscopedpointer/.gitignore
@@ -0,0 +1 @@
+tst_qscopedpointer
diff --git a/tests/auto/qscopedpointer/qscopedpointer.pro b/tests/auto/qscopedpointer/qscopedpointer.pro
new file mode 100644
index 0000000..13d8425
--- /dev/null
+++ b/tests/auto/qscopedpointer/qscopedpointer.pro
@@ -0,0 +1,3 @@
+load(qttest_p4)
+SOURCES += tst_qscopedpointer.cpp
+QT -= gui
diff --git a/tests/auto/qscopedpointer/tst_qscopedpointer.cpp b/tests/auto/qscopedpointer/tst_qscopedpointer.cpp
new file mode 100644
index 0000000..f206ad1
--- /dev/null
+++ b/tests/auto/qscopedpointer/tst_qscopedpointer.cpp
@@ -0,0 +1,343 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtCore/QScopedPointer>
+
+/*!
+ \class tst_QScopedPointer
+ \internal
+ \since 4.6
+ \brief Tests class QScopedPointer.
+
+ */
+class tst_QScopedPointer : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void defaultConstructor();
+ void dataOnDefaultConstructed();
+ void useSubClassInConstructor();
+ void dataOnValue();
+ void dataSignature();
+ void reset();
+ void dereferenceOperator();
+ void dereferenceOperatorSignature();
+ void pointerOperator();
+ void pointerOperatorSignature();
+ void negationOperator();
+ void negationOperatorSignature();
+ void operatorBool();
+ void operatorBoolSignature();
+ void isNull();
+ void isNullSignature();
+ void objectSize();
+ void comparison();
+ // TODO instanciate on const object
+};
+
+void tst_QScopedPointer::defaultConstructor()
+{
+ /* Check that the members, one, is correctly initialized. */
+ QScopedPointer<int> p;
+ QCOMPARE(p.data(), static_cast<int *>(0));
+}
+
+void tst_QScopedPointer::dataOnDefaultConstructed()
+{
+ QScopedPointer<int> p;
+
+ QCOMPARE(p.data(), static_cast<int *>(0));
+}
+
+class MyClass
+{
+};
+
+class MySubClass : public MyClass
+{
+};
+
+void tst_QScopedPointer::useSubClassInConstructor()
+{
+ /* Use a syntax which users typically would do. */
+ QScopedPointer<MyClass> p(new MyClass());
+}
+
+void tst_QScopedPointer::dataOnValue()
+{
+ int *const rawPointer = new int(5);
+ QScopedPointer<int> p(rawPointer);
+
+ QCOMPARE(p.data(), rawPointer);
+}
+
+void tst_QScopedPointer::dataSignature()
+{
+ const QScopedPointer<int> p;
+ /* data() should be const. */
+ p.data();
+}
+
+void tst_QScopedPointer::reset()
+{
+ /* Call reset() on a default constructed value. */
+ {
+ QScopedPointer<int> p;
+ p.reset();
+ QCOMPARE(p.data(), static_cast<int *>(0));
+ }
+
+ /* Call reset() on an active value. */
+ {
+ QScopedPointer<int> p(new int(3));
+ p.reset();
+ QCOMPARE(p.data(), static_cast<int *>(0));
+ }
+
+ /* Call reset() with a value, on an active value. */
+ {
+ QScopedPointer<int> p(new int(3));
+
+ int *const value = new int(9);
+ p.reset(value);
+ QCOMPARE(*p.data(), 9);
+ }
+
+ /* Call reset() with a value, on default constructed value. */
+ {
+ QScopedPointer<int> p;
+
+ int *const value = new int(9);
+ p.reset(value);
+ QCOMPARE(*p.data(), 9);
+ }
+}
+
+class AbstractClass
+{
+public:
+ virtual ~AbstractClass()
+ {
+ }
+
+ virtual int member() const = 0;
+};
+
+class SubClass : public AbstractClass
+{
+public:
+ virtual int member() const
+ {
+ return 5;
+ }
+};
+
+void tst_QScopedPointer::dereferenceOperator()
+{
+ /* Dereference a basic value. */
+ {
+ QScopedPointer<int> p(new int(5));
+
+ const int value2 = *p;
+ QCOMPARE(value2, 5);
+ }
+
+ /* Dereference a pointer to an abstract class. This verifies
+ * that the operator returns a reference, when compiling
+ * with MSVC 2005. */
+ {
+ QScopedPointer<AbstractClass> p(new SubClass());
+
+ QCOMPARE((*p).member(), 5);
+ }
+}
+
+void tst_QScopedPointer::dereferenceOperatorSignature()
+{
+ /* The operator should be const. */
+ {
+ const QScopedPointer<int> p(new int(5));
+ *p;
+ }
+
+ /* A reference should be returned, not a value. */
+ {
+ const QScopedPointer<int> p(new int(5));
+ Q_UNUSED(static_cast<int &>(*p));
+ }
+
+ /* Instantiated on a const object, the returned object is a const reference. */
+ {
+ const QScopedPointer<const int> p(new int(5));
+ Q_UNUSED(static_cast<const int &>(*p));
+ }
+}
+
+class AnyForm
+{
+public:
+ int value;
+};
+
+void tst_QScopedPointer::pointerOperator()
+{
+ QScopedPointer<AnyForm> p(new AnyForm());
+ p->value = 5;
+
+ QCOMPARE(p->value, 5);
+}
+
+void tst_QScopedPointer::pointerOperatorSignature()
+{
+ /* The operator should be const. */
+ const QScopedPointer<AnyForm> p(new AnyForm);
+ p->value = 5;
+
+ QVERIFY(p->value);
+}
+
+void tst_QScopedPointer::negationOperator()
+{
+ /* Invoke on default constructed value. */
+ {
+ QScopedPointer<int> p;
+ QVERIFY(!p);
+ }
+
+ /* Invoke on a value. */
+ {
+ QScopedPointer<int> p(new int(2));
+ QCOMPARE(!p, false);
+ }
+}
+
+void tst_QScopedPointer::negationOperatorSignature()
+{
+ /* The signature should be const. */
+ const QScopedPointer<int> p;
+ !p;
+
+ /* The return value should be bool. */
+ static_cast<bool>(!p);
+}
+
+void tst_QScopedPointer::operatorBool()
+{
+ /* Invoke on default constructed value. */
+ {
+ QScopedPointer<int> p;
+ QCOMPARE(bool(p), false);
+ }
+
+ /* Invoke on active value. */
+ {
+ QScopedPointer<int> p(new int(3));
+ QVERIFY(p);
+ }
+}
+
+void tst_QScopedPointer::operatorBoolSignature()
+{
+ /* The signature should be const and return bool. */
+ const QScopedPointer<int> p;
+
+ (void)static_cast<bool>(p);
+}
+
+void tst_QScopedPointer::isNull()
+{
+ /* Invoke on default constructed value. */
+ {
+ QScopedPointer<int> p;
+ QVERIFY(p.isNull());
+ }
+
+ /* Invoke on a set value. */
+ {
+ QScopedPointer<int> p(new int(69));
+ QVERIFY(!p.isNull());
+ }
+}
+
+void tst_QScopedPointer::isNullSignature()
+{
+ const QScopedPointer<int> p(new int(69));
+
+ /* The signature should be const and return bool. */
+ static_cast<bool>(p.isNull());
+}
+
+void tst_QScopedPointer::objectSize()
+{
+ /* The size of QScopedPointer should be the same as one pointer. */
+ QCOMPARE(sizeof(QScopedPointer<int>), sizeof(void *));
+}
+
+void tst_QScopedPointer::comparison()
+{
+ int *a = new int(42);
+ int *b = new int(43);
+
+ QScopedPointer<int> pa(a);
+ QScopedPointer<int> pa2(a);
+ QScopedPointer<int> pb(b);
+
+ // test equality on equal pointers
+ QVERIFY(pa == pa2);
+ QVERIFY(pa2 == pa);
+
+ // test unequality on equal pointers
+ QVERIFY(!(pa != pa2));
+ QVERIFY(!(pa2 != pa));
+
+ // test on unequal pointers
+ QVERIFY(!(pa == pb));
+ QVERIFY(!(pb == pa));
+ QVERIFY(pb != pa);
+ QVERIFY(pa != pb);
+
+ pa2.take();
+}
+
+QTEST_MAIN(tst_QScopedPointer)
+#include "tst_qscopedpointer.moc"
diff --git a/tests/auto/qscriptengine/qscriptengine.pro b/tests/auto/qscriptengine/qscriptengine.pro
index 7c74b32..f72c070 100644
--- a/tests/auto/qscriptengine/qscriptengine.pro
+++ b/tests/auto/qscriptengine/qscriptengine.pro
@@ -1,11 +1,16 @@
load(qttest_p4)
QT = core gui script
SOURCES += tst_qscriptengine.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\"
-wince*: {
+wince*|symbian*: {
addFiles.sources = script
addFiles.path = .
DEPLOYMENT += addFiles
}
+symbian: {
+ TARGET.UID3 = 0xE0340006
+ DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x",""))
+ TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb"
+}
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 994a244..85cee28 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -55,6 +55,11 @@ Q_DECLARE_METATYPE(QObjectList)
//TESTED_CLASS=
//TESTED_FILES=
+#if defined(Q_OS_SYMBIAN)
+# define STRINGIFY(x) #x
+# define TOSTRING(x) STRINGIFY(x)
+# define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID)
+#endif
class tst_QScriptEngine : public QObject
{
Q_OBJECT
diff --git a/tests/auto/qscriptextqobject/qscriptextqobject.pro b/tests/auto/qscriptextqobject/qscriptextqobject.pro
index 87ab1b7..9da7f47 100644
--- a/tests/auto/qscriptextqobject/qscriptextqobject.pro
+++ b/tests/auto/qscriptextqobject/qscriptextqobject.pro
@@ -2,4 +2,6 @@ load(qttest_p4)
QT = core gui script
SOURCES += tst_qscriptextqobject.cpp
-
+symbian: {
+ TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb"
+}
diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
index 8de6c4e..1a5788e 100644
--- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
+++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
@@ -54,6 +54,10 @@
struct CustomType
{
+#if defined (Q_CC_NOKIAX86)
+ // Compiler crash workaround
+ CustomType() {}
+#endif
QString string;
};
Q_DECLARE_METATYPE(CustomType)
diff --git a/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro
index f6a6aeb..06b861e 100644
--- a/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro
+++ b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro
@@ -1,9 +1,12 @@
load(qttest_p4)
QT = core script
SOURCES += tst_qscriptjstestsuite.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
-wince*: {
+symbian {
+ TARGET.EPOCHEAPSIZE = 0x020000 0xA00000
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+}
+wince*|symbian*: {
testFiles.sources = tests
testFiles.path = .
DEPLOYMENT += testFiles
diff --git a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
index 350042d..f77738f 100644
--- a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
+++ b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
@@ -44,6 +44,10 @@
#include <QtScript>
+#if defined(Q_OS_SYMBIAN)
+# define SRCDIR ""
+#endif
+
//TESTED_CLASS=
//TESTED_FILES=
@@ -842,7 +846,7 @@ bool tst_Suite::isExcludedFile(const QString &fileName, QString *message) const
if (message)
*message = fileExclusions.at(i).second;
return true;
- }
+ }
}
return false;
}
diff --git a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro
index c07ab53..3f641b5 100644
--- a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro
+++ b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro
@@ -1,12 +1,12 @@
load(qttest_p4)
QT = core script
SOURCES += tst_qscriptv8testsuite.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\"
-wince*: {
+wince*|symbian: {
testFiles.sources = tests
testFiles.path = .
DEPLOYMENT += testFiles
}
-
+symbian:TARGET.EPOCHEAPSIZE = 0x00020000 0x02000000
diff --git a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp
index 7cf336c..68db92a 100644
--- a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp
+++ b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp
@@ -45,6 +45,10 @@
#include <QtScript>
+#if defined(Q_OS_SYMBIAN)
+# define SRCDIR ""
+#endif
+
//TESTED_CLASS=
//TESTED_FILES=
@@ -248,6 +252,10 @@ tst_Suite::tst_Suite()
addTestExclusion("mul-exhaustive", "Demands too much memory on WinCE");
#endif
+#ifdef Q_OS_SYMBIAN
+ addTestExclusion("nested-repetition-count-overflow", "Demands too much memory on Symbian");
+ addTestExclusion("unicode-test", "Demands too much memory on Symbian");
+#endif
// Failures due to switch to JSC as back-end
addExpectedFailure("date-parse", "NaN", "946713600000", willFixInNextReleaseMessage);
addExpectedFailure("delete-global-properties", "true", "false", willFixInNextReleaseMessage);
diff --git a/tests/auto/qsequentialanimationgroup/qsequentialanimationgroup.pro b/tests/auto/qsequentialanimationgroup/qsequentialanimationgroup.pro
index ad861c3..01ef68a 100644
--- a/tests/auto/qsequentialanimationgroup/qsequentialanimationgroup.pro
+++ b/tests/auto/qsequentialanimationgroup/qsequentialanimationgroup.pro
@@ -1,5 +1,5 @@
load(qttest_p4)
-QT = core gui
+QT = core
SOURCES += tst_qsequentialanimationgroup.cpp
diff --git a/tests/auto/qset/qset.pro b/tests/auto/qset/qset.pro
index 2656daf..05ad07d 100644
--- a/tests/auto/qset/qset.pro
+++ b/tests/auto/qset/qset.pro
@@ -1,7 +1,8 @@
load(qttest_p4)
SOURCES += tst_qset.cpp
-
-
QT = core
-
+symbian*: {
+TARGET.EPOCSTACKSIZE =0x5000
+TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb"
+}
diff --git a/tests/auto/qsettings/.gitattributes b/tests/auto/qsettings/.gitattributes
new file mode 100644
index 0000000..a4ad8d7
--- /dev/null
+++ b/tests/auto/qsettings/.gitattributes
@@ -0,0 +1,5 @@
+resourcefile.ini -crlf
+resourcefile2.ini -crlf
+resourcefile3.ini -crlf
+resourcefile4.ini -crlf
+resourcefile5.ini -crlf
diff --git a/tests/auto/qsettings/tst_qsettings.cpp b/tests/auto/qsettings/tst_qsettings.cpp
index c6cb60c..b93c807 100644
--- a/tests/auto/qsettings/tst_qsettings.cpp
+++ b/tests/auto/qsettings/tst_qsettings.cpp
@@ -52,7 +52,9 @@
#include <QtCore/QtDebug>
#include <QtCore/QString>
-#include <cctype>
+#if !defined(Q_OS_SYMBIAN)
+# include <cctype>
+#endif
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
// need for unlink on mingw
#include <io.h>
@@ -122,7 +124,7 @@ private slots:
void setPath();
void setDefaultFormat();
void dontCreateNeedlessPaths();
-#ifndef Q_OS_WIN
+#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN)
void dontReorderIniKeysNeedlessly();
#endif
@@ -209,7 +211,7 @@ void tst_QSettings::getSetCheck()
Q_DECLARE_METATYPE(QSettings::Format)
-#ifdef Q_OS_WINCE
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
static void removePath(const QString& _path)
{
QString path = _path;
@@ -356,9 +358,11 @@ void tst_QSettings::init()
QSettings(QSettings::SystemScope, "software.org").clear();
QSettings(QSettings::UserScope, "other.software.org").clear();
QSettings(QSettings::SystemScope, "other.software.org").clear();
+#elif defined(Q_OS_SYMBIAN)
+ removePath(settingsPath());
#endif
-#ifndef Q_OS_WIN
+#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN)
system(QString("chmod -R u+rw %1 2> /dev/null").arg(settingsPath()).toLatin1());
system(QString("rm -fr %1 2> /dev/null").arg(settingsPath()).toLatin1());
#endif
@@ -540,13 +544,13 @@ void tst_QSettings::ctor()
*/
QSettings settings5(format, QSettings::UserScope, "SoftWare.ORG", "killerApp");
if (format == QSettings::NativeFormat) {
-#if defined(Q_OS_WIN) || defined(Q_OS_DARWIN)
+#if defined(Q_OS_WIN) || defined(Q_OS_DARWIN) || defined(Q_OS_SYMBIAN)
QCOMPARE(settings5.value("key 1").toString(), QString("gurgle"));
#else
QVERIFY(!settings5.contains("key 1"));
#endif
} else {
-#if defined(Q_OS_WIN) || defined(Q_OS_DARWIN)
+#if defined(Q_OS_WIN) || defined(Q_OS_DARWIN) || defined(Q_OS_SYMBIAN)
QCOMPARE(settings5.value("key 1").toString(), QString("gurgle"));
#else
QVERIFY(!settings5.contains("key 1"));
@@ -716,6 +720,8 @@ void tst_QSettings::testErrorHandling()
#ifdef QT_BUILD_INTERNAL
#ifdef Q_OS_WIN
QSKIP("Windows doesn't support most file modes, including read-only directories, so this test is moot.", SkipAll);
+#elif defined(Q_OS_SYMBIAN)
+ QSKIP("Symbian/Open C doesn't support execute or write only file modes, or directory permissions, so this test is mostly moot.", SkipAll);
#elif defined(Q_OS_UNIX)
if (::getuid() == 0)
QSKIP("Running this test as root doesn't work, since file perms do not bother him", SkipAll);
@@ -1499,7 +1505,7 @@ void tst_QSettings::sync()
// Now "some other app" will change other.software.org.ini
QString userConfDir = settingsPath("__user__") + QDir::separator();
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
unlink((userConfDir + "other.software.org.ini").toLatin1());
rename((userConfDir + "software.org.ini").toLatin1(),
(userConfDir + "other.software.org.ini").toLatin1());
@@ -3679,7 +3685,7 @@ void tst_QSettings::dontCreateNeedlessPaths()
QVERIFY(!fileInfo.dir().exists());
}
-#ifndef Q_OS_WIN
+#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN)
void tst_QSettings::dontReorderIniKeysNeedlessly()
{
#ifdef QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER
diff --git a/tests/auto/qsharedmemory/lackey/scripts/producer.js b/tests/auto/qsharedmemory/lackey/scripts/producer.js
index 88b2b80..e02cd8b 100644
--- a/tests/auto/qsharedmemory/lackey/scripts/producer.js
+++ b/tests/auto/qsharedmemory/lackey/scripts/producer.js
@@ -15,6 +15,10 @@ if (!producer.create(size)) {
}
//print ("producer created and attached");
+QVERIFY(producer.lock());
+producer.set(0, 'Q');
+QVERIFY(producer.unlock());
+
var i = 0;
while(i < 5) {
QVERIFY(producer.lock(), "lock");
@@ -34,3 +38,7 @@ producer.set(0, 'E');
QVERIFY(producer.unlock());
//print ("producer done");
+
+// Sleep for a bit to let all consumers start, otherwise they will get stuck in the attach loop,
+// because at least in Symbian the shared memory will be destroyed if there are no active handles to it.
+producer.sleep(3000); \ No newline at end of file
diff --git a/tests/auto/qsharedmemory/src/qsystemlock_p.h b/tests/auto/qsharedmemory/src/qsystemlock_p.h
index 66df456..e123bed 100644
--- a/tests/auto/qsharedmemory/src/qsystemlock_p.h
+++ b/tests/auto/qsharedmemory/src/qsystemlock_p.h
@@ -47,6 +47,7 @@
#include "qsystemlock.h"
#include "private/qsharedmemory_p.h"
+#include <sys/types.h>
#define MAX_LOCKS 64
diff --git a/tests/auto/qsharedmemory/src/qsystemlock_unix.cpp b/tests/auto/qsharedmemory/src/qsystemlock_unix.cpp
index 1f91e0c..dd7da21 100644
--- a/tests/auto/qsharedmemory/src/qsystemlock_unix.cpp
+++ b/tests/auto/qsharedmemory/src/qsystemlock_unix.cpp
@@ -51,6 +51,7 @@
#include <fcntl.h>
#include <errno.h>
#include <sys/shm.h>
+#include <unistd.h>
#include <sys/sem.h>
// We have to define this as on some sem.h will have it
@@ -62,6 +63,25 @@ union qt_semun {
#define tr(x) QT_TRANSLATE_NOOP(QLatin1String("QSystemLock"), (x))
+#if defined(Q_OS_SYMBIAN)
+int createUnixKeyFile(const QString &fileName)
+{
+ if (QFile::exists(fileName))
+ return 0;
+
+ int fd = open(QFile::encodeName(fileName).constData(),
+ O_EXCL | O_CREAT | O_RDWR, 0640);
+ if (-1 == fd) {
+ if (errno == EEXIST)
+ return 0;
+ return -1;
+ } else {
+ close(fd);
+ }
+ return 1;
+}
+#endif
+
QSystemLockPrivate::QSystemLockPrivate() :
semaphore(-1), lockCount(0),
error(QSystemLock::NoError), unix_key(-1), createdFile(false), createdSemaphore(false)
@@ -105,7 +125,11 @@ key_t QSystemLockPrivate::handle()
}
// Create the file needed for ftok
+#if defined(Q_OS_SYMBIAN)
+ int built = createUnixKeyFile(fileName);
+#else
int built = QSharedMemoryPrivate::createUnixKeyFile(fileName);
+#endif
if (-1 == built)
return -1;
createdFile = (1 == built);
diff --git a/tests/auto/qsharedmemory/test/test.pro b/tests/auto/qsharedmemory/test/test.pro
index e294a75..779a942 100644
--- a/tests/auto/qsharedmemory/test/test.pro
+++ b/tests/auto/qsharedmemory/test/test.pro
@@ -17,13 +17,19 @@ TARGET = ../tst_qsharedmemory
}
}
-wince*: {
+wince*:{
QT += gui script
addFiles.sources = ../lackey/lackey.exe ../lackey/scripts
addFiles.path = lackey
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\"\\\"
+}else:symbian*{
+QT += gui script
+addFiles.sources = ../lackey/scripts
+addFiles.path = /data/qsharedmemorytemp/lackey
+addBin.sources = lackey.exe
+addBin.path = /sys/bin
+DEPLOYMENT += addFiles addBin
} else {
DEFINES += SRCDIR=\\\"$$PWD/../\\\"
}
-
diff --git a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/qsharedmemory/tst_qsharedmemory.cpp
index 1aa1ebb..b92011e 100644
--- a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp
+++ b/tests/auto/qsharedmemory/tst_qsharedmemory.cpp
@@ -49,8 +49,11 @@
#define EXISTING_SHARE "existing"
#define EXISTING_SIZE 1024
-Q_DECLARE_METATYPE(QSharedMemory::SharedMemoryError);
-Q_DECLARE_METATYPE(QSharedMemory::AccessMode);
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR "c:/data/qsharedmemorytemp/"
+#endif
+Q_DECLARE_METATYPE(QSharedMemory::SharedMemoryError)
+Q_DECLARE_METATYPE(QSharedMemory::AccessMode)
class tst_QSharedMemory : public QObject
{
@@ -405,6 +408,9 @@ void tst_QSharedMemory::readOnly()
#ifdef Q_OS_WIN
QSKIP("This test opens a crash dialog on Windows", SkipSingle);
#endif
+#if defined (Q_OS_SYMBIAN)
+ QSKIP("Readonly shared memory is not supported in symbian", SkipAll);
+#endif
QString program = "./lackey/lackey";
QStringList arguments;
rememberKey("readonly_segfault");
@@ -527,7 +533,9 @@ void tst_QSharedMemory::simpleProducerConsumer()
char *get = (char*)consumer.data();
// On Windows CE you always have ReadWrite access. Thus
// ViewMapOfFile returns the same pointer
-#ifndef Q_OS_WINCE
+ // On Symbian, the address will always be same, as
+ // write protection of chunks is not currently supported by Symbian
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QVERIFY(put != get);
#endif
for (int i = 0; i < size; ++i) {
@@ -629,6 +637,11 @@ public:
QVERIFY(producer.lock());
memory[0] = 'E';
QVERIFY(producer.unlock());
+
+#if defined(Q_OS_SYMBIAN)
+ // Sleep a while to ensure that consumers start properly
+ QTest::qSleep(1000);
+#endif
}
private:
@@ -660,12 +673,25 @@ void tst_QSharedMemory::simpleThreadedProducerConsumer()
#endif
Producer p;
+#if defined(Q_OS_SYMBIAN)
+ enum
+ {
+ /**
+ * The maximum stack size.
+ */
+ SymbianStackSize = 0x14000
+ };
+ p.setStackSize(SymbianStackSize);
+#endif
if (producerIsThread)
p.start();
QList<Consumer*> consumers;
for (int i = 0; i < threads; ++i) {
consumers.append(new Consumer());
+#if defined(Q_OS_SYMBIAN)
+ consumers.last()->setStackSize(SymbianStackSize);
+#endif
consumers.last()->start();
}
@@ -697,6 +723,9 @@ void tst_QSharedMemory::simpleProcessProducerConsumer_data()
*/
void tst_QSharedMemory::simpleProcessProducerConsumer()
{
+#if defined (Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
+ QSKIP("Cannot launch multiple Qt processes in Symbian emulator", SkipAll);
+#endif
QFETCH(int, processes);
rememberKey("market");
@@ -710,6 +739,7 @@ void tst_QSharedMemory::simpleProcessProducerConsumer()
producer.setProcessChannelMode(QProcess::ForwardedChannels);
producer.start("./lackey/lackey", arguments);
producer.waitForStarted();
+ QVERIFY(producer.error() != QProcess::FailedToStart);
QList<QProcess*> consumers;
for (int i = 0; i < processes; ++i) {
@@ -730,7 +760,8 @@ void tst_QSharedMemory::simpleProcessProducerConsumer()
while (!consumers.isEmpty()) {
consumers.first()->waitForFinished(1000);
- if (consumers.first()->exitStatus() != QProcess::NormalExit ||
+ if (consumers.first()->state() == QProcess::Running ||
+ consumers.first()->exitStatus() != QProcess::NormalExit ||
consumers.first()->exitCode() != 0) {
consumerFailed = true;
}
diff --git a/tests/auto/qsharedpointer/externaltests.cpp b/tests/auto/qsharedpointer/externaltests.cpp
index edf055c..f95b8b2 100644
--- a/tests/auto/qsharedpointer/externaltests.cpp
+++ b/tests/auto/qsharedpointer/externaltests.cpp
@@ -51,6 +51,10 @@
#include <QtCore/QDirIterator>
#include <QtCore/QDateTime>
+#ifdef Q_OS_SYMBIAN
+#define DEFAULT_MAKESPEC "X:/STLsupport/mkspecs/symbian-abld/"
+#endif
+
#ifndef DEFAULT_MAKESPEC
# error DEFAULT_MAKESPEC not defined
#endif
diff --git a/tests/auto/qsharedpointer/externaltests.pri b/tests/auto/qsharedpointer/externaltests.pri
index 1fdcf65..627af87 100644
--- a/tests/auto/qsharedpointer/externaltests.pri
+++ b/tests/auto/qsharedpointer/externaltests.pri
@@ -1,7 +1,8 @@
SOURCES += $$PWD/externaltests.cpp
HEADERS += $$PWD/externaltests.h
cleanedQMAKESPEC = $$replace(QMAKESPEC, \\\\, /)
-DEFINES += DEFAULT_MAKESPEC=\\\"$$cleanedQMAKESPEC\\\"
+!symbian:DEFINES += DEFAULT_MAKESPEC=\\\"$$cleanedQMAKESPEC\\\"
embedded:DEFINES += QTEST_NO_RTTI QTEST_CROSS_COMPILED
wince*:DEFINES += QTEST_CROSS_COMPILED
+symbian: DEFINES += QTEST_CROSS_COMPILED
diff --git a/tests/auto/qsharedpointer/qsharedpointer.pro b/tests/auto/qsharedpointer/qsharedpointer.pro
index 1759323..bbd31d7 100644
--- a/tests/auto/qsharedpointer/qsharedpointer.pro
+++ b/tests/auto/qsharedpointer/qsharedpointer.pro
@@ -9,6 +9,6 @@ HEADERS += forwarddeclared.h \
wrapper.h
QT = core
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
+!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\"
include(externaltests.pri)
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index b2afb9f..50818fe 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -55,6 +55,10 @@ namespace QtSharedPointer {
Q_CORE_EXPORT void internalSafetyCheckCleanCheck();
}
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR "."
+#endif
+
class tst_QSharedPointer: public QObject
{
Q_OBJECT
diff --git a/tests/auto/qsidebar/qsidebar.pro b/tests/auto/qsidebar/qsidebar.pro
index bfcaab7..b1fba73 100644
--- a/tests/auto/qsidebar/qsidebar.pro
+++ b/tests/auto/qsidebar/qsidebar.pro
@@ -5,4 +5,4 @@ include(../../src/qfiledialog.pri)
SOURCES += tst_qsidebar.cpp
TARGET = tst_qsidebar
-
+symbian:HEADERS += ../../../include/qtgui/private/qfileinfogatherer_p.h
diff --git a/tests/auto/qsignalspy/qsignalspy.pro b/tests/auto/qsignalspy/qsignalspy.pro
index 172bdad..4bc4a7b 100644
--- a/tests/auto/qsignalspy/qsignalspy.pro
+++ b/tests/auto/qsignalspy/qsignalspy.pro
@@ -1,6 +1,3 @@
load(qttest_p4)
SOURCES += tst_qsignalspy.cpp
-
QT = core
-
-
diff --git a/tests/auto/qsize/qsize.pro b/tests/auto/qsize/qsize.pro
index dddfa56..14786b8 100644
--- a/tests/auto/qsize/qsize.pro
+++ b/tests/auto/qsize/qsize.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qsize.cpp
-
-
-
+QT = core
diff --git a/tests/auto/qsizef/qsizef.pro b/tests/auto/qsizef/qsizef.pro
index c1288f6..703d721 100644
--- a/tests/auto/qsizef/qsizef.pro
+++ b/tests/auto/qsizef/qsizef.pro
@@ -1,4 +1,3 @@
load(qttest_p4)
SOURCES += tst_qsizef.cpp
-
-
+QT = core
diff --git a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp
index e6d418d..8f9dab9 100644
--- a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp
+++ b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp
@@ -57,6 +57,7 @@ public:
private slots:
void unexpectedDisconnection();
+ void mixingWithTimers();
};
tst_QSocketNotifier::tst_QSocketNotifier()
@@ -125,24 +126,24 @@ void tst_QSocketNotifier::unexpectedDisconnection()
QNativeSocketEngine readEnd1;
readEnd1.initialize(QAbstractSocket::TcpSocket);
- bool b = readEnd1.connectToHost(server.serverAddress(), server.serverPort());
+ bool b = readEnd1.connectToHost(server.serverAddress(), server.serverPort());
QVERIFY(readEnd1.waitForWrite());
// while (!b && readEnd1.state() != QAbstractSocket::ConnectedState)
// b = readEnd1.connectToHost(server.serverAddress(), server.serverPort());
QVERIFY(readEnd1.state() == QAbstractSocket::ConnectedState);
- QVERIFY(server.waitForNewConnection());
+ QVERIFY(server.waitForNewConnection());
QTcpSocket *writeEnd1 = server.nextPendingConnection();
QVERIFY(writeEnd1 != 0);
-
+
QNativeSocketEngine readEnd2;
readEnd2.initialize(QAbstractSocket::TcpSocket);
- b = readEnd2.connectToHost(server.serverAddress(), server.serverPort());
+ b = readEnd2.connectToHost(server.serverAddress(), server.serverPort());
QVERIFY(readEnd2.waitForWrite());
// while (!b)
// b = readEnd2.connectToHost(server.serverAddress(), server.serverPort());
QVERIFY(readEnd2.state() == QAbstractSocket::ConnectedState);
- QVERIFY(server.waitForNewConnection());
- QTcpSocket *writeEnd2 = server.nextPendingConnection();
+ QVERIFY(server.waitForNewConnection());
+ QTcpSocket *writeEnd2 = server.nextPendingConnection();
QVERIFY(writeEnd2 != 0);
writeEnd1->write("1", 1);
@@ -155,18 +156,17 @@ void tst_QSocketNotifier::unexpectedDisconnection()
writeEnd2->flush();
UnexpectedDisconnectTester tester(&readEnd1, &readEnd2);
- QEventLoop eventLoop;
- connect(&tester, SIGNAL(finished()), &eventLoop, SLOT(quit()));
- eventLoop.exec();
+
+ do {
+ // we have to wait until sequence value changes
+ // as any event can make us jump out processing
+ QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents);
+ } while(tester.sequence <= 0);
QVERIFY(readEnd1.state() == QAbstractSocket::ConnectedState);
QVERIFY(readEnd2.state() == QAbstractSocket::ConnectedState);
-#if defined(Q_OS_WIN)
- qWarning("### Windows returns 1 activation, Unix returns 2.");
- QCOMPARE(tester.sequence, 1);
-#else
+
QCOMPARE(tester.sequence, 2);
-#endif
readEnd1.close();
readEnd2.close();
@@ -175,5 +175,67 @@ void tst_QSocketNotifier::unexpectedDisconnection()
server.close();
}
+class MixingWithTimersHelper : public QObject
+{
+ Q_OBJECT
+
+public:
+ MixingWithTimersHelper(QTimer *timer, QTcpServer *server);
+
+ bool timerActivated;
+ bool socketActivated;
+
+private slots:
+ void timerFired();
+ void socketFired();
+};
+
+MixingWithTimersHelper::MixingWithTimersHelper(QTimer *timer, QTcpServer *server)
+{
+ timerActivated = false;
+ socketActivated = false;
+
+ connect(timer, SIGNAL(timeout()), SLOT(timerFired()));
+ connect(server, SIGNAL(newConnection()), SLOT(socketFired()));
+}
+
+void MixingWithTimersHelper::timerFired()
+{
+ timerActivated = true;
+}
+
+void MixingWithTimersHelper::socketFired()
+{
+ socketActivated = true;
+}
+
+void tst_QSocketNotifier::mixingWithTimers()
+{
+ QTimer timer;
+ timer.setInterval(0);
+ timer.start();
+
+ QTcpServer server;
+ QVERIFY(server.listen(QHostAddress::LocalHost, 0));
+
+ MixingWithTimersHelper helper(&timer, &server);
+
+ QCoreApplication::processEvents();
+
+ QCOMPARE(helper.timerActivated, true);
+ QCOMPARE(helper.socketActivated, false);
+
+ helper.timerActivated = false;
+ helper.socketActivated = false;
+
+ QTcpSocket socket;
+ socket.connectToHost(server.serverAddress(), server.serverPort());
+
+ QCoreApplication::processEvents();
+
+ QCOMPARE(helper.timerActivated, true);
+ QCOMPARE(helper.socketActivated, true);
+}
+
QTEST_MAIN(tst_QSocketNotifier)
#include <tst_qsocketnotifier.moc>
diff --git a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro b/tests/auto/qsocks5socketengine/qsocks5socketengine.pro
index d19b732..4a32852 100644
--- a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro
+++ b/tests/auto/qsocks5socketengine/qsocks5socketengine.pro
@@ -9,6 +9,8 @@ MOC_DIR=tmp
QT = core network
+# Symbian toolchain does not support correct include semantics
+symbian:INCPATH+=..\..\..\include\QtNetwork\private
requires(contains(QT_CONFIG,private_tests))
diff --git a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp
index 9dd23e6..33bf315 100644
--- a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp
+++ b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp
@@ -147,11 +147,11 @@ private slots:
tst_QSocks5SocketEngine::tst_QSocks5SocketEngine()
{
+ Q_SET_DEFAULT_IAP
}
tst_QSocks5SocketEngine::~tst_QSocks5SocketEngine()
{
-
}
void tst_QSocks5SocketEngine::init()
@@ -302,7 +302,7 @@ void tst_QSocks5SocketEngine::errorTest()
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)),
&QTestEventLoop::instance(), SLOT(exitLoop()));
- QTestEventLoop::instance().enterLoop(5);
+ QTestEventLoop::instance().enterLoop(10);
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(int(socket.error()), expectedError);
@@ -336,8 +336,7 @@ void tst_QSocks5SocketEngine::simpleConnectToIMAP()
QVERIFY(socketDevice.read(array.data(), array.size()) == available);
// Check that the greeting is what we expect it to be
- QCOMPARE(array.constData(),
- "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ QCOMPARE(array.constData(), QtNetworkSettings::expectedReplyIMAP().constData());
// Write a logout message
QByteArray array2 = "XXXX LOGOUT\r\n";
@@ -529,6 +528,10 @@ void tst_QSocks5SocketEngine::serverTest()
//---------------------------------------------------------------------------
void tst_QSocks5SocketEngine::udpTest()
{
+#ifdef SYMBIAN_WINSOCK_CONNECTIVITY
+ QSKIP("UDP works bads on non WinPCAP emulator setting", SkipAll);
+#endif
+
QSocks5SocketEngine udpSocket;
// Initialize device #1
@@ -593,7 +596,7 @@ void tst_QSocks5SocketEngine::tcpSocketBlockingTest()
// Read greeting
QVERIFY(socket.waitForReadyRead(5000));
QString s = socket.readLine();
- QCOMPARE(s.toLatin1().constData(), "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ QCOMPARE(s.toLatin1().constData(), QtNetworkSettings::expectedReplyIMAP().constData());
// Write NOOP
QCOMPARE((int) socket.write("1 NOOP\r\n", 8), 8);
@@ -668,7 +671,8 @@ void tst_QSocks5SocketEngine::tcpSocketNonBlockingTest()
// Read greeting
QVERIFY(!tcpSocketNonBlocking_data.isEmpty());
QCOMPARE(tcpSocketNonBlocking_data.at(0).toLatin1().constData(),
- "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ QtNetworkSettings::expectedReplyIMAP().constData());
+
tcpSocketNonBlocking_data.clear();
tcpSocketNonBlocking_totalWritten = 0;
@@ -690,7 +694,6 @@ void tst_QSocks5SocketEngine::tcpSocketNonBlockingTest()
QFAIL("Timed out");
}
-
// Read response
QVERIFY(!tcpSocketNonBlocking_data.isEmpty());
QCOMPARE(tcpSocketNonBlocking_data.at(0).toLatin1().constData(), "1 OK Completed\r\n");
@@ -787,7 +790,7 @@ void tst_QSocks5SocketEngine::downloadBigFile()
QTime stopWatch;
stopWatch.start();
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QTestEventLoop::instance().enterLoop(60);
#else
QTestEventLoop::instance().enterLoop(180);
@@ -834,6 +837,7 @@ void tst_QSocks5SocketEngine::passwordAuth()
socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080, "qsockstest", "password"));
+ // Connect to imap.trolltech.com's IP
QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143));
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState);
QVERIFY(socketDevice.waitForWrite());
@@ -854,8 +858,7 @@ void tst_QSocks5SocketEngine::passwordAuth()
QVERIFY(socketDevice.read(array.data(), array.size()) == available);
// Check that the greeting is what we expect it to be
- QCOMPARE(array.constData(),
- "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ QCOMPARE(array.constData(), QtNetworkSettings::expectedReplyIMAP().constData());
// Write a logout message
QByteArray array2 = "XXXX LOGOUT\r\n";
@@ -923,8 +926,7 @@ void tst_QSocks5SocketEngine::passwordAuth2()
QVERIFY(socketDevice.read(array.data(), array.size()) == available);
// Check that the greeting is what we expect it to be
- QCOMPARE(array.constData(),
- "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ QCOMPARE(array.constData(), QtNetworkSettings::expectedReplyIMAP().constData());
// Write a logout message
QByteArray array2 = "XXXX LOGOUT\r\n";
diff --git a/tests/auto/qsound/qsound.pro b/tests/auto/qsound/qsound.pro
index 20c6098..75da2e6 100644
--- a/tests/auto/qsound/qsound.pro
+++ b/tests/auto/qsound/qsound.pro
@@ -1,7 +1,7 @@
load(qttest_p4)
SOURCES += tst_qsound.cpp
-wince*: {
+wince*|symbian*: {
deploy.sources += 4.wav
DEPLOYMENT = deploy
} \ No newline at end of file
diff --git a/tests/auto/qsplitter/qsplitter.pro b/tests/auto/qsplitter/qsplitter.pro
index a7ff0a6..5ec2b9d 100644
--- a/tests/auto/qsplitter/qsplitter.pro
+++ b/tests/auto/qsplitter/qsplitter.pro
@@ -4,11 +4,11 @@ SOURCES += tst_qsplitter.cpp
contains(QT_CONFIG, qt3support): QT += qt3support
-wince*: {
+wince*|symbian*: {
addFiles.sources = extradata.txt setSizes3.dat
addFiles.path = .
DEPLOYMENT += addFiles
- DEFINES += SRCDIR=\\\"./\\\"
+ !symbian:DEFINES += SRCDIR=\\\"./\\\"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qsplitter/tst_qsplitter.cpp b/tests/auto/qsplitter/tst_qsplitter.cpp
index 885716a..e9ce8dd 100644
--- a/tests/auto/qsplitter/tst_qsplitter.cpp
+++ b/tests/auto/qsplitter/tst_qsplitter.cpp
@@ -57,6 +57,10 @@
#include <qdebug.h> // for file error messages
#include "../../shared/util.h"
+#if defined(Q_OS_SYMBIAN)
+# define SRCDIR ""
+#endif
+
//TESTED_CLASS=
//TESTED_FILES=
diff --git a/tests/auto/qsql/qsql.pro b/tests/auto/qsql/qsql.pro
index 2c0e337..167a38d 100644
--- a/tests/auto/qsql/qsql.pro
+++ b/tests/auto/qsql/qsql.pro
@@ -1,10 +1,18 @@
load(qttest_p4)
SOURCES += tst_qsql.cpp
-QT += sql
+QT += sql
contains(QT_CONFIG, qt3support): QT += qt3support
wince*: {
DEPLOYMENT_PLUGIN += qsqlite
}
+
+symbian {
+ contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
+ sqlite.path = /sys/bin
+ sqlite.sources = sqlite3.dll
+ DEPLOYMENT += sqlite
+ }
+}
diff --git a/tests/auto/qsqldatabase/qsqldatabase.pro b/tests/auto/qsqldatabase/qsqldatabase.pro
index 3bca79a..964c8c9 100644
--- a/tests/auto/qsqldatabase/qsqldatabase.pro
+++ b/tests/auto/qsqldatabase/qsqldatabase.pro
@@ -19,5 +19,14 @@ wince*: {
DEPLOYMENT += testData
}
-
+symbian {
+ TARGET.EPOCHEAPSIZE=5000 5000000
+ TARGET.EPOCSTACKSIZE=50000
+
+ contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
+ sqlite.path = /sys/bin
+ sqlite.sources = sqlite3.dll
+ DEPLOYMENT += sqlite
+ }
+}
diff --git a/tests/auto/qsqlerror/qsqlerror.pro b/tests/auto/qsqlerror/qsqlerror.pro
index 570c88e..2eb7934 100644
--- a/tests/auto/qsqlerror/qsqlerror.pro
+++ b/tests/auto/qsqlerror/qsqlerror.pro
@@ -7,4 +7,10 @@ QT = core sql
SOURCES += tst_qsqlerror.cpp
-
+symbian {
+ contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
+ sqlite.path = /sys/bin
+ sqlite.sources = sqlite3.dll
+ DEPLOYMENT += sqlite
+ }
+}
diff --git a/tests/auto/qsqlfield/qsqlfield.pro b/tests/auto/qsqlfield/qsqlfield.pro
index 04875fd..6e5b461 100644
--- a/tests/auto/qsqlfield/qsqlfield.pro
+++ b/tests/auto/qsqlfield/qsqlfield.pro
@@ -3,5 +3,11 @@ SOURCES += tst_qsqlfield.cpp
QT += sql
-
+symbian {
+ contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
+ sqlite.path = /sys/bin
+ sqlite.sources = sqlite3.dll
+ DEPLOYMENT += sqlite
+ }
+}
diff --git a/tests/auto/qsqlquery/qsqlquery.pro b/tests/auto/qsqlquery/qsqlquery.pro
index 7996637..494ca4c 100644
--- a/tests/auto/qsqlquery/qsqlquery.pro
+++ b/tests/auto/qsqlquery/qsqlquery.pro
@@ -13,3 +13,11 @@ wince*: {
DEPLOYMENT += plugFiles
LIBS += -lws2
}
+
+symbian {
+ contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
+ sqlite.path = /sys/bin
+ sqlite.sources = sqlite3.dll
+ DEPLOYMENT += sqlite
+ }
+}
diff --git a/tests/auto/qsqlquerymodel/qsqlquerymodel.pro b/tests/auto/qsqlquerymodel/qsqlquerymodel.pro
index 6004ab0..cd8586c 100644
--- a/tests/auto/qsqlquerymodel/qsqlquerymodel.pro
+++ b/tests/auto/qsqlquerymodel/qsqlquerymodel.pro
@@ -5,7 +5,13 @@ QT += sql
wince*: {
DEPLOYMENT_PLUGIN += qsqlite
- LIBS += -lws2
+ LIBS += -lws2
+}else:symbian {
+ contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
+ sqlite.path = /sys/bin
+ sqlite.sources = sqlite3.dll
+ DEPLOYMENT += sqlite
+ }
} else {
win32:LIBS += -lws2_32
}
diff --git a/tests/auto/qsqlrecord/qsqlrecord.pro b/tests/auto/qsqlrecord/qsqlrecord.pro
index 819ae59..67e8ab9 100644
--- a/tests/auto/qsqlrecord/qsqlrecord.pro
+++ b/tests/auto/qsqlrecord/qsqlrecord.pro
@@ -1,6 +1,16 @@
load(qttest_p4)
SOURCES += tst_qsqlrecord.cpp
+symbian {
+contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
+ sqlite.path = /sys/bin
+ sqlite.sources = sqlite3.dll
+ DEPLOYMENT += sqlite
+}
+
+TARGET.EPOCSTACKSIZE=50000
+TARGET.EPOCHEAPSIZE=50000 5000000
+}
QT += sql
diff --git a/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro b/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
index a25cb93..2fddd03 100644
--- a/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
+++ b/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
@@ -6,8 +6,14 @@ QT += sql
wince*: {
plugFiles.sources = ../../../plugins/sqldrivers
plugFiles.path = .
- DEPLOYMENT += plugFiles
+ DEPLOYMENT += plugFiles
LIBS += -lws2
+}else:symbian {
+ contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
+ sqlite.path = /sys/bin
+ sqlite.sources = sqlite3.dll
+ DEPLOYMENT += sqlite
+ }
} else {
win32-g++ {
LIBS += -lws2_32
diff --git a/tests/auto/qsqltablemodel/qsqltablemodel.pro b/tests/auto/qsqltablemodel/qsqltablemodel.pro
index 170862e..a046fb1 100644
--- a/tests/auto/qsqltablemodel/qsqltablemodel.pro
+++ b/tests/auto/qsqltablemodel/qsqltablemodel.pro
@@ -8,7 +8,13 @@ wince*: {
plugFiles.path = .
DEPLOYMENT += plugFiles
LIBS += -lws2
-} else {
+}else:symbian {
+ contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
+ sqlite.path = /sys/bin
+ sqlite.sources = sqlite3.dll
+ DEPLOYMENT += sqlite
+ }
+}else {
win32:LIBS += -lws2_32
}
diff --git a/tests/auto/qsqlthread/qsqlthread.pro b/tests/auto/qsqlthread/qsqlthread.pro
index 9049f4c..2708f1a 100644
--- a/tests/auto/qsqlthread/qsqlthread.pro
+++ b/tests/auto/qsqlthread/qsqlthread.pro
@@ -9,7 +9,13 @@ wince*: {
plugFiles.path = .
DEPLOYMENT += plugFiles
LIBS += -lws2
-} else {
+}else:symbian {
+ contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
+ sqlite.path = /sys/bin
+ sqlite.sources = sqlite3.dll
+ DEPLOYMENT += sqlite
+ }
+}else {
win32:LIBS += -lws2_32
}
diff --git a/tests/auto/qsslcertificate/qsslcertificate.pro b/tests/auto/qsslcertificate/qsslcertificate.pro
index f3f7adb..b237f2e 100644
--- a/tests/auto/qsslcertificate/qsslcertificate.pro
+++ b/tests/auto/qsslcertificate/qsslcertificate.pro
@@ -2,7 +2,7 @@ load(qttest_p4)
SOURCES += tst_qsslcertificate.cpp
!wince*:win32:LIBS += -lws2_32
-QT += network
+QT = core network
TARGET = tst_qsslcertificate
@@ -14,13 +14,14 @@ win32 {
}
}
-wince*: {
+wince*|symbian: {
certFiles.sources = certificates more-certificates
certFiles.path = .
DEPLOYMENT += certFiles
+}
+
+wince*: {
DEFINES += SRCDIR=\\\".\\\"
-} else {
+} else:!symbian {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
-
-
diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
index 73d7afd..c046e38 100644
--- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
+++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
@@ -45,6 +45,12 @@
#include <qsslkey.h>
#include <qsslsocket.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
+#define SRCDIR "./"
+#endif
+
class tst_QSslCertificate : public QObject
{
Q_OBJECT
diff --git a/tests/auto/qsslcipher/qsslcipher.pro b/tests/auto/qsslcipher/qsslcipher.pro
index 8a99274..6eae588 100644
--- a/tests/auto/qsslcipher/qsslcipher.pro
+++ b/tests/auto/qsslcipher/qsslcipher.pro
@@ -2,7 +2,7 @@ load(qttest_p4)
SOURCES += tst_qsslcipher.cpp
!wince*:win32:LIBS += -lws2_32
-QT += network
+QT = core network
TARGET = tst_qsslcipher
diff --git a/tests/auto/qsslerror/qsslerror.pro b/tests/auto/qsslerror/qsslerror.pro
index 1385d2e..ee5872b 100644
--- a/tests/auto/qsslerror/qsslerror.pro
+++ b/tests/auto/qsslerror/qsslerror.pro
@@ -2,7 +2,7 @@ load(qttest_p4)
SOURCES += tst_qsslerror.cpp
!wince*:win32:LIBS += -lws2_32
-QT += network
+QT = core network
TARGET = tst_qsslerror
diff --git a/tests/auto/qsslkey/qsslkey.pro b/tests/auto/qsslkey/qsslkey.pro
index 5cab3d5..32138f8 100644
--- a/tests/auto/qsslkey/qsslkey.pro
+++ b/tests/auto/qsslkey/qsslkey.pro
@@ -2,7 +2,7 @@ load(qttest_p4)
SOURCES += tst_qsslkey.cpp
!wince*:win32:LIBS += -lws2_32
-QT += network
+QT = core network
TARGET = tst_qsslkey
@@ -14,11 +14,14 @@ win32 {
}
}
-wince*: {
+wince*|symbian: {
keyFiles.sources = keys
keyFiles.path = .
DEPLOYMENT += keyFiles
+}
+
+wince*: {
DEFINES += SRCDIR=\\\".\\\"
-} else {
+} else:!symbian {
DEFINES+= SRCDIR=\\\"$$PWD\\\"
}
diff --git a/tests/auto/qsslkey/tst_qsslkey.cpp b/tests/auto/qsslkey/tst_qsslkey.cpp
index ef05614..2adac4c 100644
--- a/tests/auto/qsslkey/tst_qsslkey.cpp
+++ b/tests/auto/qsslkey/tst_qsslkey.cpp
@@ -47,6 +47,12 @@
#include <QtNetwork/qhostaddress.h>
#include <QtNetwork/qnetworkproxy.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
+#define SRCDIR QDir::currentPath().toAscii()
+#endif
+
class tst_QSslKey : public QObject
{
Q_OBJECT
@@ -101,7 +107,7 @@ tst_QSslKey::tst_QSslKey()
#ifdef Q_WS_MAC
// applicationDirPath() points to a path inside the app bundle on Mac.
QDir dir(qApp->applicationDirPath() + QLatin1String("/../../../keys"));
-#elif defined(Q_OS_WIN)
+#elif defined(Q_OS_WIN) || defined (Q_OS_SYMBIAN)
QDir dir(SRCDIR + QLatin1String("/keys")); // prefer this way to avoid ifdeffery and support shadow builds?
#else
QDir dir(qApp->applicationDirPath() + QLatin1String("/keys"));
diff --git a/tests/auto/qsslsocket/certs/aspiriniks.ca.crt b/tests/auto/qsslsocket/certs/aspiriniks.ca.crt
new file mode 100644
index 0000000..36436b6
--- /dev/null
+++ b/tests/auto/qsslsocket/certs/aspiriniks.ca.crt
@@ -0,0 +1,22 @@
+-----BEGIN CERTIFICATE-----
+MIIDnDCCAoQCCQDV3otC4hs2KTANBgkqhkiG9w0BAQUFADCBjzELMAkGA1UEBhMC
+Tk8xDTALBgNVBAgTBE9zbG8xDTALBgNVBAcTBE9zbG8xDzANBgNVBAoTBlRUIEFT
+QTEOMAwGA1UECxMFUVQgU1cxHDAaBgNVBAMTE2FzcGlyaW5pa3MudHJvbGwubm8x
+IzAhBgkqhkiG9w0BCQEWFGFiYWJpY0B0cm9sbHRlY2guY29tMB4XDTA4MTEwMTA4
+NTcyOFoXDTA5MTEwMTA4NTcyOFowgY8xCzAJBgNVBAYTAk5PMQ0wCwYDVQQIEwRP
+c2xvMQ0wCwYDVQQHEwRPc2xvMQ8wDQYDVQQKEwZUVCBBU0ExDjAMBgNVBAsTBVFU
+IFNXMRwwGgYDVQQDExNhc3BpcmluaWtzLnRyb2xsLm5vMSMwIQYJKoZIhvcNAQkB
+FhRhYmFiaWNAdHJvbGx0ZWNoLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
+AQoCggEBAMV2bMD1DN3DMgbxU3DXw2i7EWGDXcWjTDtdHvqgIb+9nHqo3MJSrzJy
+qgEPoOsXqswMla9wDPZAsWv5gVAmVSqpy2lfEgfY7LaSHiGD75seF7zIy+CxREHW
+DofHXpJGGJpBCZEKQt2HfHu3+yAYNPucN78tWNZAcPbUg5tfxMZeepRimAZNIxBI
+93SDrl/f9Ka7hvPSzUQsnp8hfdpHlFPFznKfD6yPrjxgz2mT9efavJ4DhtyIa4m+
+paiX515CidDz4A8CFxKZbYvuqq1ilibF/si2so9VhALC77ZcAJP1IMuT8T+WUCxq
+skJqiSCncl0Hgr+ba8MDGF9UQYowgjMCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
+KcJuNUHvjB8ok3cnTmQEeF0LPPkgj28Tqb5TFB8xpVfRI+wvTYsHsmGdOKCgYJ3a
+7VflIsr63ojG8/rXK8H/cx2o2f2Hr3liJdi1UnoLDDRjBqGGz7JNuMreYokPvIbm
+eP01mVyK4PO2iYRwHUIAw5eeB1vMWKX2z95MupD+HRLtmGyaLALg8aQxj5N84Ewl
+eU2PQfhv8A1wj7aL17kfEUxDerQ1kUzlThJMV1J8Dl0l4C9N8evQkelROJU00i46
+oJikA8BW6EpgbnGyNyyj5Loy4wLPKew9nTS8MCJ5xPMQc0urbY/VzuOeUK7WQof7
+xOFSsRAVyQv+yqgmcZMCtg==
+-----END CERTIFICATE-----
diff --git a/tests/auto/qsslsocket/qsslsocket.pro b/tests/auto/qsslsocket/qsslsocket.pro
index c29fc68..147175e 100644
--- a/tests/auto/qsslsocket/qsslsocket.pro
+++ b/tests/auto/qsslsocket/qsslsocket.pro
@@ -7,12 +7,6 @@ QT -= gui
TARGET = tst_qsslsocket
-!wince* {
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
-} else {
-DEFINES += SRCDIR=\\\"./\\\"
-}
-
win32 {
CONFIG(debug, debug|release) {
DESTDIR = debug
@@ -21,8 +15,20 @@ win32 {
}
}
-wince*: {
- certFiles.sources = certs ssl.tar.gz
- certFiles.path = .
- DEPLOYMENT += certFiles
+wince* {
+ DEFINES += SRCDIR=\\\"./\\\"
+
+ certFiles.sources = certs ssl.tar.gz
+ certFiles.path = .
+ DEPLOYMENT += certFiles
+} else:symbian {
+ DEFINES += QSSLSOCKET_CERTUNTRUSTED_WORKAROUND
+ TARGET.EPOCHEAPSIZE="0x100 0x1000000"
+ TARGET.CAPABILITY="ALL -TCB"
+
+ certFiles.sources = certs ssl.tar.gz
+ certFiles.path = .
+ DEPLOYMENT += certFiles
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp
index 2e31499..ba5ef70 100644
--- a/tests/auto/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp
@@ -76,6 +76,10 @@ Q_DECLARE_METATYPE(QSslError)
#define QSSLSOCKET_CERTUNTRUSTED_WORKAROUND
#endif
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR ""
+#endif
+
#ifndef QT_NO_OPENSSL
class QSslSocketPtr: public QSharedPointer<QSslSocket>
{
@@ -195,7 +199,9 @@ protected slots:
}
void untrustedWorkaroundSlot(const QList<QSslError> &errors)
{
- if (errors.size() == 1 && errors.first().error() == QSslError::CertificateUntrusted)
+ if (errors.size() == 1 &&
+ (errors.first().error() == QSslError::CertificateUntrusted ||
+ errors.first().error() == QSslError::SelfSignedCertificate))
socket->ignoreSslErrors();
}
void ignoreErrorListSlot(const QList<QSslError> &errors);
@@ -219,11 +225,11 @@ tst_QSslSocket::tst_QSslSocket()
qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError");
qRegisterMetaType<QAbstractSocket::SocketState>("QSslSocket::SslMode");
#endif
+ Q_SET_DEFAULT_IAP
}
tst_QSslSocket::~tst_QSslSocket()
{
-
}
enum ProxyTests {
@@ -427,8 +433,10 @@ void tst_QSslSocket::simpleConnect()
enterLoop(10);
// Entered connecting state
+#ifndef Q_OS_SYMBIAN
QCOMPARE(socket.state(), QAbstractSocket::ConnectingState);
QCOMPARE(connectedSpy.count(), 0);
+#endif
QCOMPARE(hostFoundSpy.count(), 1);
QCOMPARE(disconnectedSpy.count(), 0);
enterLoop(10);
@@ -496,8 +504,7 @@ void tst_QSslSocket::simpleConnectWithIgnore()
if (!socket.canReadLine())
enterLoop(10);
- QCOMPARE(socket.readAll(), QByteArray("* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID AUTH=PLAIN SASL-IR] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"));
-
+ QCOMPARE(socket.readAll(), QtNetworkSettings::expectedReplySSL());
socket.disconnectFromHost();
}
@@ -530,8 +537,9 @@ void tst_QSslSocket::sslErrors()
socket->waitForEncrypted(5000);
SslErrorList output;
- foreach (QSslError error, socket->sslErrors())
+ foreach (QSslError error, socket->sslErrors()) {
output << error.error();
+ }
#ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND
if (output.last() == QSslError::CertificateUntrusted)
@@ -583,16 +591,16 @@ void tst_QSslSocket::connectToHostEncrypted()
QSslSocketPtr socket = newSocket();
this->socket = socket;
-
- QVERIFY(socket->addCaCertificates(QLatin1String(SRCDIR "certs/qt-test-server-cacert.pem")));
+ QVERIFY(socket->addCaCertificates(QLatin1String("certs/qt-test-server-cacert.pem")));
#ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND
- connect(&socket, SIGNAL(sslErrors(QList<QSslError>)),
+ connect(socket, SIGNAL(sslErrors(QList<QSslError>)),
this, SLOT(untrustedWorkaroundSlot(QList<QSslError>)));
#endif
socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443);
// This should pass unconditionally when using fluke's CA certificate.
+ // or use untrusted certificate workaround
QVERIFY2(socket->waitForEncrypted(10000), qPrintable(socket->errorString()));
socket->disconnectFromHost();
@@ -617,7 +625,7 @@ void tst_QSslSocket::connectToHostEncryptedWithVerificationPeerName()
socket->addCaCertificates(QLatin1String(SRCDIR "certs/qt-test-server-cacert.pem"));
#ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND
- connect(&socket, SIGNAL(sslErrors(QList<QSslError>)),
+ connect(socket, SIGNAL(sslErrors(QList<QSslError>)),
this, SLOT(untrustedWorkaroundSlot(QList<QSslError>)));
#endif
@@ -683,10 +691,9 @@ void tst_QSslSocket::peerCertificateChain()
QList<QSslCertificate> caCertificates = QSslCertificate::fromPath(QLatin1String(SRCDIR "certs/qt-test-server-cacert.pem"));
QVERIFY(caCertificates.count() == 1);
-
socket->addCaCertificates(caCertificates);
#ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND
- connect(&socket, SIGNAL(sslErrors(QList<QSslError>)),
+ connect(socket, SIGNAL(sslErrors(QList<QSslError>)),
this, SLOT(untrustedWorkaroundSlot(QList<QSslError>)));
#endif
@@ -747,7 +754,7 @@ void tst_QSslSocket::protocol()
// qDebug() << "certs:" << certs.at(0).issuerInfo(QSslCertificate::CommonName);
socket->setCaCertificates(certs);
#ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND
- connect(&socket, SIGNAL(sslErrors(QList<QSslError>)),
+ connect(socket, SIGNAL(sslErrors(QList<QSslError>)),
this, SLOT(untrustedWorkaroundSlot(QList<QSslError>)));
#endif
@@ -940,11 +947,24 @@ void tst_QSslSocket::waitForConnectedEncryptedReadyRead()
connect(socket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(ignoreErrorSlot()));
socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 993);
+#ifdef Q_OS_SYMBIAN
QVERIFY(socket->waitForConnected(10000));
QVERIFY(socket->waitForEncrypted(10000));
+
+ // dont forget to login
+ QCOMPARE((int) socket->write("USER ftptest\r\n"), 14);
+ QCOMPARE((int) socket->write("PASS ftP2Ptf\r\n"), 14);
+
QVERIFY(socket->waitForReadyRead(10000));
QVERIFY(!socket->peerCertificate().isNull());
QVERIFY(!socket->peerCertificateChain().isEmpty());
+#else
+ QVERIFY(socket->waitForConnected(10000));
+ QVERIFY(socket->waitForEncrypted(10000));
+ QVERIFY(socket->waitForReadyRead(10000));
+ QVERIFY(!socket->peerCertificate().isNull());
+ QVERIFY(!socket->peerCertificateChain().isEmpty());
+#endif
}
void tst_QSslSocket::startClientEncryption()
@@ -1035,7 +1055,7 @@ void tst_QSslSocket::systemCaCertificates()
void tst_QSslSocket::wildcard()
{
- QSKIP("TODO: solve wildcard problem", SkipAll);
+ QSKIP("TODO: solve wildcard problem", SkipAll);
if (!QSslSocket::supportsSsl())
return;
@@ -1047,7 +1067,7 @@ void tst_QSslSocket::wildcard()
// responds with the wildcard, and QSslSocket should accept that as a
// valid connection. This was broken in 4.3.0.
QSslSocketPtr socket = newSocket();
- socket->addCaCertificates(QLatin1String(SRCDIR "certs/qt-test-server-cacert.pem"));
+ socket->addCaCertificates(QLatin1String("certs/aspiriniks.ca.crt"));
this->socket = socket;
#ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND
connect(socket, SIGNAL(sslErrors(QList<QSslError>)),
@@ -1290,7 +1310,11 @@ protected:
// delayed acceptance:
QTest::qSleep(100);
- server.waitForNewConnection(2000);
+#ifndef Q_OS_SYMBIAN
+ bool ret = server.waitForNewConnection(2000);
+#else
+ bool ret = server.waitForNewConnection(20000);
+#endif
// delayed start of encryption
QTest::qSleep(100);
@@ -1478,18 +1502,22 @@ void tst_QSslSocket::disconnectFromHostWhenConnecting()
// without proxy, the state will be HostLookupState;
// with proxy, the state will be ConnectingState.
QVERIFY(socket->state() == QAbstractSocket::HostLookupState ||
- socket->state() == QAbstractSocket::ConnectingState);
+ socket->state() == QAbstractSocket::ConnectingState);
socket->disconnectFromHost();
// the state of the socket must be the same before and after calling
// disconnectFromHost()
QCOMPARE(state, socket->state());
QVERIFY(socket->state() == QAbstractSocket::HostLookupState ||
- socket->state() == QAbstractSocket::ConnectingState);
+ socket->state() == QAbstractSocket::ConnectingState);
QVERIFY(socket->waitForDisconnected(5000));
QCOMPARE(socket->state(), QAbstractSocket::UnconnectedState);
// we did not call close, so the socket must be still open
QVERIFY(socket->isOpen());
QCOMPARE(socket->bytesToWrite(), qint64(0));
+
+ // dont forget to login
+ QCOMPARE((int) socket->write("USER ftptest\r\n"), 14);
+
}
void tst_QSslSocket::disconnectFromHostWhenConnected()
@@ -1497,12 +1525,27 @@ void tst_QSslSocket::disconnectFromHostWhenConnected()
QSslSocketPtr socket = newSocket();
socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 993);
socket->ignoreSslErrors();
+#ifndef Q_OS_SYMBIAN
QVERIFY(socket->waitForEncrypted(5000));
+#else
+ QVERIFY(socket->waitForEncrypted(10000));
+#endif
socket->write("XXXX LOGOUT\r\n");
QCOMPARE(socket->state(), QAbstractSocket::ConnectedState);
socket->disconnectFromHost();
QCOMPARE(socket->state(), QAbstractSocket::ClosingState);
+#ifdef Q_OS_SYMBIAN
+ // I don't understand how socket->waitForDisconnected can work on other platforms
+ // since socket->write will end to:
+ // QMetaObject::invokeMethod(this, "_q_flushWriteBuffer", Qt::QueuedConnection);
+ // In order that _q_flushWriteBuffer will be called the eventloop need to run
+ // If we just call waitForDisconnected, which blocks the whole thread how that can happen?
+ connect(socket, SIGNAL(disconnected()), this, SLOT(exitLoop()));
+ enterLoop(5);
+ QVERIFY(!timeout());
+#else
QVERIFY(socket->waitForDisconnected(5000));
+#endif
QCOMPARE(socket->bytesToWrite(), qint64(0));
}
@@ -1529,6 +1572,12 @@ void tst_QSslSocket::resetProxy()
socket.connectToHostEncrypted(QtNetworkSettings::serverName(), 443);
QVERIFY(! socket.waitForConnected(10000));
+ // dont forget to login
+ QCOMPARE((int) socket.write("USER ftptest\r\n"), 14);
+ QCOMPARE((int) socket.write("PASS password\r\n"), 15);
+
+ enterLoop(10);
+
// now the other way round:
// set the nonsense proxy and make sure the connection does not work,
// and then set the right proxy and make sure it works
diff --git a/tests/auto/qstandarditem/tst_qstandarditem.cpp b/tests/auto/qstandarditem/tst_qstandarditem.cpp
index d7fdace..e2a5278 100644
--- a/tests/auto/qstandarditem/tst_qstandarditem.cpp
+++ b/tests/auto/qstandarditem/tst_qstandarditem.cpp
@@ -291,12 +291,14 @@ void tst_QStandardItem::getSetFlags()
item.setTristate(true);
QVERIFY(item.isTristate());
QVERIFY(item.flags() & Qt::ItemIsTristate);
+#ifndef QT_NO_DRAGANDDROP
item.setDragEnabled(true);
QVERIFY(item.isDragEnabled());
QVERIFY(item.flags() & Qt::ItemIsDragEnabled);
item.setDropEnabled(true);
QVERIFY(item.isDropEnabled());
QVERIFY(item.flags() & Qt::ItemIsDropEnabled);
+#endif
QVERIFY(item.isEnabled());
item.setEnabled(false);
@@ -318,6 +320,7 @@ void tst_QStandardItem::getSetFlags()
item.setTristate(false);
QVERIFY(!item.isTristate());
QVERIFY(!(item.flags() & Qt::ItemIsTristate));
+#ifndef QT_NO_DRAGANDDROP
QVERIFY(item.isDragEnabled());
item.setDragEnabled(false);
QVERIFY(!item.isDragEnabled());
@@ -326,6 +329,7 @@ void tst_QStandardItem::getSetFlags()
item.setDropEnabled(false);
QVERIFY(!item.isDropEnabled());
QVERIFY(!(item.flags() & Qt::ItemIsDropEnabled));
+#endif
item.setCheckable(false);
item.setCheckState(Qt::Checked);
diff --git a/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp
index 60655ee..4d1bc61 100644
--- a/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp
+++ b/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp
@@ -1388,7 +1388,9 @@ void tst_QStandardItemModel::rootItemFlags()
QCOMPARE(model.invisibleRootItem()->flags() , f);
QCOMPARE(model.invisibleRootItem()->flags() , model.flags(QModelIndex()));
+#ifndef QT_NO_DRAGANDDROP
model.invisibleRootItem()->setDropEnabled(false);
+#endif
QCOMPARE(model.invisibleRootItem()->flags() , Qt::ItemIsEnabled);
QCOMPARE(model.invisibleRootItem()->flags() , model.flags(QModelIndex()));
}
@@ -1527,7 +1529,9 @@ void tst_QStandardItemModel::treeDragAndDrop()
view.setModel(&model);
view.expandAll();
view.show();
+#ifndef QT_NO_DRAGANDDROP
view.setDragDropMode(QAbstractItemView::InternalMove);
+#endif
view.setSelectionMode(QAbstractItemView::ExtendedSelection);
QItemSelectionModel *selection = view.selectionModel();
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index 9fd6b5d..5e2064b 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -129,7 +129,7 @@ private slots:
void transitionToRootState();
void transitionFromRootState();
void transitionEntersParent();
-
+
void defaultErrorState();
void customGlobalErrorState();
void customLocalErrorStateInBrokenState();
@@ -148,16 +148,16 @@ private slots:
void customErrorStateNotInGraph();
void transitionToStateNotInGraph();
void restoreProperties();
-
+
void defaultGlobalRestorePolicy();
void globalRestorePolicySetToRestore();
void globalRestorePolicySetToDoNotRestore();
void noInitialStateForInitialState();
-
+
//void restorePolicyNotInherited();
//void mixedRestoreProperties();
- //void setRestorePolicyToDoNotRestore();
+ //void setRestorePolicyToDoNotRestore();
//void setGlobalRestorePolicyToGlobalRestore();
//void restorePolicyOnChildState();
@@ -186,7 +186,7 @@ private slots:
// void removeDefaultAnimationForSource();
// void removeDefaultAnimationForTarget();
// void overrideDefaultAnimationWithSource();
-// void overrideDefaultAnimationWithTarget();
+// void overrideDefaultAnimationWithTarget();
// void overrideDefaultSourceAnimationWithSpecific();
// void overrideDefaultTargetAnimationWithSpecific();
// void overrideDefaultTargetAnimationWithSource();
@@ -274,7 +274,7 @@ void tst_QStateMachine::transitionToRootState()
QAbstractTransition *trans = initialState->addTransition(new EventTransition(QEvent::User, &machine));
QVERIFY(trans != 0);
QCOMPARE(trans->sourceState(), initialState);
- QCOMPARE(trans->targetState(), &machine);
+ QCOMPARE(trans->targetState(), static_cast<QAbstractState *>(&machine));
machine.start();
QCoreApplication::processEvents();
@@ -295,9 +295,9 @@ void tst_QStateMachine::transitionFromRootState()
QState *root = &machine;
QState *s1 = new QState(root);
EventTransition *trans = new EventTransition(QEvent::User, s1);
- QCOMPARE(root->addTransition(trans), trans);
+ QCOMPARE(root->addTransition(trans), static_cast<QAbstractTransition *>(trans));
QCOMPARE(trans->sourceState(), root);
- QCOMPARE(trans->targetState(), s1);
+ QCOMPARE(trans->targetState(), static_cast<QAbstractState *>(s1));
}
void tst_QStateMachine::transitionEntersParent()
@@ -393,14 +393,14 @@ void tst_QStateMachine::defaultErrorState()
class CustomErrorState: public QState
{
public:
- CustomErrorState(QStateMachine *machine, QState *parent = 0)
+ CustomErrorState(QStateMachine *machine, QState *parent = 0)
: QState(parent), error(QStateMachine::NoError), m_machine(machine)
{
}
void onEntry(QEvent *)
{
- error = m_machine->error();
+ error = m_machine->error();
errorString = m_machine->errorString();
}
@@ -444,7 +444,7 @@ void tst_QStateMachine::customGlobalErrorState()
QVERIFY(machine.configuration().contains(initialState));
QCoreApplication::processEvents();
-
+
QCOMPARE(machine.isRunning(), true);
QCOMPARE(machine.configuration().count(), 1);
QVERIFY(machine.configuration().contains(customErrorState));
@@ -455,7 +455,7 @@ void tst_QStateMachine::customGlobalErrorState()
}
void tst_QStateMachine::customLocalErrorStateInBrokenState()
-{
+{
QStateMachine machine;
CustomErrorState *customErrorState = new CustomErrorState(&machine);
machine.addState(customErrorState);
@@ -467,15 +467,15 @@ void tst_QStateMachine::customLocalErrorStateInBrokenState()
QState *brokenState = new QState();
brokenState->setObjectName("brokenState");
- machine.addState(brokenState);
- brokenState->setErrorState(customErrorState);
+ machine.addState(brokenState);
+ brokenState->setErrorState(customErrorState);
QState *childState = new QState(brokenState);
childState->setObjectName("childState");
initialState->addTransition(new EventTransition(QEvent::Type(QEvent::User + 1), brokenState));
- machine.start();
+ machine.start();
QCoreApplication::processEvents();
machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 1)));
@@ -495,15 +495,15 @@ void tst_QStateMachine::customLocalErrorStateInOtherState()
QState *initialState = new QState();
initialState->setObjectName("initialState");
- QTest::ignoreMessage(QtWarningMsg, "QState::setErrorState: error state cannot belong to a different state machine");
+ QTest::ignoreMessage(QtWarningMsg, "QState::setErrorState: error state cannot belong to a different state machine");
initialState->setErrorState(customErrorState);
machine.addState(initialState);
machine.setInitialState(initialState);
QState *brokenState = new QState();
brokenState->setObjectName("brokenState");
-
- machine.addState(brokenState);
+
+ machine.addState(brokenState);
QState *childState = new QState(brokenState);
childState->setObjectName("childState");
@@ -534,7 +534,7 @@ void tst_QStateMachine::customLocalErrorStateInParentOfBrokenState()
QState *parentOfBrokenState = new QState();
machine.addState(parentOfBrokenState);
parentOfBrokenState->setObjectName("parentOfBrokenState");
- parentOfBrokenState->setErrorState(customErrorState);
+ parentOfBrokenState->setErrorState(customErrorState);
QState *brokenState = new QState(parentOfBrokenState);
brokenState->setObjectName("brokenState");
@@ -574,7 +574,7 @@ void tst_QStateMachine::customLocalErrorStateOverridesParent()
machine.addState(parentOfBrokenState);
parentOfBrokenState->setObjectName("parentOfBrokenState");
parentOfBrokenState->setErrorState(customErrorStateForParent);
-
+
QState *brokenState = new QState(parentOfBrokenState);
brokenState->setObjectName("brokenState");
brokenState->setErrorState(customErrorStateForBrokenState);
@@ -613,10 +613,10 @@ void tst_QStateMachine::errorStateHasChildren()
QState *initialState = new QState();
initialState->setObjectName("initialState");
machine.addState(initialState);
- machine.setInitialState(initialState);
+ machine.setInitialState(initialState);
QState *brokenState = new QState();
- brokenState->setObjectName("brokenState");
+ brokenState->setObjectName("brokenState");
machine.addState(brokenState);
QState *childState = new QState(brokenState);
@@ -633,7 +633,7 @@ void tst_QStateMachine::errorStateHasChildren()
QCOMPARE(machine.isRunning(), true);
QCOMPARE(machine.configuration().count(), 2);
QVERIFY(machine.configuration().contains(customErrorState));
- QVERIFY(machine.configuration().contains(childOfErrorState));
+ QVERIFY(machine.configuration().contains(childOfErrorState));
}
@@ -652,10 +652,10 @@ void tst_QStateMachine::errorStateHasErrors()
QState *initialState = new QState();
initialState->setObjectName("initialState");
machine.addState(initialState);
- machine.setInitialState(initialState);
+ machine.setInitialState(initialState);
QState *brokenState = new QState();
- brokenState->setObjectName("brokenState");
+ brokenState->setObjectName("brokenState");
machine.addState(brokenState);
QState *childState = new QState(brokenState);
@@ -684,10 +684,10 @@ void tst_QStateMachine::errorStateIsRootState()
QState *initialState = new QState();
initialState->setObjectName("initialState");
machine.addState(initialState);
- machine.setInitialState(initialState);
-
+ machine.setInitialState(initialState);
+
QState *brokenState = new QState();
- brokenState->setObjectName("brokenState");
+ brokenState->setObjectName("brokenState");
machine.addState(brokenState);
QState *childState = new QState(brokenState);
@@ -724,7 +724,7 @@ void tst_QStateMachine::errorStateEntersParentFirst()
QState *grandParent = new QState(greatGrandParent);
grandParent->setObjectName("grandParent");
- grandParent->assignProperty(entryController, "grandParentEntered", true);
+ grandParent->assignProperty(entryController, "grandParentEntered", true);
QState *parent = new QState(grandParent);
parent->setObjectName("parent");
@@ -739,7 +739,7 @@ void tst_QStateMachine::errorStateEntersParentFirst()
initialStateOfGreatGrandParent->setObjectName("initialStateOfGreatGrandParent");
greatGrandParent->setInitialState(initialStateOfGreatGrandParent);
- QState *brokenState = new QState(greatGrandParent);
+ QState *brokenState = new QState(greatGrandParent);
brokenState->setObjectName("brokenState");
QState *childState = new QState(brokenState);
@@ -805,9 +805,9 @@ void tst_QStateMachine::customErrorStateIsNull()
void tst_QStateMachine::clearError()
{
- QStateMachine machine;
+ QStateMachine machine;
machine.setErrorState(new QState(&machine)); // avoid warnings
-
+
QState *brokenState = new QState(&machine);
brokenState->setObjectName("brokenState");
machine.setInitialState(brokenState);
@@ -840,10 +840,10 @@ void tst_QStateMachine::historyStateAsInitialState()
QHistoryState *s2h = new QHistoryState(s2);
s2->setInitialState(s2h);
-
+
QState *s21 = new QState(s2);
s2h->setDefaultState(s21);
-
+
s1->addTransition(new EventTransition(QEvent::User, s2));
machine.start();
@@ -898,17 +898,17 @@ void tst_QStateMachine::brokenStateIsNeverEntered()
entryController->setProperty("childStateEntered", false);
entryController->setProperty("errorStateEntered", false);
- QState *initialState = new QState(&machine);
+ QState *initialState = new QState(&machine);
machine.setInitialState(initialState);
QState *errorState = new QState(&machine);
errorState->assignProperty(entryController, "errorStateEntered", true);
- machine.setErrorState(errorState);
+ machine.setErrorState(errorState);
QState *brokenState = new QState(&machine);
brokenState->assignProperty(entryController, "brokenStateEntered", true);
brokenState->setObjectName("brokenState");
-
+
QState *childState = new QState(brokenState);
childState->assignProperty(entryController, "childStateEntered", true);
@@ -927,7 +927,7 @@ void tst_QStateMachine::brokenStateIsNeverEntered()
void tst_QStateMachine::transitionToStateNotInGraph()
{
- QStateMachine machine;
+ QStateMachine machine;
QState *initialState = new QState(&machine);
initialState->setObjectName("initialState");
@@ -1024,11 +1024,11 @@ void tst_QStateMachine::rootState()
QCOMPARE(machine.machine(), (QStateMachine*)0);
QState *s1 = new QState(&machine);
- QCOMPARE(s1->parentState(), &machine);
+ QCOMPARE(s1->parentState(), static_cast<QState*>(&machine));
QState *s2 = new QState();
s2->setParent(&machine);
- QCOMPARE(s2->parentState(), &machine);
+ QCOMPARE(s2->parentState(), static_cast<QState*>(&machine));
}
void tst_QStateMachine::addAndRemoveState()
@@ -1036,7 +1036,7 @@ void tst_QStateMachine::addAndRemoveState()
#ifdef QT_BUILD_INTERNAL
QStateMachine machine;
QStatePrivate *root_d = QStatePrivate::get(&machine);
- QCOMPARE(root_d->childStates().size(), 0);
+ QCOMPARE(root_d->childStates().size(), 0);
QTest::ignoreMessage(QtWarningMsg, "QStateMachine::addState: cannot add null state");
machine.addState(0);
@@ -1045,8 +1045,8 @@ void tst_QStateMachine::addAndRemoveState()
QCOMPARE(s1->parentState(), (QState*)0);
QCOMPARE(s1->machine(), (QStateMachine*)0);
machine.addState(s1);
- QCOMPARE(s1->machine(), &machine);
- QCOMPARE(s1->parentState(), &machine);
+ QCOMPARE(s1->machine(), static_cast<QStateMachine*>(&machine));
+ QCOMPARE(s1->parentState(), static_cast<QState*>(&machine));
QCOMPARE(root_d->childStates().size(), 1);
QCOMPARE(root_d->childStates().at(0), (QAbstractState*)s1);
@@ -1056,7 +1056,7 @@ void tst_QStateMachine::addAndRemoveState()
QState *s2 = new QState();
QCOMPARE(s2->parentState(), (QState*)0);
machine.addState(s2);
- QCOMPARE(s2->parentState(), &machine);
+ QCOMPARE(s2->parentState(), static_cast<QState*>(&machine));
QCOMPARE(root_d->childStates().size(), 2);
QCOMPARE(root_d->childStates().at(0), (QAbstractState*)s1);
QCOMPARE(root_d->childStates().at(1), (QAbstractState*)s2);
@@ -1520,7 +1520,7 @@ public:
{ setTargetState(target); }
protected:
- virtual bool eventTest(QEvent *e)
+ virtual bool eventTest(QEvent *e)
{
if (e->type() != QEvent::Type(QEvent::User+2))
return false;
@@ -2401,7 +2401,7 @@ void tst_QStateMachine::targetStateWithNoParent()
machine.start();
QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: No common ancestor for targets and source of transition from state 's1'");
QTRY_COMPARE(startedSpy.count(), 1);
- QCOMPARE(machine.isRunning(), false);
+ QCOMPARE(machine.isRunning(), false);
QCOMPARE(stoppedSpy.count(), 1);
QCOMPARE(finishedSpy.count(), 0);
QCOMPARE(machine.error(), QStateMachine::NoCommonAncestorForTransitionError);
@@ -2421,7 +2421,7 @@ void tst_QStateMachine::targetStateDeleted()
void tst_QStateMachine::defaultGlobalRestorePolicy()
{
- QStateMachine machine;
+ QStateMachine machine;
QObject *propertyHolder = new QObject(&machine);
propertyHolder->setProperty("a", 1);
@@ -2441,7 +2441,7 @@ void tst_QStateMachine::defaultGlobalRestorePolicy()
machine.setInitialState(s1);
machine.start();
QCoreApplication::processEvents();
-
+
QCOMPARE(propertyHolder->property("a").toInt(), 3);
QCOMPARE(propertyHolder->property("b").toInt(), 2);
@@ -2455,7 +2455,7 @@ void tst_QStateMachine::defaultGlobalRestorePolicy()
QCoreApplication::processEvents();
QCOMPARE(propertyHolder->property("a").toInt(), 3);
- QCOMPARE(propertyHolder->property("b").toInt(), 4);
+ QCOMPARE(propertyHolder->property("b").toInt(), 4);
}
void tst_QStateMachine::noInitialStateForInitialState()
@@ -2481,7 +2481,7 @@ void tst_QStateMachine::noInitialStateForInitialState()
/*
void tst_QStateMachine::restorePolicyNotInherited()
{
- QStateMachine machine;
+ QStateMachine machine;
QObject *propertyHolder = new QObject();
propertyHolder->setProperty("a", 1);
@@ -2509,7 +2509,7 @@ void tst_QStateMachine::restorePolicyNotInherited()
machine.setInitialState(parentState);
machine.start();
QCoreApplication::processEvents();
-
+
QCOMPARE(propertyHolder->property("a").toInt(), 3);
QCOMPARE(propertyHolder->property("b").toInt(), 2);
@@ -2523,7 +2523,7 @@ void tst_QStateMachine::restorePolicyNotInherited()
QCoreApplication::processEvents();
QCOMPARE(propertyHolder->property("a").toInt(), 3);
- QCOMPARE(propertyHolder->property("b").toInt(), 4);
+ QCOMPARE(propertyHolder->property("b").toInt(), 4);
}*/
@@ -2550,7 +2550,7 @@ void tst_QStateMachine::globalRestorePolicySetToDoNotRestore()
machine.setInitialState(s1);
machine.start();
QCoreApplication::processEvents();
-
+
QCOMPARE(propertyHolder->property("a").toInt(), 3);
QCOMPARE(propertyHolder->property("b").toInt(), 2);
@@ -2564,7 +2564,7 @@ void tst_QStateMachine::globalRestorePolicySetToDoNotRestore()
QCoreApplication::processEvents();
QCOMPARE(propertyHolder->property("a").toInt(), 3);
- QCOMPARE(propertyHolder->property("b").toInt(), 4);
+ QCOMPARE(propertyHolder->property("b").toInt(), 4);
}
/*
@@ -2670,7 +2670,7 @@ void tst_QStateMachine::restorePolicyOnChildState()
machine.setInitialState(parentState);
machine.start();
QCoreApplication::processEvents();
-
+
QCOMPARE(propertyHolder->property("a").toInt(), 3);
QCOMPARE(propertyHolder->property("b").toInt(), 2);
@@ -2684,13 +2684,13 @@ void tst_QStateMachine::restorePolicyOnChildState()
QCoreApplication::processEvents();
QCOMPARE(propertyHolder->property("a").toInt(), 1);
- QCOMPARE(propertyHolder->property("b").toInt(), 2);
+ QCOMPARE(propertyHolder->property("b").toInt(), 2);
}
*/
void tst_QStateMachine::globalRestorePolicySetToRestore()
{
- QStateMachine machine;
+ QStateMachine machine;
machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties);
QObject *propertyHolder = new QObject(&machine);
@@ -2711,7 +2711,7 @@ void tst_QStateMachine::globalRestorePolicySetToRestore()
machine.setInitialState(s1);
machine.start();
QCoreApplication::processEvents();
-
+
QCOMPARE(propertyHolder->property("a").toInt(), 3);
QCOMPARE(propertyHolder->property("b").toInt(), 2);
@@ -2725,16 +2725,16 @@ void tst_QStateMachine::globalRestorePolicySetToRestore()
QCoreApplication::processEvents();
QCOMPARE(propertyHolder->property("a").toInt(), 1);
- QCOMPARE(propertyHolder->property("b").toInt(), 2);
+ QCOMPARE(propertyHolder->property("b").toInt(), 2);
}
/*
void tst_QStateMachine::mixedRestoreProperties()
{
- QStateMachine machine;
+ QStateMachine machine;
QObject *propertyHolder = new QObject();
- propertyHolder->setProperty("a", 1);
+ propertyHolder->setProperty("a", 1);
QState *s1 = new QState(&machine);
s1->setRestorePolicy(QState::RestoreProperties);
@@ -2761,7 +2761,7 @@ void tst_QStateMachine::mixedRestoreProperties()
machine.setInitialState(s1);
machine.start();
QCoreApplication::processEvents();
-
+
// Enter s1, save current
QCOMPARE(propertyHolder->property("a").toInt(), 3);
@@ -2837,7 +2837,7 @@ void tst_QStateMachine::simpleAnimation()
QCOREAPPLICATION_EXEC(5000);
QVERIFY(machine.configuration().contains(s3));
- QCOMPARE(object->property("fooBar").toDouble(), 2.0);
+ QCOMPARE(object->property("fooBar").toDouble(), 2.0);
}
class SlotCalledCounter: public QObject
@@ -2870,7 +2870,7 @@ void tst_QStateMachine::twoAnimations()
animationBar->setDuration(900);
SlotCalledCounter counter;
- connect(animationFoo, SIGNAL(finished()), &counter, SLOT(slot()));
+ connect(animationFoo, SIGNAL(finished()), &counter, SLOT(slot()));
connect(animationBar, SIGNAL(finished()), &counter, SLOT(slot()));
EventTransition *et = new EventTransition(QEvent::User, s2);
@@ -2892,7 +2892,7 @@ void tst_QStateMachine::twoAnimations()
QVERIFY(machine.configuration().contains(s3));
QCOMPARE(object->property("foo").toDouble(), 2.0);
QCOMPARE(object->property("bar").toDouble(), 10.0);
-
+
QCOMPARE(counter.counter, 2);
}
@@ -3005,12 +3005,12 @@ void tst_QStateMachine::nestedTargetStateForAnimation()
QState *s2Child2 = new QState(s2);
s2Child2->assignProperty(object, "bar", 11.0);
QAbstractTransition *at = s2Child->addTransition(new EventTransition(QEvent::User, s2Child2));
-
+
QPropertyAnimation *animation = new QPropertyAnimation(object, "bar", s2);
animation->setDuration(2000);
connect(animation, SIGNAL(finished()), &counter, SLOT(slot()));
at->addAnimation(animation);
-
+
at = s1->addTransition(new EventTransition(QEvent::User, s2));
animation = new QPropertyAnimation(object, "foo", s2);
@@ -3020,7 +3020,7 @@ void tst_QStateMachine::nestedTargetStateForAnimation()
animation = new QPropertyAnimation(object, "bar", s2);
connect(animation, SIGNAL(finished()), &counter, SLOT(slot()));
at->addAnimation(animation);
-
+
QState *s3 = new QState(&machine);
s2->addTransition(s2Child, SIGNAL(polished()), s3);
@@ -3062,7 +3062,7 @@ void tst_QStateMachine::animatedGlobalRestoreProperty()
QPropertyAnimation *pa = new QPropertyAnimation(object, "foo", s2);
connect(pa, SIGNAL(finished()), &counter, SLOT(slot()));
at->addAnimation(pa);
-
+
at = s2->addTransition(pa, SIGNAL(finished()), s3);
pa = new QPropertyAnimation(object, "foo", s3);
connect(pa, SIGNAL(finished()), &counter, SLOT(slot()));
@@ -3104,7 +3104,7 @@ void tst_QStateMachine::specificTargetValueOfAnimation()
QState *s3 = new QState(&machine);
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
- s2->addTransition(anim, SIGNAL(finished()), s3);
+ s2->addTransition(anim, SIGNAL(finished()), s3);
machine.setInitialState(s1);
machine.start();
@@ -3134,7 +3134,7 @@ void tst_QStateMachine::addDefaultAnimation()
QState *s3 = new QState(&machine);
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
-
+
s1->addTransition(new EventTransition(QEvent::User, s2));
QPropertyAnimation *pa = new QPropertyAnimation(object, "foo", &machine);
@@ -3171,7 +3171,7 @@ void tst_QStateMachine::addDefaultAnimationWithUnusedAnimation()
QState *s3 = new QState(&machine);
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
-
+
s1->addTransition(new EventTransition(QEvent::User, s2));
QPropertyAnimation *pa = new QPropertyAnimation(object, "foo", &machine);
@@ -3216,7 +3216,7 @@ void tst_QStateMachine::removeDefaultAnimation()
QCOMPARE(machine.defaultAnimations().size(), 0);
machine.addDefaultAnimation(anim);
-
+
QPropertyAnimation *anim2 = new QPropertyAnimation(&propertyHolder, "foo");
machine.addDefaultAnimation(anim2);
@@ -3255,8 +3255,8 @@ void tst_QStateMachine::overrideDefaultAnimationWithSpecific()
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
QAbstractTransition *at = s1->addTransition(new EventTransition(QEvent::User, s2));
-
- QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo");
+
+ QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo");
connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot()));
QPropertyAnimation *moreSpecificAnimation = new QPropertyAnimation(object, "foo");
@@ -3294,7 +3294,7 @@ void tst_QStateMachine::addDefaultAnimationForSource()
QState *s3 = new QState(&machine);
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
-
+
s1->addTransition(new EventTransition(QEvent::User, s2));
QPropertyAnimation *pa = new QPropertyAnimation(object, "foo", &machine);
@@ -3326,7 +3326,7 @@ void tst_QStateMachine::addDefaultAnimationForTarget()
QState *s3 = new QState(&machine);
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
-
+
s1->addTransition(new EventTransition(QEvent::User, s2));
QPropertyAnimation *pa = new QPropertyAnimation(object, "foo", &machine);
@@ -3371,7 +3371,7 @@ void tst_QStateMachine::removeDefaultAnimationForSource()
QCOMPARE(machine.defaultAnimationsForSourceState(&machine).size(), 0);
machine.addDefaultAnimationForSourceState(&machine, anim);
-
+
QPropertyAnimation *anim2 = new QPropertyAnimation(this, "foo");
machine.addDefaultAnimationForSourceState(&machine, anim2);
@@ -3415,7 +3415,7 @@ void tst_QStateMachine::removeDefaultAnimationForTarget()
QCOMPARE(machine.defaultAnimationsForTargetState(&machine).size(), 0);
machine.addDefaultAnimationForTargetState(&machine, anim);
-
+
QPropertyAnimation *anim2 = new QPropertyAnimation(this, "foo");
machine.addDefaultAnimationForTargetState(&machine, anim2);
@@ -3450,9 +3450,9 @@ void tst_QStateMachine::overrideDefaultAnimationWithSource()
QState *s3 = new QState(&machine);
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
- s1->addTransition(new EventTransition(QEvent::User, s2));
-
- QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo");
+ s1->addTransition(new EventTransition(QEvent::User, s2));
+
+ QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo");
connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot()));
QPropertyAnimation *moreSpecificAnimation = new QPropertyAnimation(object, "foo");
@@ -3490,9 +3490,9 @@ void tst_QStateMachine::overrideDefaultAnimationWithTarget()
QState *s3 = new QState(&machine);
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
- s1->addTransition(new EventTransition(QEvent::User, s2));
-
- QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo");
+ s1->addTransition(new EventTransition(QEvent::User, s2));
+
+ QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo");
connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot()));
QPropertyAnimation *moreSpecificAnimation = new QPropertyAnimation(object, "foo");
@@ -3532,8 +3532,8 @@ void tst_QStateMachine::overrideDefaultSourceAnimationWithSpecific()
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
QAbstractTransition *at = s1->addTransition(new EventTransition(QEvent::User, s2));
-
- QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo");
+
+ QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo");
connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot()));
QPropertyAnimation *moreSpecificAnimation = new QPropertyAnimation(object, "foo");
@@ -3572,8 +3572,8 @@ void tst_QStateMachine::overrideDefaultTargetAnimationWithSpecific()
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
QAbstractTransition *at = s1->addTransition(new EventTransition(QEvent::User, s2));
-
- QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo");
+
+ QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo");
connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot()));
QPropertyAnimation *moreSpecificAnimation = new QPropertyAnimation(object, "foo");
@@ -3612,8 +3612,8 @@ void tst_QStateMachine::overrideDefaultTargetAnimationWithSource()
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
s1->addTransition(new EventTransition(QEvent::User, s2));
-
- QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo");
+
+ QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo");
connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot()));
QPropertyAnimation *moreSpecificAnimation = new QPropertyAnimation(object, "foo");
@@ -3663,7 +3663,7 @@ void tst_QStateMachine::parallelStateAssignmentsDone()
QCOMPARE(propertyHolder->property("foo").toInt(), 123);
QCOMPARE(propertyHolder->property("bar").toInt(), 456);
QCOMPARE(propertyHolder->property("zoot").toInt(), 789);
-
+
machine.postEvent(new QEvent(QEvent::User));
QCoreApplication::processEvents();
@@ -3675,13 +3675,13 @@ void tst_QStateMachine::parallelStateAssignmentsDone()
void tst_QStateMachine::transitionsFromParallelStateWithNoChildren()
{
QStateMachine machine;
-
+
QState *parallelState = new QState(QState::ParallelStates, &machine);
machine.setInitialState(parallelState);
- QState *s1 = new QState(&machine);
+ QState *s1 = new QState(&machine);
parallelState->addTransition(new EventTransition(QEvent::User, s1));
-
+
machine.start();
QCoreApplication::processEvents();
@@ -3712,7 +3712,7 @@ void tst_QStateMachine::parallelStateTransition()
QState *s2InitialChild = new QState(s2);
s2->setInitialState(s2InitialChild);
- QState *s1OtherChild = new QState(s1);
+ QState *s1OtherChild = new QState(s1);
s1->addTransition(new EventTransition(QEvent::User, s1OtherChild));
@@ -3732,12 +3732,12 @@ void tst_QStateMachine::parallelStateTransition()
QVERIFY(machine.configuration().contains(parallelState));
QVERIFY(machine.configuration().contains(s1));
-
+
QVERIFY(machine.configuration().contains(s2));
QVERIFY(machine.configuration().contains(s1OtherChild));
QVERIFY(machine.configuration().contains(s2InitialChild));
QCOMPARE(machine.configuration().size(), 5);
-
+
}
void tst_QStateMachine::nestedRestoreProperties()
@@ -3808,7 +3808,7 @@ void tst_QStateMachine::nestedRestoreProperties2()
s2->assignProperty(propertyHolder, "foo", 3);
QState *s21 = new QState(s2);
- s21->assignProperty(propertyHolder, "bar", 4);
+ s21->assignProperty(propertyHolder, "bar", 4);
s2->setInitialState(s21);
QState *s22 = new QState(s2);
diff --git a/tests/auto/qstl/qstl.pro b/tests/auto/qstl/qstl.pro
index 07cc314..5c99874 100644
--- a/tests/auto/qstl/qstl.pro
+++ b/tests/auto/qstl/qstl.pro
@@ -1,7 +1,3 @@
load(qttest_p4)
SOURCES += tst_qstl.cpp
-
-
QT = core
-
-
diff --git a/tests/auto/qstring/qstring.pro b/tests/auto/qstring/qstring.pro
index eb52d90..ed758c6 100644
--- a/tests/auto/qstring/qstring.pro
+++ b/tests/auto/qstring/qstring.pro
@@ -1,9 +1,8 @@
load(qttest_p4)
SOURCES += tst_qstring.cpp
+symbian:LIBS += -llibm
+
QT = core
DEFINES += QT_NO_CAST_TO_ASCII
-
-
-
diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp
index 72c0d74..6819336 100644
--- a/tests/auto/qstring/tst_qstring.cpp
+++ b/tests/auto/qstring/tst_qstring.cpp
@@ -446,48 +446,48 @@ void tst_QString::replace_string_data()
QTest::addColumn<QString>("result" );
QTest::addColumn<bool>("bcs" );
- QTest::newRow( "rem00" ) << QString("") << QString("") << QString("") << QString("") << TRUE;
- QTest::newRow( "rem01" ) << QString("A") << QString("") << QString("") << QString("A") << TRUE;
- QTest::newRow( "rem02" ) << QString("A") << QString("A") << QString("") << QString("") << TRUE;
- QTest::newRow( "rem03" ) << QString("A") << QString("B") << QString("") << QString("A") << TRUE;
- QTest::newRow( "rem04" ) << QString("AA") << QString("A") << QString("") << QString("") << TRUE;
- QTest::newRow( "rem05" ) << QString("AB") << QString("A") << QString("") << QString("B") << TRUE;
- QTest::newRow( "rem06" ) << QString("AB") << QString("B") << QString("") << QString("A") << TRUE;
- QTest::newRow( "rem07" ) << QString("AB") << QString("C") << QString("") << QString("AB") << TRUE;
- QTest::newRow( "rem08" ) << QString("ABA") << QString("A") << QString("") << QString("B") << TRUE;
- QTest::newRow( "rem09" ) << QString("ABA") << QString("B") << QString("") << QString("AA") << TRUE;
- QTest::newRow( "rem10" ) << QString("ABA") << QString("C") << QString("") << QString("ABA") << TRUE;
- QTest::newRow( "rem11" ) << QString("banana") << QString("an") << QString("") << QString("ba") << TRUE;
- QTest::newRow( "rem12" ) << QString("") << QString("A") << QString("") << QString("") << TRUE;
- QTest::newRow( "rem13" ) << QString("") << QString("A") << QString() << QString("") << TRUE;
- QTest::newRow( "rem14" ) << QString() << QString("A") << QString("") << QString() << TRUE;
- QTest::newRow( "rem15" ) << QString() << QString("A") << QString() << QString() << TRUE;
- QTest::newRow( "rem16" ) << QString() << QString("") << QString("") << QString("") << TRUE;
- QTest::newRow( "rem17" ) << QString("") << QString() << QString("") << QString("") << TRUE;
- QTest::newRow( "rem18" ) << QString("a") << QString("a") << QString("") << QString("") << FALSE;
- QTest::newRow( "rem19" ) << QString("A") << QString("A") << QString("") << QString("") << FALSE;
- QTest::newRow( "rem20" ) << QString("a") << QString("A") << QString("") << QString("") << FALSE;
- QTest::newRow( "rem21" ) << QString("A") << QString("a") << QString("") << QString("") << FALSE;
- QTest::newRow( "rem22" ) << QString("Alpha beta") << QString("a") << QString("") << QString("lph bet") << FALSE;
-
- QTest::newRow( "rep00" ) << QString("ABC") << QString("B") << QString("-") << QString("A-C") << TRUE;
- QTest::newRow( "rep01" ) << QString("$()*+.?[\\]^{|}") << QString("$()*+.?[\\]^{|}") << QString("X") << QString("X") << TRUE;
- QTest::newRow( "rep02" ) << QString("ABCDEF") << QString("") << QString("X") << QString("XAXBXCXDXEXFX") << TRUE;
- QTest::newRow( "rep03" ) << QString("") << QString("") << QString("X") << QString("X") << TRUE;
- QTest::newRow( "rep04" ) << QString("a") << QString("a") << QString("b") << QString("b") << FALSE;
- QTest::newRow( "rep05" ) << QString("A") << QString("A") << QString("b") << QString("b") << FALSE;
- QTest::newRow( "rep06" ) << QString("a") << QString("A") << QString("b") << QString("b") << FALSE;
- QTest::newRow( "rep07" ) << QString("A") << QString("a") << QString("b") << QString("b") << FALSE;
- QTest::newRow( "rep08" ) << QString("a") << QString("a") << QString("a") << QString("a") << FALSE;
- QTest::newRow( "rep09" ) << QString("A") << QString("A") << QString("a") << QString("a") << FALSE;
- QTest::newRow( "rep10" ) << QString("a") << QString("A") << QString("a") << QString("a") << FALSE;
- QTest::newRow( "rep11" ) << QString("A") << QString("a") << QString("a") << QString("a") << FALSE;
- QTest::newRow( "rep12" ) << QString("Alpha beta") << QString("a") << QString("o") << QString("olpho beto") << FALSE;
- QTest::newRow( "rep13" ) << QString() << QString("") << QString("A") << QString("A") << TRUE;
- QTest::newRow( "rep14" ) << QString("") << QString() << QString("A") << QString("A") << TRUE;
- QTest::newRow( "rep15" ) << QString("fooxbarxbazxblub") << QString("x") << QString("yz") << QString("fooyzbaryzbazyzblub") << TRUE;
- QTest::newRow( "rep16" ) << QString("fooxbarxbazxblub") << QString("x") << QString("z") << QString("foozbarzbazzblub") << TRUE;
- QTest::newRow( "rep17" ) << QString("fooxybarxybazxyblub") << QString("xy") << QString("z") << QString("foozbarzbazzblub") << TRUE;
+ QTest::newRow( "rem00" ) << QString("") << QString("") << QString("") << QString("") << true;
+ QTest::newRow( "rem01" ) << QString("A") << QString("") << QString("") << QString("A") << true;
+ QTest::newRow( "rem02" ) << QString("A") << QString("A") << QString("") << QString("") << true;
+ QTest::newRow( "rem03" ) << QString("A") << QString("B") << QString("") << QString("A") << true;
+ QTest::newRow( "rem04" ) << QString("AA") << QString("A") << QString("") << QString("") << true;
+ QTest::newRow( "rem05" ) << QString("AB") << QString("A") << QString("") << QString("B") << true;
+ QTest::newRow( "rem06" ) << QString("AB") << QString("B") << QString("") << QString("A") << true;
+ QTest::newRow( "rem07" ) << QString("AB") << QString("C") << QString("") << QString("AB") << true;
+ QTest::newRow( "rem08" ) << QString("ABA") << QString("A") << QString("") << QString("B") << true;
+ QTest::newRow( "rem09" ) << QString("ABA") << QString("B") << QString("") << QString("AA") << true;
+ QTest::newRow( "rem10" ) << QString("ABA") << QString("C") << QString("") << QString("ABA") << true;
+ QTest::newRow( "rem11" ) << QString("banana") << QString("an") << QString("") << QString("ba") << true;
+ QTest::newRow( "rem12" ) << QString("") << QString("A") << QString("") << QString("") << true;
+ QTest::newRow( "rem13" ) << QString("") << QString("A") << QString() << QString("") << true;
+ QTest::newRow( "rem14" ) << QString() << QString("A") << QString("") << QString() << true;
+ QTest::newRow( "rem15" ) << QString() << QString("A") << QString() << QString() << true;
+ QTest::newRow( "rem16" ) << QString() << QString("") << QString("") << QString("") << true;
+ QTest::newRow( "rem17" ) << QString("") << QString() << QString("") << QString("") << true;
+ QTest::newRow( "rem18" ) << QString("a") << QString("a") << QString("") << QString("") << false;
+ QTest::newRow( "rem19" ) << QString("A") << QString("A") << QString("") << QString("") << false;
+ QTest::newRow( "rem20" ) << QString("a") << QString("A") << QString("") << QString("") << false;
+ QTest::newRow( "rem21" ) << QString("A") << QString("a") << QString("") << QString("") << false;
+ QTest::newRow( "rem22" ) << QString("Alpha beta") << QString("a") << QString("") << QString("lph bet") << false;
+
+ QTest::newRow( "rep00" ) << QString("ABC") << QString("B") << QString("-") << QString("A-C") << true;
+ QTest::newRow( "rep01" ) << QString("$()*+.?[\\]^{|}") << QString("$()*+.?[\\]^{|}") << QString("X") << QString("X") << true;
+ QTest::newRow( "rep02" ) << QString("ABCDEF") << QString("") << QString("X") << QString("XAXBXCXDXEXFX") << true;
+ QTest::newRow( "rep03" ) << QString("") << QString("") << QString("X") << QString("X") << true;
+ QTest::newRow( "rep04" ) << QString("a") << QString("a") << QString("b") << QString("b") << false;
+ QTest::newRow( "rep05" ) << QString("A") << QString("A") << QString("b") << QString("b") << false;
+ QTest::newRow( "rep06" ) << QString("a") << QString("A") << QString("b") << QString("b") << false;
+ QTest::newRow( "rep07" ) << QString("A") << QString("a") << QString("b") << QString("b") << false;
+ QTest::newRow( "rep08" ) << QString("a") << QString("a") << QString("a") << QString("a") << false;
+ QTest::newRow( "rep09" ) << QString("A") << QString("A") << QString("a") << QString("a") << false;
+ QTest::newRow( "rep10" ) << QString("a") << QString("A") << QString("a") << QString("a") << false;
+ QTest::newRow( "rep11" ) << QString("A") << QString("a") << QString("a") << QString("a") << false;
+ QTest::newRow( "rep12" ) << QString("Alpha beta") << QString("a") << QString("o") << QString("olpho beto") << false;
+ QTest::newRow( "rep13" ) << QString() << QString("") << QString("A") << QString("A") << true;
+ QTest::newRow( "rep14" ) << QString("") << QString() << QString("A") << QString("A") << true;
+ QTest::newRow( "rep15" ) << QString("fooxbarxbazxblub") << QString("x") << QString("yz") << QString("fooyzbaryzbazyzblub") << true;
+ QTest::newRow( "rep16" ) << QString("fooxbarxbazxblub") << QString("x") << QString("z") << QString("foozbarzbazzblub") << true;
+ QTest::newRow( "rep17" ) << QString("fooxybarxybazxyblub") << QString("xy") << QString("z") << QString("foozbarzbazzblub") << true;
}
void tst_QString::replace_regexp_data()
@@ -958,68 +958,68 @@ void tst_QString::indexOf_data()
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;
+ 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;
+ 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
@@ -1027,21 +1027,21 @@ void tst_QString::indexOf_data()
s1 += QChar(0xb5);
QString s2;
s2 += QChar(0x3bc);
- QTest::newRow( "data58" ) << s1 << s2 << 0 << FALSE << 3;
+ QTest::newRow( "data58" ) << s1 << s2 << 0 << false << 3;
s2.prepend("C");
- QTest::newRow( "data59" ) << s1 << s2 << 0 << FALSE << 2;
+ QTest::newRow( "data59" ) << s1 << 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("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;
+ QTest::newRow("BoyerMooreInsensitiveStressTest") << veryBigHaystack << veryBigHaystack << 0 << false << 0;
}
@@ -1470,11 +1470,11 @@ void tst_QString::leftJustified()
QString n;
QVERIFY(!n.leftJustified(3).isNull());
- QCOMPARE(a.leftJustified(4,' ',TRUE),(QString)"ABC ");
- QCOMPARE(a.leftJustified(3,' ',TRUE),(QString)"ABC");
- QCOMPARE(a.leftJustified(2,' ',TRUE),(QString)"AB");
- QCOMPARE(a.leftJustified(1,' ',TRUE),(QString)"A");
- QCOMPARE(a.leftJustified(0,' ',TRUE),(QString)"");
+ QCOMPARE(a.leftJustified(4,' ',true),(QString)"ABC ");
+ QCOMPARE(a.leftJustified(3,' ',true),(QString)"ABC");
+ QCOMPARE(a.leftJustified(2,' ',true),(QString)"AB");
+ QCOMPARE(a.leftJustified(1,' ',true),(QString)"A");
+ QCOMPARE(a.leftJustified(0,' ',true),(QString)"");
}
void tst_QString::rightJustified()
@@ -1491,12 +1491,12 @@ void tst_QString::rightJustified()
QString n;
QVERIFY(!n.rightJustified(3).isNull());
- QCOMPARE(a.rightJustified(4,'-',TRUE),(QString)"-ABC");
- QCOMPARE(a.rightJustified(4,' ',TRUE),(QString)" ABC");
- QCOMPARE(a.rightJustified(3,' ',TRUE),(QString)"ABC");
- QCOMPARE(a.rightJustified(2,' ',TRUE),(QString)"AB");
- QCOMPARE(a.rightJustified(1,' ',TRUE),(QString)"A");
- QCOMPARE(a.rightJustified(0,' ',TRUE),(QString)"");
+ QCOMPARE(a.rightJustified(4,'-',true),(QString)"-ABC");
+ QCOMPARE(a.rightJustified(4,' ',true),(QString)" ABC");
+ QCOMPARE(a.rightJustified(3,' ',true),(QString)"ABC");
+ QCOMPARE(a.rightJustified(2,' ',true),(QString)"AB");
+ QCOMPARE(a.rightJustified(1,' ',true),(QString)"A");
+ QCOMPARE(a.rightJustified(0,' ',true),(QString)"");
QCOMPARE(a,(QString)"ABC");
}
@@ -2498,10 +2498,10 @@ void tst_QString::toULong_data()
QTest::addColumn<ulong>("result" );
QTest::addColumn<bool>("ok" );
- QTest::newRow( "default" ) << QString() << 10 << 0UL << FALSE;
- QTest::newRow( "empty" ) << QString("") << 10 << 0UL << FALSE;
- QTest::newRow( "ulong1" ) << QString("3234567890") << 10 << 3234567890UL << TRUE;
- QTest::newRow( "ulong2" ) << QString("fFFfFfFf") << 16 << 0xFFFFFFFFUL << TRUE;
+ QTest::newRow( "default" ) << QString() << 10 << 0UL << false;
+ QTest::newRow( "empty" ) << QString("") << 10 << 0UL << false;
+ QTest::newRow( "ulong1" ) << QString("3234567890") << 10 << 3234567890UL << true;
+ QTest::newRow( "ulong2" ) << QString("fFFfFfFf") << 16 << 0xFFFFFFFFUL << true;
}
void tst_QString::toULong()
@@ -2524,16 +2524,16 @@ void tst_QString::toLong_data()
QTest::addColumn<long>("result" );
QTest::addColumn<bool>("ok" );
- QTest::newRow( "default" ) << QString() << 10 << 0L << FALSE;
- QTest::newRow( "empty" ) << QString("") << 10 << 0L << FALSE;
- QTest::newRow( "normal" ) << QString("7fFFfFFf") << 16 << 0x7fFFfFFfL << TRUE;
- QTest::newRow( "long_max" ) << QString("2147483647") << 10 << 2147483647L << TRUE;
+ QTest::newRow( "default" ) << QString() << 10 << 0L << false;
+ QTest::newRow( "empty" ) << QString("") << 10 << 0L << false;
+ QTest::newRow( "normal" ) << QString("7fFFfFFf") << 16 << 0x7fFFfFFfL << true;
+ QTest::newRow( "long_max" ) << QString("2147483647") << 10 << 2147483647L << true;
if (sizeof(long) == 4) {
- QTest::newRow( "long_max+1" ) << QString("2147483648") << 10 << 0L << FALSE;
- QTest::newRow( "long_min-1" ) << QString("-80000001") << 16 << 0L << FALSE;
+ QTest::newRow( "long_max+1" ) << QString("2147483648") << 10 << 0L << false;
+ QTest::newRow( "long_min-1" ) << QString("-80000001") << 16 << 0L << false;
}
- QTest::newRow( "negative" ) << QString("-7fffffff") << 16 << -0x7fffffffL << TRUE;
-// QTest::newRow( "long_min" ) << QString("-80000000") << 16 << 0x80000000uL << TRUE;
+ QTest::newRow( "negative" ) << QString("-7fffffff") << 16 << -0x7fffffffL << true;
+// QTest::newRow( "long_min" ) << QString("-80000000") << 16 << 0x80000000uL << true;
}
void tst_QString::toLong()
@@ -2637,33 +2637,33 @@ void tst_QString::toDouble_data()
QTest::addColumn<double>("result" );
QTest::addColumn<bool>("result_ok" );
- QTest::newRow( "ok00" ) << QString("0.000000000931322574615478515625") << 0.000000000931322574615478515625 << (bool)TRUE;
- QTest::newRow( "ok01" ) << QString(" 123.45") << 123.45 << (bool)TRUE;
+ QTest::newRow( "ok00" ) << QString("0.000000000931322574615478515625") << 0.000000000931322574615478515625 << true;
+ QTest::newRow( "ok01" ) << QString(" 123.45") << 123.45 << true;
- QTest::newRow( "ok02" ) << QString("0.1e10") << 0.1e10 << (bool)TRUE;
- QTest::newRow( "ok03" ) << QString("0.1e-10") << 0.1e-10 << (bool)TRUE;
+ QTest::newRow( "ok02" ) << QString("0.1e10") << 0.1e10 << true;
+ QTest::newRow( "ok03" ) << QString("0.1e-10") << 0.1e-10 << true;
- QTest::newRow( "ok04" ) << QString("1e10") << 1.0e10 << (bool)TRUE;
- QTest::newRow( "ok05" ) << QString("1e+10") << 1.0e10 << (bool)TRUE;
- QTest::newRow( "ok06" ) << QString("1e-10") << 1.0e-10 << (bool)TRUE;
+ QTest::newRow( "ok04" ) << QString("1e10") << 1.0e10 << true;
+ QTest::newRow( "ok05" ) << QString("1e+10") << 1.0e10 << true;
+ QTest::newRow( "ok06" ) << QString("1e-10") << 1.0e-10 << true;
- QTest::newRow( "ok07" ) << QString(" 1e10") << 1.0e10 << (bool)TRUE;
- QTest::newRow( "ok08" ) << QString(" 1e+10") << 1.0e10 << (bool)TRUE;
- QTest::newRow( "ok09" ) << QString(" 1e-10") << 1.0e-10 << (bool)TRUE;
+ QTest::newRow( "ok07" ) << QString(" 1e10") << 1.0e10 << true;
+ QTest::newRow( "ok08" ) << QString(" 1e+10") << 1.0e10 << true;
+ QTest::newRow( "ok09" ) << QString(" 1e-10") << 1.0e-10 << true;
- QTest::newRow( "ok10" ) << QString("1.") << 1.0 << (bool)TRUE;
- QTest::newRow( "ok11" ) << QString(".1") << 0.1 << (bool)TRUE;
+ QTest::newRow( "ok10" ) << QString("1.") << 1.0 << true;
+ QTest::newRow( "ok11" ) << QString(".1") << 0.1 << true;
- QTest::newRow( "wrong00" ) << QString("123.45 ") << 123.45 << (bool)TRUE;
- QTest::newRow( "wrong01" ) << QString(" 123.45 ") << 123.45 << (bool)TRUE;
+ QTest::newRow( "wrong00" ) << QString("123.45 ") << 123.45 << true;
+ QTest::newRow( "wrong01" ) << QString(" 123.45 ") << 123.45 << true;
- QTest::newRow( "wrong02" ) << QString("aa123.45aa") << 0.0 << (bool)FALSE;
- QTest::newRow( "wrong03" ) << QString("123.45aa") << 0.0 << (bool)FALSE;
- QTest::newRow( "wrong04" ) << QString("123erf") << 0.0 << (bool)FALSE;
+ QTest::newRow( "wrong02" ) << QString("aa123.45aa") << 0.0 << false;
+ QTest::newRow( "wrong03" ) << QString("123.45aa") << 0.0 << false;
+ QTest::newRow( "wrong04" ) << QString("123erf") << 0.0 << false;
- QTest::newRow( "wrong05" ) << QString("abc") << 0.0 << (bool)FALSE;
- QTest::newRow( "wrong06" ) << QString() << 0.0 << (bool)FALSE;
- QTest::newRow( "wrong07" ) << QString("") << 0.0 << (bool)FALSE;
+ QTest::newRow( "wrong05" ) << QString("abc") << 0.0 << false;
+ QTest::newRow( "wrong06" ) << QString() << 0.0 << false;
+ QTest::newRow( "wrong07" ) << QString("") << 0.0 << false;
}
void tst_QString::toDouble()
diff --git a/tests/auto/qstringlist/qstringlist.pro b/tests/auto/qstringlist/qstringlist.pro
index b2ad23d..aee074b 100644
--- a/tests/auto/qstringlist/qstringlist.pro
+++ b/tests/auto/qstringlist/qstringlist.pro
@@ -1,7 +1,3 @@
load(qttest_p4)
SOURCES += tst_qstringlist.cpp
-
-
QT = core
-
-
diff --git a/tests/auto/qstringlistmodel/tst_qstringlistmodel.cpp b/tests/auto/qstringlistmodel/tst_qstringlistmodel.cpp
index 619a56d..dbfc983 100644
--- a/tests/auto/qstringlistmodel/tst_qstringlistmodel.cpp
+++ b/tests/auto/qstringlistmodel/tst_qstringlistmodel.cpp
@@ -46,7 +46,6 @@
#include <qmap.h>
#include <qstringlistmodel.h>
#include <qstringlist.h>
-#include <iostream>
#include <qlistview.h>
#include "qmodellistener.h"
#include <qstringlistmodel.h>
diff --git a/tests/auto/qstyle/qstyle.pro b/tests/auto/qstyle/qstyle.pro
index ba0908a..1ffe369 100644
--- a/tests/auto/qstyle/qstyle.pro
+++ b/tests/auto/qstyle/qstyle.pro
@@ -1,13 +1,12 @@
load(qttest_p4)
+TARGET.EPOCHEAPSIZE = 0x200000 0x800000
SOURCES += tst_qstyle.cpp
-wince*: {
- DEFINES += SRCDIR=\\\".\\\"
+wince*|symbian*: {
+ !symbian:DEFINES += SRCDIR=\\\".\\\"
addPixmap.sources = task_25863.png
addPixmap.path = .
DEPLOYMENT += addPixmap
} else {
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
-
-
diff --git a/tests/auto/qstyle/tst_qstyle.cpp b/tests/auto/qstyle/tst_qstyle.cpp
index b24a58a..eb8f50a 100644
--- a/tests/auto/qstyle/tst_qstyle.cpp
+++ b/tests/auto/qstyle/tst_qstyle.cpp
@@ -71,6 +71,10 @@
#include <qlineedit.h>
#include <qmdiarea.h>
+#if defined(Q_OS_SYMBIAN)
+#define SRCDIR "."
+#endif
+
#include <QCleanlooksStyle>
#ifdef Q_WS_MAC
@@ -100,10 +104,14 @@ static bool qt_wince_is_smartphone() {
}
#endif
+#ifdef Q_WS_S60
+#include <qs60style.h>
+#endif
+
#include <qwidget.h>
//TESTED_CLASS=
-//TESTED_FILES=gui/styles/qstyle.h gui/styles/qstyle.cpp gui/styles/qplastiquestyle.cpp gui/styles/qwindowsstyle.cpp gui/styles/qwindowsxpstyle.cpp gui/styles/qwindowsvistastyle.cpp gui/styles/qmotifstyle.cpp
+//TESTED_FILES=gui/styles/qstyle.h gui/styles/qstyle.cpp gui/styles/qplastiquestyle.cpp gui/styles/qwindowsstyle.cpp gui/styles/qwindowsxpstyle.cpp gui/styles/qwindowsvistastyle.cpp gui/styles/qmotifstyle.cpp gui/styles/qs60style.cpp
class tst_QStyle : public QObject
{
@@ -131,13 +139,14 @@ private slots:
void testMacStyle();
void testWindowsCEStyle();
void testWindowsMobileStyle();
+ void testS60Style();
void testStyleFactory();
void testProxyStyle();
void pixelMetric();
void progressBarChangeStyle();
void defaultFont();
private:
- void lineUpLayoutTest(QStyle *);
+ void lineUpLayoutTest(QStyle *);
QWidget *testWidget;
};
@@ -200,10 +209,10 @@ void tst_QStyle::testStyleFactory()
QVERIFY(keys.contains("Motif"));
#endif
#ifdef Q_WS_WIN
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP &&
+ if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP &&
QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)
QVERIFY(keys.contains("WindowsXP"));
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA &&
+ if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA &&
QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)
QVERIFY(keys.contains("WindowsVista"));
#endif
@@ -270,17 +279,17 @@ void tst_QStyle::testAllFunctions(QStyle *style)
opt.init(testWidget);
testWidget->setStyle(style);
-
+
//Tests styleHint with default arguments for potential crashes
for ( int hint = 0 ; hint < int(QStyle::SH_Menu_Mask); ++hint) {
style->styleHint(QStyle::StyleHint(hint));
style->styleHint(QStyle::StyleHint(hint), &opt, testWidget);
}
-
+
//Tests pixelMetric with default arguments for potential crashes
for ( int pm = 0 ; pm < int(QStyle::PM_LayoutVerticalSpacing); ++pm) {
style->pixelMetric(QStyle::PixelMetric(pm));
- style->pixelMetric(QStyle::PixelMetric(pm), &opt, testWidget);
+ style->pixelMetric(QStyle::PixelMetric(pm), &opt, testWidget);
}
//Tests drawControl with default arguments for potential crashes
@@ -296,7 +305,7 @@ void tst_QStyle::testAllFunctions(QStyle *style)
QPainter painter(&surface);
QStyleOptionComboBox copt1;
copt1.init(testWidget);
-
+
QStyleOptionGroupBox copt2;
copt2.init(testWidget);
QStyleOptionSizeGrip copt3;
@@ -347,7 +356,7 @@ void tst_QStyle::testAllFunctions(QStyle *style)
style->itemPixmapRect(QRect(0, 0, 100, 100), Qt::AlignHCenter, QPixmap(200, 200));
style->itemTextRect(QFontMetrics(qApp->font()), QRect(0, 0, 100, 100), Qt::AlignHCenter, true, QString("Test"));
-
+
testScrollBarSubControls(style);
}
@@ -362,6 +371,12 @@ void tst_QStyle::testScrollBarSubControls(QStyle* style)
scrollBar.show();
const QStyleOptionSlider opt = qt_qscrollbarStyleOption(&scrollBar);
foreach (int subControl, QList<int>() << 1 << 2 << 4 << 8) {
+
+#ifdef Q_WS_S60
+// in s60style add line and sub line have been removed.
+ if (subControl == QStyle::SC_ScrollBarAddLine || subControl == QStyle::SC_ScrollBarSubLine )
+ continue;
+#endif
QRect sr = testWidget->style()->subControlRect(QStyle::CC_ScrollBar, &opt,
QStyle::SubControl(subControl), &scrollBar);
QVERIFY(sr.isNull() == false);
@@ -446,7 +461,7 @@ void comparePixmap(const QString &filename, const QPixmap &pixmap)
void tst_QStyle::testPainting(QStyle *style, const QString &platform)
{
//Test Menu
- QString fileName = "images/" + platform + "/menu.png";
+ QString fileName = "images/" + platform + "/menu.png";
QMenu menu;
menu.setStyle(style);
menu.show();
@@ -455,7 +470,7 @@ void tst_QStyle::testPainting(QStyle *style, const QString &platform)
QPixmap pixmap = QPixmap::grabWidget(&menu);
comparePixmap(fileName, pixmap);
- //Push button
+ //Push button
fileName = "images/" + platform + "/button.png";
QPushButton button("OK");
button.setStyle(style);
@@ -464,7 +479,7 @@ void tst_QStyle::testPainting(QStyle *style, const QString &platform)
button.hide();
comparePixmap(fileName, pixmap);
- //Push button
+ //Push button
fileName = "images/" + platform + "/radiobutton.png";
QRadioButton radiobutton("Check");
radiobutton.setStyle(style);
@@ -494,7 +509,7 @@ void tst_QStyle::testPainting(QStyle *style, const QString &platform)
spinbox.hide();
comparePixmap(fileName, pixmap);
QLocale::setDefault(QLocale::system());
-
+
//Slider
fileName = "images/" + platform + "/slider.png";
QSlider slider;
@@ -573,6 +588,16 @@ void tst_QStyle::testWindowsMobileStyle()
#endif
}
+void tst_QStyle::testS60Style()
+ {
+#if defined(Q_WS_S60)
+ QS60Style cstyle;
+ testAllFunctions(&cstyle);
+#else
+ QSKIP("No S60Style style", SkipAll);
+#endif
+ }
+
// Helper class...
MyWidget::MyWidget( QWidget* parent, const char* name )
@@ -657,9 +682,9 @@ void tst_QStyle::pixelMetric()
void tst_QStyle::progressBarChangeStyle()
{
#if !defined(QT_NO_STYLE_PLASTIQUE) && !defined(QT_NO_STYLE_WINDOWS)
- //test a crashing situation (task 143530)
+ //test a crashing situation (task 143530)
//where changing the styles and deleting a progressbar would crash
-
+
QWindowsStyle style1;
QPlastiqueStyle style2;
@@ -676,35 +701,55 @@ void tst_QStyle::progressBarChangeStyle()
QTest::qWait(100);
//before the correction, there would be a crash here
+#elif !defined(QT_NO_STYLE_S60) && !defined(QT_NO_STYLE_WINDOWS)
+ //test a crashing situation (task 143530)
+ //where changing the styles and deleting a progressbar would crash
+
+ QWindowsStyle style1;
+ QS60Style style2;
+
+ QProgressBar *progress=new QProgressBar;
+ progress->setStyle(&style1);
+
+ progress->show();
+
+ progress->setStyle(&style2);
+
+ QTest::qWait(100);
+ delete progress;
+
+ QTest::qWait(100);
+
+ //before the correction, there would be a crash here
#else
- QSKIP("Either style Plastique or Windows missing", SkipAll);
+ QSKIP("Either style Plastique or Windows or S60 missing", SkipAll);
#endif
}
void tst_QStyle::lineUpLayoutTest(QStyle *style)
{
- QWidget widget;
- QHBoxLayout layout;
- QFont font;
- font.setPointSize(9); //Plastique is lined up for odd numbers...
- widget.setFont(font);
- QSpinBox spinbox(&widget);
- QLineEdit lineedit(&widget);
- QComboBox combo(&widget);
- combo.setEditable(true);
- layout.addWidget(&spinbox);
- layout.addWidget(&lineedit);
- layout.addWidget(&combo);
- widget.setLayout(&layout);
+ QWidget widget;
+ QHBoxLayout layout;
+ QFont font;
+ font.setPointSize(9); //Plastique is lined up for odd numbers...
+ widget.setFont(font);
+ QSpinBox spinbox(&widget);
+ QLineEdit lineedit(&widget);
+ QComboBox combo(&widget);
+ combo.setEditable(true);
+ layout.addWidget(&spinbox);
+ layout.addWidget(&lineedit);
+ layout.addWidget(&combo);
+ widget.setLayout(&layout);
widget.setStyle(style);
// propagate the style.
foreach (QWidget *w, qFindChildren<QWidget *>(&widget))
w->setStyle(style);
- widget.show();
+ widget.show();
QTest::qWait( 500 );
- QVERIFY(qAbs(spinbox.height() - lineedit.height()) <= 1);
- QVERIFY(qAbs(spinbox.height() - combo.height()) <= 1);
+ QVERIFY(qAbs(spinbox.height() - lineedit.height()) <= 1);
+ QVERIFY(qAbs(spinbox.height() - combo.height()) <= 1);
}
void tst_QStyle::defaultFont()
diff --git a/tests/auto/qstylesheetstyle/qstylesheetstyle.pro b/tests/auto/qstylesheetstyle/qstylesheetstyle.pro
index f6101f4..eada969 100644
--- a/tests/auto/qstylesheetstyle/qstylesheetstyle.pro
+++ b/tests/auto/qstylesheetstyle/qstylesheetstyle.pro
@@ -1,14 +1,4 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Wed Apr 26 13:53:24 2006
-######################################################################
-
-TEMPLATE = app
-TARGET = tst_qstylesheetstyle
-DEPENDPATH += .
-INCLUDEPATH += . ..
-
-CONFIG += console qtestlib
-contains(QT_CONFIG, qt3support): QT += qt3support
+load(qttest_p4)
# Input
SOURCES += tst_qstylesheetstyle.cpp
diff --git a/tests/auto/qsvggenerator/qsvggenerator.pro b/tests/auto/qsvggenerator/qsvggenerator.pro
index 1eb72b3..450bcd3 100644
--- a/tests/auto/qsvggenerator/qsvggenerator.pro
+++ b/tests/auto/qsvggenerator/qsvggenerator.pro
@@ -7,11 +7,14 @@ QT += svg xml
SOURCES += tst_qsvggenerator.cpp
-wince*: {
+wince*|symbian {
addFiles.sources = referenceSvgs
addFiles.path = .
DEPLOYMENT += addFiles
+}
+
+wince* {
DEFINES += SRCDIR=\\\"\\\"
-} else {
+} !symbian {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qsvggenerator/tst_qsvggenerator.cpp b/tests/auto/qsvggenerator/tst_qsvggenerator.cpp
index ef5d22d..3252bc1 100644
--- a/tests/auto/qsvggenerator/tst_qsvggenerator.cpp
+++ b/tests/auto/qsvggenerator/tst_qsvggenerator.cpp
@@ -55,6 +55,10 @@
//TESTED_CLASS=
//TESTED_FILES=
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR ""
+#endif
+
class tst_QSvgGenerator : public QObject
{
Q_OBJECT
diff --git a/tests/auto/qsvgrenderer/qsvgrenderer.pro b/tests/auto/qsvgrenderer/qsvgrenderer.pro
index 120d9f0..8cfbcce 100644
--- a/tests/auto/qsvgrenderer/qsvgrenderer.pro
+++ b/tests/auto/qsvgrenderer/qsvgrenderer.pro
@@ -8,7 +8,7 @@ QT += svg
SOURCES += tst_qsvgrenderer.cpp
RESOURCES += resources.qrc
-wince*: {
+wince*|symbian {
addFiles.sources = *.svg *.svgz
addFiles.path = .
diff --git a/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp b/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp
index a97e172..ab979e8 100644
--- a/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp
+++ b/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp
@@ -147,7 +147,7 @@ public:
};
QT_BEGIN_NAMESPACE
-static bool operator==(const QTextLayout::FormatRange &lhs, const QTextLayout::FormatRange &rhs)
+bool operator==(const QTextLayout::FormatRange &lhs, const QTextLayout::FormatRange &rhs)
{
return lhs.start == rhs.start
&& lhs.length == rhs.length
diff --git a/tests/auto/qsysinfo/qsysinfo.pro b/tests/auto/qsysinfo/qsysinfo.pro
index 917c281..e822fec 100644
--- a/tests/auto/qsysinfo/qsysinfo.pro
+++ b/tests/auto/qsysinfo/qsysinfo.pro
@@ -1,5 +1,4 @@
load(qttest_p4)
-
SOURCES += tst_qsysinfo.cpp
QT = core
diff --git a/tests/auto/qsystemsemaphore/test/test.pro b/tests/auto/qsystemsemaphore/test/test.pro
index 62ea054..b8d3a4a 100644
--- a/tests/auto/qsystemsemaphore/test/test.pro
+++ b/tests/auto/qsystemsemaphore/test/test.pro
@@ -18,7 +18,7 @@ win32 {
RESOURCES += ../files.qrc
wince*: {
-# this test calls lackkey, which then again depends on QtScript.
+# 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 = ../../qsharedmemory/lackey/lackey.exe
@@ -27,3 +27,12 @@ lackey.path = ../qsharedmemory/lackey
DEPLOYMENT += lackey
}
+symbian: {
+# 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 = ../../qsharedmemory/lackey/lackey.exe
+lackey.path = /sys/bin
+DEPLOYMENT += lackey
+}
diff --git a/tests/auto/qsystemsemaphore/tst_qsystemsemaphore.cpp b/tests/auto/qsystemsemaphore/tst_qsystemsemaphore.cpp
index 1aa723c..1b8c375 100644
--- a/tests/auto/qsystemsemaphore/tst_qsystemsemaphore.cpp
+++ b/tests/auto/qsystemsemaphore/tst_qsystemsemaphore.cpp
@@ -185,6 +185,9 @@ void tst_QSystemSemaphore::complexacquire()
void tst_QSystemSemaphore::basicProcesses()
{
+#if defined (Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
+ QSKIP("Cannot launch multiple Qt processes in Symbian emulator", SkipAll);
+#endif
QSystemSemaphore sem("store", 0, QSystemSemaphore::Create);
QStringList acquireArguments = QStringList() << acquire_js();
@@ -201,6 +204,7 @@ void tst_QSystemSemaphore::basicProcesses()
acquire.kill();
release.start(LACKYLOC "/lackey", releaseArguments);
acquire.waitForFinished(5000);
+ release.waitForFinished(5000);
QVERIFY(acquire.state() == QProcess::NotRunning);
}
@@ -216,6 +220,9 @@ void tst_QSystemSemaphore::processes_data()
void tst_QSystemSemaphore::processes()
{
+#if defined (Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
+ QSKIP("Cannot launch multiple Qt processes in Symbian emulator", SkipAll);
+#endif
QSystemSemaphore sem("store", 1, QSystemSemaphore::Create);
QFETCH(int, processes);
@@ -242,7 +249,7 @@ void tst_QSystemSemaphore::processes()
void tst_QSystemSemaphore::undo()
{
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
QSKIP("This test only checks a unix behavior", SkipSingle);
#endif
@@ -264,9 +271,11 @@ void tst_QSystemSemaphore::undo()
void tst_QSystemSemaphore::initialValue()
{
+#if defined (Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
+ QSKIP("Cannot launch multiple Qt processes in Symbian emulator", SkipAll);
+#endif
QSystemSemaphore sem("store", 1, QSystemSemaphore::Create);
-
QStringList acquireArguments = QStringList() << acquire_js();
QStringList releaseArguments = QStringList() << release_js();
QProcess acquire;
@@ -286,6 +295,7 @@ void tst_QSystemSemaphore::initialValue()
release.start(LACKYLOC "/lackey", releaseArguments);
acquire.waitForFinished(10000);
+ release.waitForFinished(10000);
QVERIFY(acquire.state()== QProcess::NotRunning);
}
QTEST_MAIN(tst_QSystemSemaphore)
diff --git a/tests/auto/qtableview/qtableview.pro b/tests/auto/qtableview/qtableview.pro
index 2368a56..72099d4 100644
--- a/tests/auto/qtableview/qtableview.pro
+++ b/tests/auto/qtableview/qtableview.pro
@@ -1,4 +1,4 @@
load(qttest_p4)
+TARGET.EPOCHEAPSIZE = 0x200000 0x800000
SOURCES += tst_qtableview.cpp
-
diff --git a/tests/auto/qtablewidget/qtablewidget.pro b/tests/auto/qtablewidget/qtablewidget.pro
index 2b2a016..d66d0ac 100644
--- a/tests/auto/qtablewidget/qtablewidget.pro
+++ b/tests/auto/qtablewidget/qtablewidget.pro
@@ -1,4 +1,16 @@
load(qttest_p4)
SOURCES += tst_qtablewidget.cpp
+# This prevents the GCCE compile failure: "elf2e32: Error 1063: Fatal Error in
+# PostLinker." The paged statement is documented in the S60 docs.
+symbian {
+ MMP_RULES -= PAGED
+
+ custom_paged_rule = "$${LITERAL_HASH}ifndef GCCE"\
+ "PAGED" \
+ "$${LITERAL_HASH}endif"
+ MMP_RULES += custom_paged_rule
+}
+
+symbian:MMP_RULES += "OPTION GCCE -mlong-calls"
diff --git a/tests/auto/qtconcurrentfilter/tst_qtconcurrentfilter.cpp b/tests/auto/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
index 0e6f551..10fc306 100644
--- a/tests/auto/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
+++ b/tests/auto/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
@@ -42,7 +42,7 @@
#include <QCoreApplication>
#include <QList>
#include <QLinkedList>
-#include <QTest>
+#include <QtTest/QtTest>
#include "../qtconcurrentmap/functions.h"
#include "../qfuture/versioncheck.h"
diff --git a/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp b/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp
index 950c19e..137de6c 100644
--- a/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp
+++ b/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp
@@ -65,7 +65,7 @@ struct TestIterator
int i;
};
-#include <iterator>
+#include <qiterator.h>
namespace std {
template <>
struct iterator_traits<TestIterator>
diff --git a/tests/auto/qtcpserver/crashingServer/main.cpp b/tests/auto/qtcpserver/crashingServer/main.cpp
index e0ecc42..09a8180 100644
--- a/tests/auto/qtcpserver/crashingServer/main.cpp
+++ b/tests/auto/qtcpserver/crashingServer/main.cpp
@@ -53,15 +53,15 @@ int main(int argc, char *argv[])
return 1;
}
-#if !defined(Q_OS_WINCE)
- printf("Listening\n");
- fflush(stdout);
-#else
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QFile file(QLatin1String("/test_signal.txt"));
file.open(QIODevice::WriteOnly);
file.write("Listening\n");
file.flush();
file.close();
+#else
+ printf("Listening\n");
+ fflush(stdout);
#endif
server.waitForNewConnection(5000);
diff --git a/tests/auto/qtcpserver/test/test.pro b/tests/auto/qtcpserver/test/test.pro
index 3ca854f..bdeaa92 100644
--- a/tests/auto/qtcpserver/test/test.pro
+++ b/tests/auto/qtcpserver/test/test.pro
@@ -12,6 +12,12 @@ wince*: {
}
}
+symbian {
+ crashApp.sources = $$QT_BUILD_TREE/examples/widgets/wiggly/$${BUILD_DIR}/crashingServer.exe
+ crashApp.path = .
+ DEPLOYMENT += crashApp
+}
+
TARGET = ../tst_qtcpserver
win32 {
diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/qtcpserver/tst_qtcpserver.cpp
index 0a4aaba..bd4b13b 100644
--- a/tests/auto/qtcpserver/tst_qtcpserver.cpp
+++ b/tests/auto/qtcpserver/tst_qtcpserver.cpp
@@ -39,8 +39,9 @@
**
****************************************************************************/
-
-#ifdef _WIN32
+// Just to get Q_OS_SYMBIAN
+#include <qglobal.h>
+#if defined(_WIN32) && !defined(Q_OS_SYMBIAN)
#include <winsock2.h>
#else
#include <sys/types.h>
@@ -129,11 +130,11 @@ void tst_QTcpServer::getSetCheck()
tst_QTcpServer::tst_QTcpServer()
{
+ Q_SET_DEFAULT_IAP
}
tst_QTcpServer::~tst_QTcpServer()
{
-
}
void tst_QTcpServer::initTestCase_data()
@@ -232,6 +233,9 @@ void tst_QTcpServer::clientServerLoop()
//----------------------------------------------------------------------------------
void tst_QTcpServer::ipv6Server()
{
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Symbian: IPv6 is not yet supported", SkipAll);
+#endif
//### need to enter the event loop for the server to get the connection ?? ( windows)
QTcpServer server;
if (!server.listen(QHostAddress::LocalHostIPv6, 8944)) {
@@ -309,6 +313,9 @@ void tst_QTcpServer::ipv4LoopbackPerformanceTest()
//----------------------------------------------------------------------------------
void tst_QTcpServer::ipv6LoopbackPerformanceTest()
{
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Symbian: IPv6 is not yet supported", SkipAll);
+#endif
QTcpServer server;
if (!server.listen(QHostAddress::LocalHostIPv6, 0)) {
QVERIFY(server.serverError() == QAbstractSocket::UnsupportedSocketOperationError);
@@ -503,6 +510,7 @@ private:
//----------------------------------------------------------------------------------
void tst_QTcpServer::waitForConnectionTest()
{
+
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
#ifdef TEST_QNETWORK_PROXY
@@ -514,7 +522,7 @@ void tst_QTcpServer::waitForConnectionTest()
}
QTcpSocket findLocalIpSocket;
- findLocalIpSocket.connectToHost(QtNetworkSettings::serverName(), 21);
+ findLocalIpSocket.connectToHost(QtNetworkSettings::serverName(), 143);
QVERIFY(findLocalIpSocket.waitForConnected(2000));
QTcpServer server;
@@ -527,10 +535,10 @@ void tst_QTcpServer::waitForConnectionTest()
ThreadConnector connector(findLocalIpSocket.localAddress(), server.serverPort());
connector.start();
-#if !defined(Q_OS_WINCE)
- QVERIFY(server.waitForNewConnection(3000, &timeout));
-#else
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QVERIFY(server.waitForNewConnection(9000, &timeout));
+#else
+ QVERIFY(server.waitForNewConnection(3000, &timeout));
#endif
QVERIFY(!timeout);
}
@@ -590,7 +598,11 @@ protected:
{
// how a user woulddo it (qabstractsocketengine is not public)
unsigned long arg = 0;
-#ifdef Q_OS_WIN
+#if defined(Q_OS_SYMBIAN)
+ arg = fcntl(socketDescriptor, F_GETFL, NULL);
+ arg &= (~O_NONBLOCK);
+ ok = ::fcntl(socketDescriptor, F_SETFL, arg) != -1;
+#elif defined(Q_OS_WIN)
ok = ::ioctlsocket(socketDescriptor, FIONBIO, &arg) == 0;
::closesocket(socketDescriptor);
#else
@@ -602,6 +614,10 @@ protected:
void tst_QTcpServer::addressReusable()
{
+#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
+ QSKIP("Symbian: Emulator does not support process launching", SkipAll );
+#endif
+
#if defined(QT_NO_PROCESS)
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
#else
@@ -615,7 +631,7 @@ void tst_QTcpServer::addressReusable()
}
#endif
}
-#if defined(Q_OS_WINCE)
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QString signalName = QString::fromLatin1("/test_signal.txt");
QFile::remove(signalName);
// The crashingServer process will crash once it gets a connection.
@@ -663,9 +679,7 @@ void tst_QTcpServer::setNewSocketDescriptorBlocking()
QTcpSocket socket;
socket.connectToHost(QHostAddress::LocalHost, server.serverPort());
-
QVERIFY(server.waitForNewConnection(5000));
-
QVERIFY(server.ok);
}
@@ -678,7 +692,7 @@ void tst_QTcpServer::invalidProxy_data()
QTest::addColumn<int>("expectedError");
QString fluke = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString();
- QTest::newRow("ftp-proxy") << int(QNetworkProxy::FtpCachingProxy) << fluke << 21
+ QTest::newRow("ftp-proxy") << int(QNetworkProxy::FtpCachingProxy) << fluke << 143
<< int(QAbstractSocket::UnsupportedSocketOperationError);
QTest::newRow("http-proxy") << int(QNetworkProxy::HttpProxy) << fluke << 3128
<< int(QAbstractSocket::UnsupportedSocketOperationError);
diff --git a/tests/auto/qtcpsocket/qtcpsocket.pro b/tests/auto/qtcpsocket/qtcpsocket.pro
index 6a96889..4bbec23 100644
--- a/tests/auto/qtcpsocket/qtcpsocket.pro
+++ b/tests/auto/qtcpsocket/qtcpsocket.pro
@@ -2,5 +2,4 @@ TEMPLATE = subdirs
!wince*: SUBDIRS = test stressTest
-wince*: SUBDIRS = test
-vxworks*: SUBDIRS = test
+wince*|symbian*|vxworks* : SUBDIRS = test
diff --git a/tests/auto/qtcpsocket/test/test.pro b/tests/auto/qtcpsocket/test/test.pro
index 696375d..0f93def 100644
--- a/tests/auto/qtcpsocket/test/test.pro
+++ b/tests/auto/qtcpsocket/test/test.pro
@@ -11,7 +11,9 @@ wince*: {
QT += network
vxworks:QT -= gui
-DEFINES += TEST_QNETWORK_PROXY
+symbian: TARGET.EPOCHEAPSIZE="0x100 0x1000000"
+
+#DEFINES += TEST_QNETWORK_PROXY
TARGET = tst_qtcpsocket
diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
index 6d0dc21..81c86a2 100644
--- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
@@ -40,7 +40,10 @@
****************************************************************************/
-#ifdef _WIN32
+// Just to get Q_OS_SYMBIAN
+#include <qglobal.h>
+
+#if defined(_WIN32) && !defined(Q_OS_SYMBIAN)
#include <winsock2.h>
#else
#include <sys/types.h>
@@ -82,9 +85,8 @@
#ifndef TEST_QNETWORK_PROXY
#define TEST_QNETWORK_PROXY
#endif
-#ifdef TEST_QNETWORK_PROXY
+// RVCT compiles also unused inline methods
# include <QNetworkProxy>
-#endif
#ifdef Q_OS_LINUX
#include <stdio.h>
@@ -249,6 +251,7 @@ int tst_QTcpSocket::loopLevel = 0;
tst_QTcpSocket::tst_QTcpSocket()
{
+ Q_SET_DEFAULT_IAP
tmpSocket = 0;
}
@@ -907,7 +910,11 @@ void tst_QTcpSocket::disconnectWhileConnecting()
}
connect(socket, SIGNAL(disconnected()), SLOT(exitLoopSlot()));
+#ifndef Q_OS_SYMBIAN
enterLoop(10);
+#else
+ enterLoop(30);
+#endif
QVERIFY2(!timeout(), "Network timeout");
QVERIFY(socket->state() == QAbstractSocket::UnconnectedState);
if (!closeDirectly) {
@@ -942,7 +949,7 @@ public:
: server(0), ok(false), quit(false)
{ }
- ~ReceiverThread() { wait(); delete server; }
+ ~ReceiverThread() { /*delete server;*/ terminate(); wait(); }
bool listen()
{
@@ -959,7 +966,11 @@ protected:
{
bool timedOut = false;
while (!quit) {
+#ifndef Q_OS_SYMBIAN
if (server->waitForNewConnection(500, &timedOut))
+#else
+ if (server->waitForNewConnection(5000, &timedOut))
+#endif
break;
if (!timedOut)
return;
@@ -967,7 +978,11 @@ protected:
QTcpSocket *socket = server->nextPendingConnection();
while (!quit) {
+#ifndef Q_OS_SYMBIAN
if (socket->waitForDisconnected(500))
+#else
+ if (socket->waitForDisconnected(5000))
+#endif
break;
if (socket->error() != QAbstractSocket::SocketTimeoutError)
return;
@@ -1015,7 +1030,11 @@ void tst_QTcpSocket::disconnectWhileConnectingNoEventLoop()
socket->disconnectFromHost();
}
+#ifndef Q_OS_SYMBIAN
QVERIFY2(socket->waitForDisconnected(10000), "Network timeout");
+#else
+ QVERIFY2(socket->waitForDisconnected(30000), "Network timeout");
+#endif
QVERIFY(socket->state() == QAbstractSocket::UnconnectedState);
if (!closeDirectly) {
QCOMPARE(int(socket->openMode()), int(QIODevice::ReadWrite));
@@ -1025,7 +1044,7 @@ void tst_QTcpSocket::disconnectWhileConnectingNoEventLoop()
delete socket;
// check if the other side received everything ok
- QVERIFY(thread.wait(10000));
+ QVERIFY(thread.wait(30000));
QVERIFY(thread.ok);
QCOMPARE(thread.receivedData, data);
}
@@ -1061,7 +1080,11 @@ void tst_QTcpSocket::disconnectWhileLookingUp()
// let anything queued happen
QEventLoop loop;
+#ifndef Q_OS_SYMBIAN
QTimer::singleShot(50, &loop, SLOT(quit()));
+#else
+ QTimer::singleShot(5000, &loop, SLOT(quit()));
+#endif
loop.exec();
// recheck
@@ -1166,13 +1189,13 @@ void tst_QTcpSocket::readLine()
QVERIFY(socket->waitForReadyRead(10000));
char buffer[1024];
- QCOMPARE(socket->readLine(buffer, sizeof(buffer)), qint64(161));
+ int expectedReplySize = QtNetworkSettings::expectedReplyIMAP().size();
+ Q_ASSERT(expectedReplySize >= 3);
+ QCOMPARE(socket->readLine(buffer, sizeof(buffer)), qint64(expectedReplySize));
- // * OK fluke Cyrus IMAP4 v2.2.12 server ready__
-// // 01234567890123456789012345678901234567890123456789
- QCOMPARE((int) buffer[159], (int) '\r');
- QCOMPARE((int) buffer[160], (int) '\n');
- QCOMPARE((int) buffer[161], (int) '\0');
+ QCOMPARE((int) buffer[expectedReplySize-2], (int) '\r');
+ QCOMPARE((int) buffer[expectedReplySize-1], (int) '\n');
+ QCOMPARE((int) buffer[expectedReplySize], (int) '\0');
QCOMPARE(socket->write("1 NOOP\r\n"), qint64(8));
@@ -1210,7 +1233,7 @@ void tst_QTcpSocket::readLineString()
QVERIFY(socket->waitForReadyRead(10000));
QByteArray arr = socket->readLine();
- QCOMPARE(arr, expected);
+ QCOMPARE(arr, QtNetworkSettings::expectedReplyIMAP());
delete socket;
}
@@ -1307,11 +1330,19 @@ void tst_QTcpSocket::dontCloseOnTimeout()
QTcpSocket *socket = newSocket();
socket->connectToHost(serverAddress, server.serverPort());
+#ifndef Q_OS_SYMBIAN
QVERIFY(!socket->waitForReadyRead(100));
+#else
+ QVERIFY(!socket->waitForReadyRead(5000));
+#endif
QCOMPARE(socket->error(), QTcpSocket::SocketTimeoutError);
QVERIFY(socket->isOpen());
+#ifndef Q_OS_SYMBIAN
QVERIFY(!socket->waitForDisconnected(100));
+#else
+ QVERIFY(!socket->waitForDisconnected(5000));
+#endif
QCOMPARE(socket->error(), QTcpSocket::SocketTimeoutError);
QVERIFY(socket->isOpen());
@@ -1438,9 +1469,7 @@ void tst_QTcpSocket::socketInAThread()
TestThread thread;
thread.start();
QVERIFY(thread.wait(15000));
- QCOMPARE(thread.data(),
-// QByteArray("220 (vsFTPd 2.0.4)\r\n221 Goodbye.\r\n"));
- QByteArray("220 (vsFTPd 2.0.5)\r\n221 Goodbye.\r\n"));
+ QCOMPARE(thread.data(), QtNetworkSettings::expectedReplyFtp());
}
}
@@ -1460,12 +1489,9 @@ void tst_QTcpSocket::socketsInThreads()
QVERIFY(thread3.wait(15000));
QVERIFY(thread1.wait(15000));
- QCOMPARE(thread1.data(),
- QByteArray("220 (vsFTPd 2.0.5)\r\n221 Goodbye.\r\n"));
- QCOMPARE(thread2.data(),
- QByteArray("220 (vsFTPd 2.0.5)\r\n221 Goodbye.\r\n"));
- QCOMPARE(thread3.data(),
- QByteArray("220 (vsFTPd 2.0.5)\r\n221 Goodbye.\r\n"));
+ QCOMPARE(thread1.data(),QtNetworkSettings::expectedReplyFtp());
+ QCOMPARE(thread2.data(),QtNetworkSettings::expectedReplyFtp());
+ QCOMPARE(thread3.data(),QtNetworkSettings::expectedReplyFtp());
}
}
@@ -1764,7 +1790,16 @@ void tst_QTcpSocket::readyReadSignalsAfterWaitForReadyRead()
QCOMPARE(readyReadSpy.count(), 1);
QString s = socket->readLine();
- QCOMPARE(s.toLatin1().constData(), "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+#ifdef TEST_QNETWORK_PROXY
+ QNetworkProxy::ProxyType proxyType = QNetworkProxy::applicationProxy().type();
+ if(proxyType == QNetworkProxy::NoProxy) {
+ QCOMPARE(s.toLatin1().constData(), "* OK [CAPABILITY IMAP4REV1] aspiriniks Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ } else {
+ QCOMPARE(s.toLatin1().constData(), "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] aspiriniks Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ }
+#else
+ QCOMPARE(s.toLatin1().constData(), QtNetworkSettings::expectedReplyIMAP().constData());
+#endif
QCOMPARE(socket->bytesAvailable(), qint64(0));
QCoreApplication::instance()->processEvents();
@@ -1982,6 +2017,8 @@ void tst_QTcpSocket::suddenRemoteDisconnect()
{
#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS)
QSKIP("stressTest subprocess needs Qt3Support", SkipAll);
+#elif defined( Q_OS_SYMBIAN )
+ QSKIP("Symbian: QProcess IO is not yet supported, fix when supported", SkipAll);
#else
QFETCH(QString, client);
QFETCH(QString, server);
@@ -2200,11 +2237,12 @@ void tst_QTcpSocket::invalidProxy_data()
QTest::newRow("no-such-host-http") << int(QNetworkProxy::HttpProxy)
<< "this-host-will-never-exist.troll.no" << 3128 << false
<< int(QAbstractSocket::ProxyNotFoundError);
-
+#if !defined(Q_OS_SYMBIAN)
QTest::newRow("http-on-socks5") << int(QNetworkProxy::HttpProxy) << fluke << 1080 << false
<< int(QAbstractSocket::ProxyConnectionClosedError);
QTest::newRow("socks5-on-http") << int(QNetworkProxy::Socks5Proxy) << fluke << 3128 << false
<< int(QAbstractSocket::SocketTimeoutError);
+#endif
}
void tst_QTcpSocket::invalidProxy()
@@ -2360,5 +2398,6 @@ void tst_QTcpSocket::proxyFactory()
}
#endif
+
QTEST_MAIN(tst_QTcpSocket)
#include "tst_qtcpsocket.moc"
diff --git a/tests/auto/qtemporaryfile/qtemporaryfile.pro b/tests/auto/qtemporaryfile/qtemporaryfile.pro
index bde990a..c93a2e5 100644
--- a/tests/auto/qtemporaryfile/qtemporaryfile.pro
+++ b/tests/auto/qtemporaryfile/qtemporaryfile.pro
@@ -2,4 +2,11 @@ load(qttest_p4)
SOURCES += tst_qtemporaryfile.cpp
QT = core
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
+
+symbian {
+ testData.sources = tst_qtemporaryfile.cpp
+ testData.path = .
+ DEPLOYMENT += testData
+}else {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
+}
diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
index 8e0c871..1f09183 100644
--- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -59,6 +59,10 @@
# include <unistd.h> // close(2)
#endif
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR ""
+#endif
+
//TESTED_CLASS=
//TESTED_FILES=
@@ -186,7 +190,7 @@ void tst_QTemporaryFile::fileName()
QVERIFY(QFile::exists(fileName));
// Get path to the temp file, whithout the file name.
QString absoluteFilePath = QFileInfo(fileName).absolutePath();
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
absoluteFilePath = absoluteFilePath.toLower();
absoluteTempPath = absoluteTempPath.toLower();
#endif
@@ -341,7 +345,7 @@ void tst_QTemporaryFile::openOnRootDrives()
void tst_QTemporaryFile::stressTest()
{
-#ifdef Q_OS_WINCE
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
// 200 is still ok, first colision happens after ~30
const int iterations = 200;
#else
diff --git a/tests/auto/qtextblock/tst_qtextblock.cpp b/tests/auto/qtextblock/tst_qtextblock.cpp
index 740d2c8..548a568 100644
--- a/tests/auto/qtextblock/tst_qtextblock.cpp
+++ b/tests/auto/qtextblock/tst_qtextblock.cpp
@@ -115,7 +115,7 @@ void tst_QTextBlock::fragmentOverBlockBoundaries()
QVERIFY(doc);
// Block separators are always a fragment of their self. Thus:
// |Hello|\b|World|\b|
-#ifndef Q_WS_WIN
+#if !defined(Q_WS_WIN) && !defined(Q_WS_S60)
QVERIFY(doc->d_func()->fragmentMap().numNodes() == 4);
#endif
diff --git a/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro
index 4d2ff01..cba5a74 100644
--- a/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro
+++ b/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro
@@ -1,9 +1,10 @@
load(qttest_p4)
+QT = core
HEADERS +=
SOURCES += tst_qtextboundaryfinder.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+!symbian:*:DEFINES += SRCDIR=\\\"$$PWD\\\"
-wince*:{
+wince*|symbian*:{
addFiles.sources = data
addFiles.path = .
DEPLOYMENT += addFiles
diff --git a/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp b/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp
index f3828ab..c6dab58 100644
--- a/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp
+++ b/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp
@@ -48,6 +48,9 @@
//TESTED_CLASS=
//TESTED_FILES=gui/text/qtextlayout.h corelib/tools/qtextboundaryfinder.cpp
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR "$$PWD"
+#endif
class tst_QTextBoundaryFinder : public QObject
{
diff --git a/tests/auto/qtextbrowser/qtextbrowser.pro b/tests/auto/qtextbrowser/qtextbrowser.pro
index 6da3bfb..e159a3c 100644
--- a/tests/auto/qtextbrowser/qtextbrowser.pro
+++ b/tests/auto/qtextbrowser/qtextbrowser.pro
@@ -1,11 +1,11 @@
load(qttest_p4)
SOURCES += tst_qtextbrowser.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+!symbian*:DEFINES += SRCDIR=\\\"$$PWD\\\"
contains(QT_CONFIG, qt3support): QT += qt3support
-wince*: {
+wince*|symbian*: {
addFiles.sources = *.html
addFiles.path = .
addDir.sources = subdir/*
diff --git a/tests/auto/qtextbrowser/tst_qtextbrowser.cpp b/tests/auto/qtextbrowser/tst_qtextbrowser.cpp
index b7fefc0..8d8fee1 100644
--- a/tests/auto/qtextbrowser/tst_qtextbrowser.cpp
+++ b/tests/auto/qtextbrowser/tst_qtextbrowser.cpp
@@ -52,6 +52,10 @@
//TESTED_CLASS=
//TESTED_FILES=
+#if defined(Q_OS_SYMBIAN)
+# define SRCDIR ""
+#endif
+
class TestBrowser : public QTextBrowser
{
public:
@@ -545,6 +549,9 @@ void tst_QTextBrowser::focusIndicator()
QVERIFY(browser->textCursor().hasSelection());
QCOMPARE(browser->textCursor().selectedText(), QString("Link to second page"));
+#ifdef QT_KEYPAD_NAVIGATION
+ browser->setEditFocus(true);
+#endif
QTest::keyClick(browser, Qt::Key_Enter);
QVERIFY(!browser->textCursor().hasSelection());
@@ -594,6 +601,9 @@ void tst_QTextBrowser::focusHistory()
QVERIFY(browser->textCursor().hasSelection());
QCOMPARE(browser->textCursor().selectedText(), QString("Link to second page"));
+#ifdef QT_KEYPAD_NAVIGATION
+ browser->setEditFocus(true);
+#endif
QTest::keyClick(browser, Qt::Key_Enter);
QVERIFY(!browser->textCursor().hasSelection());
@@ -650,6 +660,9 @@ void tst_QTextBrowser::urlEncoding()
QSignalSpy spy(browser, SIGNAL(anchorClicked(const QUrl &)));
+#ifdef QT_KEYPAD_NAVIGATION
+ browser->setEditFocus(true);
+#endif
QTest::keyClick(browser, Qt::Key_Enter);
QCOMPARE(spy.count(), 1);
diff --git a/tests/auto/qtextcodec/test/test.pro b/tests/auto/qtextcodec/test/test.pro
index 99f94d4..afd7f5e 100644
--- a/tests/auto/qtextcodec/test/test.pro
+++ b/tests/auto/qtextcodec/test/test.pro
@@ -16,12 +16,17 @@ win32: {
TARGET = tst_qtextcodec
}
-wince*: {
+wince*|symbian {
addFiles.sources = ../*.txt
addFiles.path = .
DEPLOYMENT += addFiles
DEPLOYMENT_PLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs
+}
+
+wince*: {
DEFINES += SRCDIR=\\\"\\\"
+}else:symbian {
+ # Symbian can't define SRCDIR meaningfully here
} else {
DEFINES += SRCDIR=\\\"$$PWD/../\\\"
}
diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp
index 7e98a99..7f2eda9 100644
--- a/tests/auto/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp
@@ -45,8 +45,14 @@
#include <qtextcodec.h>
#include <qfile.h>
#include <qtextdocument.h>
+#include <time.h>
#include <qprocess.h>
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR ""
+#endif
+
+
class tst_QTextCodec : public QObject
{
Q_OBJECT
@@ -278,7 +284,7 @@ void tst_QTextCodec::codecForLocale()
QTextCodec *codec = QTextCodec::codecForLocale();
QVERIFY(codec != 0);
-#ifdef Q_OS_UNIX
+#if defined(Q_OS_UNIX)
// get a time string that is locale-encoded
QByteArray originalLocaleEncodedTimeString;
originalLocaleEncodedTimeString.resize(1024);
@@ -310,7 +316,6 @@ void tst_QTextCodec::codecForLocale()
}
if (!codec2) {
QSKIP("Could not find a codec that is not already the codecForLocale()", SkipAll);
- return;
}
// set it, codecForLocale() should return it now
@@ -1685,6 +1690,7 @@ void tst_QTextCodec::utfHeaders_data()
<< (QString(QChar(0xfeff)) + QString::fromLatin1("hel"))
<< true;
+
QTest::newRow("utf32 bom be")
<< QByteArray("UTF-32")
<< 0
diff --git a/tests/auto/qtextedit/qtextedit.pro b/tests/auto/qtextedit/qtextedit.pro
index 142dd47..02f5dcb 100644
--- a/tests/auto/qtextedit/qtextedit.pro
+++ b/tests/auto/qtextedit/qtextedit.pro
@@ -5,12 +5,15 @@ INCLUDEPATH += ../
HEADERS +=
SOURCES += tst_qtextedit.cpp
-wince* {
- DEFINES += SRCDIR=\\\"./\\\"
+wince*|symbian*: {
addImages.sources = fullWidthSelection/*
addImages.path = fullWidthSelection
DEPLOYMENT += addImages
-} else {
+}
+
+wince* {
+ DEFINES += SRCDIR=\\\"./\\\"
+} !symbian {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qtextedit/tst_qtextedit.cpp b/tests/auto/qtextedit/tst_qtextedit.cpp
index 337cc43..b89d919 100644
--- a/tests/auto/qtextedit/tst_qtextedit.cpp
+++ b/tests/auto/qtextedit/tst_qtextedit.cpp
@@ -73,6 +73,11 @@ Q_DECLARE_METATYPE(QList<bool>);
#include <Carbon/Carbon.h>
#endif
+#if defined(Q_OS_SYMBIAN)
+# define SRCDIR ""
+#undef QT3_SUPPORT
+#endif
+
bool nativeClipboardWorking()
{
@@ -110,13 +115,17 @@ private slots:
void autoBulletList1();
void autoBulletList2();
void preserveCharFormatAfterNewline();
+#ifndef QT_NO_CLIPBOARD
void clearMustNotChangeClipboard();
+#endif
void clearMustNotResetRootFrameMarginToDefault();
void clearShouldPreserveTheCurrentCharFormat();
void clearShouldClearExtraSelections();
void paragSeparatorOnPlaintextAppend();
void layoutingLoop();
+#ifndef QT_NO_CLIPBOARD
void selectAllSetsNotSelection();
+#endif
void asciiTab();
void setDocument();
void setDocument_shared();
@@ -129,7 +138,9 @@ private slots:
#endif
void cursorPositionChanged();
void setTextCursor();
+#ifndef QT_NO_CLIPBOARD
void undoAvailableAfterPaste();
+#endif
void undoRedoAvailableRepetition();
void appendShouldUseCurrentFormat();
void appendShouldNotTouchTheSelection();
@@ -137,7 +148,9 @@ private slots:
void shiftBackspace();
void undoRedo();
void preserveCharFormatInAppend();
+#ifndef QT_NO_CLIPBOARD
void copyAndSelectAllInReadonly();
+#endif
void ctrlAltInput();
void noPropertiesOnDefaultTextEditCharFormat();
void setPlainTextShouldUseCurrentCharFormat();
@@ -152,14 +165,18 @@ private slots:
void undoRedoAfterSetContent();
void numPadKeyNavigation();
void moveCursor();
+#ifndef QT_NO_CLIPBOARD
void mimeDataReimplementations();
+#endif
void ctrlEnterShouldInsertLineSeparator_NOT();
void shiftEnterShouldInsertLineSeparator();
void selectWordsFromStringsContainingSeparators_data();
void selectWordsFromStringsContainingSeparators();
+#ifndef QT_NO_CLIPBOARD
void canPaste();
void copyAvailable_data();
void copyAvailable();
+#endif
void ensureCursorVisibleOnInitialShow();
void setHtmlInsideResizeEvent();
void colorfulAppend();
@@ -471,6 +488,7 @@ void tst_QTextEdit::createSelection()
QCOMPARE(ed->textCursor().position(), 11);
}
+#ifndef QT_NO_CLIPBOARD
void tst_QTextEdit::clearMustNotChangeClipboard()
{
if (!nativeClipboardWorking())
@@ -481,6 +499,7 @@ void tst_QTextEdit::clearMustNotChangeClipboard()
ed->clear();
QCOMPARE(QApplication::clipboard()->text(), txt);
}
+#endif
void tst_QTextEdit::clearMustNotResetRootFrameMarginToDefault()
{
@@ -544,6 +563,7 @@ void tst_QTextEdit::layoutingLoop()
QVERIFY(callsToSetPageSize < 10);
}
+#ifndef QT_NO_CLIPBOARD
void tst_QTextEdit::selectAllSetsNotSelection()
{
if (!QApplication::clipboard()->supportsSelection()) {
@@ -559,7 +579,7 @@ void tst_QTextEdit::selectAllSetsNotSelection()
QCOMPARE(QApplication::clipboard()->text(QClipboard::Selection), QString::fromAscii("foobar"));
}
-
+#endif
void tst_QTextEdit::asciiTab()
{
QTextEdit edit;
@@ -569,6 +589,7 @@ void tst_QTextEdit::asciiTab()
QCOMPARE(edit.toPlainText().at(0), QChar('\t'));
}
+
void tst_QTextEdit::setDocument()
{
QTextDocument *document = new QTextDocument(ed);
@@ -769,6 +790,7 @@ void tst_QTextEdit::setTextCursor()
QCOMPARE(spy.count(), 1);
}
+#ifndef QT_NO_CLIPBOARD
void tst_QTextEdit::undoAvailableAfterPaste()
{
if (!nativeClipboardWorking())
@@ -782,6 +804,7 @@ void tst_QTextEdit::undoAvailableAfterPaste()
QVERIFY(spy.count() >= 1);
QCOMPARE(ed->toPlainText(), txt);
}
+#endif
class UndoRedoRecorder : public QObject
{
@@ -988,6 +1011,7 @@ void tst_QTextEdit::preserveCharFormatInAppend()
QCOMPARE(cursor.block().text(), QString("third para"));
}
+#ifndef QT_NO_CLIPBOARD
void tst_QTextEdit::copyAndSelectAllInReadonly()
{
if (!nativeClipboardWorking())
@@ -1018,6 +1042,7 @@ void tst_QTextEdit::copyAndSelectAllInReadonly()
QTest::keyClick(ed, Qt::Key_C, Qt::ControlModifier);
QCOMPARE(QApplication::clipboard()->text(), QString("Hello World"));
}
+#endif
void tst_QTextEdit::ctrlAltInput()
{
@@ -1257,6 +1282,7 @@ void tst_QTextEdit::implicitClear()
QVERIFY(ed->toPlainText().isEmpty());
}
+#ifndef QT_NO_CLIPBOARD
void tst_QTextEdit::copyAvailable_data()
{
QTest::addColumn<pairListType>("keystrokes");
@@ -1374,6 +1400,7 @@ void tst_QTextEdit::copyAvailable()
QVERIFY2(variantSpyCopyAvailable.toBool() == copyAvailable.at(i), QString("Spied singnal: %1").arg(i).toLatin1());
}
}
+#endif
void tst_QTextEdit::undoRedoAfterSetContent()
{
@@ -1439,6 +1466,7 @@ public:
};
+#ifndef QT_NO_CLIPBOARD
void tst_QTextEdit::mimeDataReimplementations()
{
MyTextEdit ed;
@@ -1477,6 +1505,7 @@ void tst_QTextEdit::mimeDataReimplementations()
QCOMPARE(ed.insertCallCount, 1);
#endif
}
+#endif
void tst_QTextEdit::ctrlEnterShouldInsertLineSeparator_NOT()
{
@@ -1528,6 +1557,7 @@ void tst_QTextEdit::selectWordsFromStringsContainingSeparators()
cursor.clearSelection();
}
+#ifndef QT_NO_CLIPBOARD
void tst_QTextEdit::canPaste()
{
if (!nativeClipboardWorking())
@@ -1540,6 +1570,7 @@ void tst_QTextEdit::canPaste()
ed->setTextInteractionFlags(Qt::NoTextInteraction);
QVERIFY(!ed->canPaste());
}
+#endif
void tst_QTextEdit::ensureCursorVisibleOnInitialShow()
{
@@ -1886,7 +1917,7 @@ void tst_QTextEdit::setText()
}
QT_BEGIN_NAMESPACE
-extern Q_GUI_EXPORT bool qt_enable_test_font;
+extern void qt_setQtEnableTestFont(bool value);
QT_END_NAMESPACE
void tst_QTextEdit::fullWidthSelection_data()
@@ -1933,7 +1964,7 @@ void tst_QTextEdit::fullWidthSelection()
cursor.setBlockFormat(bf1);
// use the test font so we always know where stuff will end up.
- qt_enable_test_font = true;
+ qt_setQtEnableTestFont(true);
QFont testFont;
testFont.setFamily("__Qt__Box__Engine__");
testFont.setPixelSize(12);
@@ -1981,7 +2012,7 @@ void tst_QTextEdit::fullWidthSelection2()
QTextCursor cursor = widget.textCursor();
// use the test font so we always know where stuff will end up.
- qt_enable_test_font = true;
+ qt_setQtEnableTestFont(true);
QFont testFont;
testFont.setFamily("__Qt__Box__Engine__");
testFont.setPixelSize(12);
diff --git a/tests/auto/qtextlayout/qtextlayout.pro b/tests/auto/qtextlayout/qtextlayout.pro
index 2da4d8a..381f09e 100644
--- a/tests/auto/qtextlayout/qtextlayout.pro
+++ b/tests/auto/qtextlayout/qtextlayout.pro
@@ -3,4 +3,7 @@ HEADERS +=
SOURCES += tst_qtextlayout.cpp
INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/harfbuzz/src
+symbian {
+ TARGET.EPOCHEAPSIZE = 100000 20000000
+}
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index 2e6b8e2..443eacc 100644
--- a/tests/auto/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp
@@ -57,8 +57,6 @@
#define TESTFONT_SIZE 12
-
-
//TESTED_CLASS=
//TESTED_FILES=
@@ -164,12 +162,12 @@ void tst_QTextLayout::getSetCheck()
}
QT_BEGIN_NAMESPACE
-extern Q_GUI_EXPORT bool qt_enable_test_font;
+extern void qt_setQtEnableTestFont(bool value);
QT_END_NAMESPACE
tst_QTextLayout::tst_QTextLayout()
{
- qt_enable_test_font = true;
+ qt_setQtEnableTestFont(true);
}
tst_QTextLayout::~tst_QTextLayout()
diff --git a/tests/auto/qtextodfwriter/qtextodfwriter.pro b/tests/auto/qtextodfwriter/qtextodfwriter.pro
index 3c40d67..f5e2c09 100644
--- a/tests/auto/qtextodfwriter/qtextodfwriter.pro
+++ b/tests/auto/qtextodfwriter/qtextodfwriter.pro
@@ -1,5 +1,5 @@
load(qttest_p4)
SOURCES += tst_qtextodfwriter.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
+!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\"
+symbian:INCLUDEPATH+=$$[QT_INSTALL_PREFIX]/include/QtGui/private
diff --git a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp
index c7242ca..d674e70 100644
--- a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp
+++ b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp
@@ -47,6 +47,10 @@
#include <QBuffer>
#include <QDebug>
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR "."
+#endif
+
#include <private/qtextodfwriter_p.h>
class tst_QTextOdfWriter : public QObject
diff --git a/tests/auto/qtextstream/test/test.pro b/tests/auto/qtextstream/test/test.pro
index bae7717..9f117d5 100644
--- a/tests/auto/qtextstream/test/test.pro
+++ b/tests/auto/qtextstream/test/test.pro
@@ -17,15 +17,24 @@ contains(QT_CONFIG, qt3support):QT += qt3support
QT = core network
-wince*: {
+wince*|symbian: {
addFiles.sources = ../rfc3261.txt ../shift-jis.txt ../task113817.txt ../qtextstream.qrc ../tst_qtextstream.cpp
addFiles.path = .
res.sources = ../resources
res.path = .
DEPLOYMENT += addFiles
- DEFINES += SRCDIR=\\\"\\\"
-} else {
- DEFINES += SRCDIR=\\\"$$PWD/../\\\"
+}
+
+wince*: {
+ DEFINES += SRCDIR=\\\"\\\"
+}else:symbian {
+ load(data_caging_paths)
+ # Symbian can't define SRCDIR meaningfully here
+ codecs_plugins.sources = qcncodecs.dll qjpcodecs.dll qtwcodecs.dll qkrcodecs.dll
+ codecs_plugins.path = $$QT_PLUGINS_BASE_DIR/codecs
+ DEPLOYMENT += codecs_plugins
+}else {
+ DEFINES += SRCDIR=\\\"$$PWD/../\\\"
}
diff --git a/tests/auto/qtextstream/tst_qtextstream.cpp b/tests/auto/qtextstream/tst_qtextstream.cpp
index 23bdd27..3c4820d 100644
--- a/tests/auto/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/qtextstream/tst_qtextstream.cpp
@@ -41,7 +41,7 @@
/*-*-encoding:latin1-*-*/
-#include <iostream>
+//#include <iostream>
//using namespace std;
#include <QtTest/QtTest>
@@ -76,6 +76,10 @@ QT_END_NAMESPACE
//TESTED_CLASS=
//TESTED_FILES=
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR ""
+#endif
+
class tst_QTextStream : public QObject
{
Q_OBJECT
@@ -469,6 +473,8 @@ tst_QTextStream::tst_QTextStream()
inBuffer = 0;
inString = 0;
file_is_empty = FALSE;
+
+ Q_SET_DEFAULT_IAP
}
tst_QTextStream::~tst_QTextStream()
@@ -1247,7 +1253,13 @@ void tst_QTextStream::stillOpenWhenAtEnd()
#endif
QTcpSocket socket;
socket.connectToHost(QtNetworkSettings::serverName(), 143);
+#if defined(Q_OS_SYMBIAN)
+ // This number is determined in an arbitrary way; whatever it takes
+ // to make the test pass.
+ QVERIFY(socket.waitForReadyRead(30000));
+#else
QVERIFY(socket.waitForReadyRead(5000));
+#endif
QTextStream stream2(&socket);
while (!stream2.readLine().isNull()) {}
@@ -1490,8 +1502,8 @@ void tst_QTextStream::pos2()
// ------------------------------------------------------------------------------
void tst_QTextStream::readStdin()
{
-#ifdef Q_OS_WINCE
- QSKIP("Qt/CE has no stdin/out", SkipAll);
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+ QSKIP("Qt/CE and Symbian have no stdin/out support for processes", SkipAll);
#endif
QProcess stdinProcess;
stdinProcess.start("stdinProcess/stdinProcess");
@@ -1516,8 +1528,8 @@ void tst_QTextStream::readStdin()
// ------------------------------------------------------------------------------
void tst_QTextStream::readAllFromStdin()
{
-#ifdef Q_OS_WINCE
- QSKIP("Qt/CE has no stdin/out", SkipAll);
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+ QSKIP("Qt/CE and Symbian have no stdin/out support for processes", SkipAll);
#endif
QProcess stdinProcess;
stdinProcess.start("readAllStdinProcess/readAllStdinProcess", QIODevice::ReadWrite | QIODevice::Text);
@@ -1537,8 +1549,8 @@ void tst_QTextStream::readAllFromStdin()
// ------------------------------------------------------------------------------
void tst_QTextStream::readLineFromStdin()
{
-#ifdef Q_OS_WINCE
- QSKIP("Qt/CE has no stdin/out", SkipAll);
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+ QSKIP("Qt/CE and Symbian have no stdin/out support for processes", SkipAll);
#endif
QProcess stdinProcess;
stdinProcess.start("readLineStdinProcess/readLineStdinProcess", QIODevice::ReadWrite | QIODevice::Text);
@@ -4298,7 +4310,7 @@ void tst_QTextStream::int_write_with_locale()
// like QTEST_APPLESS_MAIN, but initialising the locale on Unix
int main(int argc, char *argv[])
{
-#ifdef Q_OS_UNIX
+#if defined (Q_OS_UNIX) && !defined (Q_OS_SYMBIAN)
extern bool qt_locale_initialized;
::setlocale(LC_ALL, "");
qt_locale_initialized = true;
diff --git a/tests/auto/qthread/qthread.pro b/tests/auto/qthread/qthread.pro
index c4d4f2a..4ea8fe5 100644
--- a/tests/auto/qthread/qthread.pro
+++ b/tests/auto/qthread/qthread.pro
@@ -1,5 +1,4 @@
load(qttest_p4)
SOURCES += tst_qthread.cpp
QT = core
-
-
+symbian*:LIBS += -llibpthread
diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp
index c6a7a8b..796c7e7 100644
--- a/tests/auto/qthread/tst_qthread.cpp
+++ b/tests/auto/qthread/tst_qthread.cpp
@@ -892,7 +892,7 @@ void tst_QThread::stressTest()
while (t.elapsed() < one_minute) {
Current_Thread t;
t.start();
- t.wait();
+ t.wait(one_minute);
}
}
diff --git a/tests/auto/qthreadstorage/qthreadstorage.pro b/tests/auto/qthreadstorage/qthreadstorage.pro
index f4f5700..376ba65 100644
--- a/tests/auto/qthreadstorage/qthreadstorage.pro
+++ b/tests/auto/qthreadstorage/qthreadstorage.pro
@@ -1,5 +1,4 @@
load(qttest_p4)
SOURCES += tst_qthreadstorage.cpp
QT = core
-
-
+symbian*:LIBS += -llibpthread
diff --git a/tests/auto/qtime/qtime.pro b/tests/auto/qtime/qtime.pro
index 93fc74c..88277a0 100644
--- a/tests/auto/qtime/qtime.pro
+++ b/tests/auto/qtime/qtime.pro
@@ -1,6 +1,3 @@
load(qttest_p4)
-
SOURCES += tst_qtime.cpp
QT = core
-
-
diff --git a/tests/auto/qtimeline/qtimeline.pro b/tests/auto/qtimeline/qtimeline.pro
index 57d67a8..7820455 100644
--- a/tests/auto/qtimeline/qtimeline.pro
+++ b/tests/auto/qtimeline/qtimeline.pro
@@ -1,5 +1,4 @@
load(qttest_p4)
QT = core
SOURCES += tst_qtimeline.cpp
-
-
+QT = core
diff --git a/tests/auto/qtimer/qtimer.pro b/tests/auto/qtimer/qtimer.pro
index a16035f..79ae7db 100644
--- a/tests/auto/qtimer/qtimer.pro
+++ b/tests/auto/qtimer/qtimer.pro
@@ -1,5 +1,4 @@
load(qttest_p4)
QT = core
SOURCES += tst_qtimer.cpp
-
-
+QT = core
diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp
index e3e28b5..24e617f 100644
--- a/tests/auto/qtimer/tst_qtimer.cpp
+++ b/tests/auto/qtimer/tst_qtimer.cpp
@@ -85,6 +85,8 @@ private slots:
void deleteLaterOnQTimer(); // long name, don't want to shadow QObject::deleteLater()
void moveToThread();
void restartedTimerFiresTooSoon();
+ void timerFiresOnlyOncePerProcessEvents_data();
+ void timerFiresOnlyOncePerProcessEvents();
};
class TimerHelper : public QObject
@@ -159,6 +161,13 @@ void tst_QTimer::singleShotTimeout()
QCOMPARE(helper.count, 1);
}
+#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
+// Increase wait as emulator startup can cause unexpected delays
+#define TIMEOUT_TIMEOUT 2000
+#else
+#define TIMEOUT_TIMEOUT 200
+#endif
+
void tst_QTimer::timeout()
{
TimerHelper helper;
@@ -169,11 +178,11 @@ void tst_QTimer::timeout()
QCOMPARE(helper.count, 0);
- QTest::qWait(200);
+ QTest::qWait(TIMEOUT_TIMEOUT);
QVERIFY(helper.count > 0);
int oldCount = helper.count;
- QTest::qWait(200);
+ QTest::qWait(TIMEOUT_TIMEOUT);
QVERIFY(helper.count > oldCount);
}
@@ -263,7 +272,7 @@ void tst_QTimer::livelock()
#if defined(Q_OS_MAC)
QEXPECT_FAIL("zero timer", "Posted events source are handled AFTER timers", Continue);
QEXPECT_FAIL("non-zero timer", "Posted events source are handled AFTER timers", Continue);
-#elif defined(Q_OS_UNIX)
+#elif defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
QEXPECT_FAIL("zero timer", "", Continue);
QEXPECT_FAIL("non-zero timer", "", Continue);
#elif defined(Q_OS_WIN)
@@ -404,29 +413,38 @@ void tst_QTimer::deleteLaterOnQTimer()
QVERIFY(pointer.isNull());
}
+#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
+// Increase wait as emulator startup can cause unexpected delays
+#define MOVETOTHREAD_TIMEOUT 200
+#define MOVETOTHREAD_WAIT 5000
+#else
+#define MOVETOTHREAD_TIMEOUT 200
+#define MOVETOTHREAD_WAIT 300
+#endif
+
void tst_QTimer::moveToThread()
{
QTimer ti1;
QTimer ti2;
- ti1.start(200);
- ti2.start(200);
+ ti1.start(MOVETOTHREAD_TIMEOUT);
+ ti2.start(MOVETOTHREAD_TIMEOUT);
QVERIFY((ti1.timerId() & 0xffffff) != (ti2.timerId() & 0xffffff));
QThread tr;
ti1.moveToThread(&tr);
connect(&ti1,SIGNAL(timeout()), &tr, SLOT(quit()));
tr.start();
QTimer ti3;
- ti3.start(200);
+ ti3.start(MOVETOTHREAD_TIMEOUT);
QVERIFY((ti3.timerId() & 0xffffff) != (ti2.timerId() & 0xffffff));
QVERIFY((ti3.timerId() & 0xffffff) != (ti1.timerId() & 0xffffff));
- QTest::qWait(300);
+ QTest::qWait(MOVETOTHREAD_WAIT);
QVERIFY(tr.wait());
ti2.stop();
QTimer ti4;
- ti4.start(200);
+ ti4.start(MOVETOTHREAD_TIMEOUT);
ti3.stop();
- ti2.start(200);
- ti3.start(200);
+ ti2.start(MOVETOTHREAD_TIMEOUT);
+ ti3.start(MOVETOTHREAD_TIMEOUT);
QVERIFY((ti4.timerId() & 0xffffff) != (ti2.timerId() & 0xffffff));
QVERIFY((ti3.timerId() & 0xffffff) != (ti2.timerId() & 0xffffff));
QVERIFY((ti3.timerId() & 0xffffff) != (ti1.timerId() & 0xffffff));
@@ -495,5 +513,54 @@ void tst_QTimer::restartedTimerFiresTooSoon()
QVERIFY(object.eventLoop.exec() == 0);
}
+class LongLastingSlotClass : public QObject
+{
+ Q_OBJECT
+
+public:
+ LongLastingSlotClass(QTimer *timer) : count(0), timer(timer) {}
+
+public slots:
+ void longLastingSlot()
+ {
+ // Don't use timers for this, because we are testing them.
+ QTime time;
+ time.start();
+ while (time.elapsed() < 200) {
+ for (int c = 0; c < 100000; c++) {} // Mindless looping.
+ }
+ if (++count >= 2) {
+ timer->stop();
+ }
+ }
+
+public:
+ int count;
+ QTimer *timer;
+};
+
+void tst_QTimer::timerFiresOnlyOncePerProcessEvents_data()
+{
+ QTest::addColumn<int>("interval");
+ QTest::newRow("zero timer") << 0;
+ QTest::newRow("non-zero timer") << 10;
+}
+
+void tst_QTimer::timerFiresOnlyOncePerProcessEvents()
+{
+ QFETCH(int, interval);
+
+ QTimer t;
+ LongLastingSlotClass longSlot(&t);
+ t.start(interval);
+ connect(&t, SIGNAL(timeout()), &longSlot, SLOT(longLastingSlot()));
+ // Loop because there may be other events pending.
+ while (longSlot.count == 0) {
+ QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents);
+ }
+
+ QCOMPARE(longSlot.count, 1);
+}
+
QTEST_MAIN(tst_QTimer)
#include "tst_qtimer.moc"
diff --git a/tests/auto/qtransform/qtransform.pro b/tests/auto/qtransform/qtransform.pro
index 7cba3db..298feb2 100644
--- a/tests/auto/qtransform/qtransform.pro
+++ b/tests/auto/qtransform/qtransform.pro
@@ -2,6 +2,6 @@ load(qttest_p4)
HEADERS +=
SOURCES += tst_qtransform.cpp
-unix:!mac:LIBS+=-lm
+unix:!mac:!symbian*:LIBS+=-lm
diff --git a/tests/auto/qtransformedscreen/qtransformedscreen.pro b/tests/auto/qtransformedscreen/qtransformedscreen.pro
index 6914054..39e3700 100644
--- a/tests/auto/qtransformedscreen/qtransformedscreen.pro
+++ b/tests/auto/qtransformedscreen/qtransformedscreen.pro
@@ -1,5 +1,6 @@
load(qttest_p4)
SOURCES += tst_qtransformedscreen.cpp
+QT = core
embedded:!contains(gfx-drivers, transformed) {
LIBS += ../../../plugins/gfxdrivers/libqgfxtransformed.so
diff --git a/tests/auto/qtranslator/qtranslator.pro b/tests/auto/qtranslator/qtranslator.pro
index 0d67f70..30ffc1c 100644
--- a/tests/auto/qtranslator/qtranslator.pro
+++ b/tests/auto/qtranslator/qtranslator.pro
@@ -2,7 +2,7 @@ load(qttest_p4)
SOURCES += tst_qtranslator.cpp
-wince*: {
+wince*|symbian*: {
addFiles.sources = hellotr_la.qm msgfmt_from_po.qm
addFiles.path = .
DEPLOYMENT += addFiles
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index 123ce60..d28c3c3 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -51,7 +51,9 @@
//TESTED_FILES=
Q_DECLARE_METATYPE(QModelIndex)
+#ifndef QT_NO_DRAGANDDROP
Q_DECLARE_METATYPE(QAbstractItemView::DragDropMode)
+#endif
Q_DECLARE_METATYPE(QAbstractItemView::EditTriggers)
Q_DECLARE_METATYPE(QAbstractItemView::EditTrigger)
@@ -137,11 +139,13 @@ private slots:
void alternatingRowColors();
void currentIndex_data();
void currentIndex();
+#ifndef QT_NO_DRAGANDDROP
void dragDropMode_data();
void dragDropMode();
void dragDropModeFromDragEnabledAndAcceptDrops_data();
void dragDropModeFromDragEnabledAndAcceptDrops();
void dragDropOverwriteMode();
+#endif
void editTriggers_data();
void editTriggers();
void hasAutoScroll();
@@ -468,9 +472,11 @@ void tst_QTreeView::construction()
// QAbstractItemView properties
QVERIFY(!view.alternatingRowColors());
QCOMPARE(view.currentIndex(), QModelIndex());
+#ifndef QT_NO_DRAGANDDROP
QCOMPARE(view.dragDropMode(), QAbstractItemView::NoDragDrop);
QVERIFY(!view.dragDropOverwriteMode());
QVERIFY(!view.dragEnabled());
+#endif
QCOMPARE(view.editTriggers(), QAbstractItemView::EditKeyPressed | QAbstractItemView::DoubleClicked);
QVERIFY(view.hasAutoScroll());
QCOMPARE(view.horizontalScrollMode(), QAbstractItemView::ScrollPerPixel);
@@ -489,7 +495,9 @@ void tst_QTreeView::construction()
QCOMPARE(view.selectionBehavior(), QAbstractItemView::SelectRows);
QCOMPARE(view.selectionMode(), QAbstractItemView::SingleSelection);
QVERIFY(!view.selectionModel());
+#ifndef QT_NO_DRAGANDDROP
QVERIFY(view.showDropIndicator());
+#endif
QCOMPARE(view.QAbstractItemView::sizeHintForColumn(-1), -1); // <- protected in QTreeView
QCOMPARE(view.QAbstractItemView::sizeHintForColumn(0), -1); // <- protected in QTreeView
QCOMPARE(view.QAbstractItemView::sizeHintForColumn(1), -1); // <- protected in QTreeView
@@ -596,12 +604,13 @@ void tst_QTreeView::currentIndex()
// ### Test child and grandChild indexes.
}
+#ifndef QT_NO_DRAGANDDROP
+
void tst_QTreeView::dragDropMode_data()
{
QTest::addColumn<QAbstractItemView::DragDropMode>("dragDropMode");
QTest::addColumn<bool>("acceptDrops");
QTest::addColumn<bool>("dragEnabled");
-
QTest::newRow("NoDragDrop") << QAbstractItemView::NoDragDrop << false << false;
QTest::newRow("DragOnly") << QAbstractItemView::DragOnly << false << true;
QTest::newRow("DropOnly") << QAbstractItemView::DropOnly << true << false;
@@ -696,6 +705,7 @@ void tst_QTreeView::dragDropOverwriteMode()
// QTableWidget, from their reimplementations of dropMimeData(). Hard to
// test.
}
+#endif
void tst_QTreeView::editTriggers_data()
{
diff --git a/tests/auto/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp b/tests/auto/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp
index 626751d..47896f6 100644
--- a/tests/auto/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp
+++ b/tests/auto/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp
@@ -925,7 +925,7 @@ void tst_QTreeWidgetItemIterator::iteratorflags()
QFETCH(int, iteratorflags);
QFETCH(QStringList, matches);
- QTreeWidgetItemIterator it(testWidget, (QTreeWidgetItemIterator::IteratorFlags)iteratorflags);
+ QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::IteratorFlags(iteratorflags));
it+=start;
int iMatch = 0;
while (*it && iMatch < matches.count()) {
@@ -1000,7 +1000,7 @@ void tst_QTreeWidgetItemIterator::plus_eq()
QFETCH(int, iteratorflags);
QFETCH(QString, expecteditem);
- QTreeWidgetItemIterator it(testWidget, (QTreeWidgetItemIterator::IteratorFlags)iteratorflags);
+ QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::IteratorFlags(iteratorflags));
it+=start;
it+=addition;
QTreeWidgetItem *item = *it;
@@ -1033,7 +1033,7 @@ void tst_QTreeWidgetItemIterator::minus_eq()
QFETCH(int, iteratorflags);
QFETCH(QString, expecteditem);
- QTreeWidgetItemIterator it(testWidget, (QTreeWidgetItemIterator::IteratorFlags)iteratorflags);
+ QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::IteratorFlags(iteratorflags));
it+=start;
it-=subtraction;
QTreeWidgetItem *item = *it;
@@ -1112,10 +1112,10 @@ void tst_QTreeWidgetItemIterator::updateIfModifiedFromWidget()
}
}
- QTreeWidgetItemIterator it(&tw, (QTreeWidgetItemIterator::IteratorFlags)iteratorflags);
+ QTreeWidgetItemIterator it(&tw, QTreeWidgetItemIterator::IteratorFlags(iteratorflags));
it+=expecteditemindex;
QTreeWidgetItem *item = 0;
- QTreeWidgetItemIterator itRemove(&tw, (QTreeWidgetItemIterator::IteratorFlags)iteratorflags);
+ QTreeWidgetItemIterator itRemove(&tw, QTreeWidgetItemIterator::IteratorFlags(iteratorflags));
itRemove+=removeindex;
item = *itRemove;
QVERIFY(item);
diff --git a/tests/auto/qtwidgets/qtwidgets.pro b/tests/auto/qtwidgets/qtwidgets.pro
index ad5e7ac..b762acb 100644
--- a/tests/auto/qtwidgets/qtwidgets.pro
+++ b/tests/auto/qtwidgets/qtwidgets.pro
@@ -1,4 +1,5 @@
load(qttest_p4)
+symbian*:TARGET.EPOCHEAPSIZE=0x200000 0xa00000
SOURCES += tst_qtwidgets.cpp mainwindow.cpp
HEADERS += mainwindow.h
diff --git a/tests/auto/qtwidgets/tst_qtwidgets.cpp b/tests/auto/qtwidgets/tst_qtwidgets.cpp
index 22240d3..0ccc0aa 100644
--- a/tests/auto/qtwidgets/tst_qtwidgets.cpp
+++ b/tests/auto/qtwidgets/tst_qtwidgets.cpp
@@ -47,15 +47,28 @@
#include "mainwindow.h"
+#include "../network-settings.h"
class tst_QtWidgets: public QObject
{
Q_OBJECT
+public:
+ tst_QtWidgets();
+ virtual ~tst_QtWidgets();
+
private slots:
void snapshot();
};
+tst_QtWidgets::tst_QtWidgets()
+{
+ Q_SET_DEFAULT_IAP
+}
+
+tst_QtWidgets::~tst_QtWidgets()
+{
+}
void tst_QtWidgets::snapshot()
{
diff --git a/tests/auto/qudpsocket/test/test.pro b/tests/auto/qudpsocket/test/test.pro
index 2444dac..2e0a020 100644
--- a/tests/auto/qudpsocket/test/test.pro
+++ b/tests/auto/qudpsocket/test/test.pro
@@ -15,7 +15,7 @@ win32 {
DESTDIR = ../
}
-wince*: {
+wince*|symbian*: {
addApp.sources = ../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 39b2845..8d09924 100644
--- a/tests/auto/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/qudpsocket/tst_qudpsocket.cpp
@@ -105,11 +105,11 @@ protected slots:
tst_QUdpSocket::tst_QUdpSocket()
{
+ Q_SET_DEFAULT_IAP
}
tst_QUdpSocket::~tst_QUdpSocket()
{
-
}
void tst_QUdpSocket::initTestCase_data()
@@ -207,7 +207,7 @@ void tst_QUdpSocket::broadcasting()
#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
- QSKIP("With socks5 Broadcast is not supported.", SkipAll);
+ QSKIP("With socks5 Broadcast is not supported.", SkipSingle);
}
#endif
}
@@ -320,6 +320,9 @@ void tst_QUdpSocket::ipv6Loop_data()
void tst_QUdpSocket::ipv6Loop()
{
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Symbian IPv6 is not yet supported", SkipAll);
+#endif
QFETCH(QByteArray, peterMessage);
QFETCH(QByteArray, paulMessage);
QFETCH(bool, success);
@@ -331,17 +334,17 @@ void tst_QUdpSocket::ipv6Loop()
quint16 paulPort = 28123;
if (!peter.bind(QHostAddress::LocalHostIPv6, peterPort)) {
- QCOMPARE(peter.error(), QUdpSocket::UnsupportedSocketOperationError);
+ QCOMPARE(peter.error(), QUdpSocket::UnsupportedSocketOperationError);
} else {
- QVERIFY(paul.bind(QHostAddress::LocalHostIPv6, paulPort));
+ QVERIFY(paul.bind(QHostAddress::LocalHostIPv6, paulPort));
- QCOMPARE(peter.writeDatagram(peterMessage.data(), peterMessage.length(), QHostAddress("::1"),
+ QCOMPARE(peter.writeDatagram(peterMessage.data(), peterMessage.length(), QHostAddress("::1"),
paulPort), qint64(peterMessage.length()));
- QCOMPARE(paul.writeDatagram(paulMessage.data(), paulMessage.length(),
+ QCOMPARE(paul.writeDatagram(paulMessage.data(), paulMessage.length(),
QHostAddress("::1"), peterPort), qint64(paulMessage.length()));
- char peterBuffer[16*1024];
- char paulBuffer[16*1024];
+ char peterBuffer[16*1024];
+ char paulBuffer[16*1024];
#if !defined(Q_OS_WINCE)
QVERIFY(peter.waitForReadyRead(5000));
QVERIFY(paul.waitForReadyRead(5000));
@@ -349,16 +352,16 @@ void tst_QUdpSocket::ipv6Loop()
QVERIFY(peter.waitForReadyRead(15000));
QVERIFY(paul.waitForReadyRead(15000));
#endif
- if (success) {
- QCOMPARE(peter.readDatagram(peterBuffer, sizeof(peterBuffer)), qint64(paulMessage.length()));
- QCOMPARE(paul.readDatagram(paulBuffer, sizeof(peterBuffer)), qint64(peterMessage.length()));
- } else {
- QVERIFY(peter.readDatagram(peterBuffer, sizeof(peterBuffer)) != paulMessage.length());
- QVERIFY(paul.readDatagram(paulBuffer, sizeof(peterBuffer)) != peterMessage.length());
- }
-
- QCOMPARE(QByteArray(peterBuffer, paulMessage.length()), paulMessage);
- QCOMPARE(QByteArray(paulBuffer, peterMessage.length()), peterMessage);
+ if (success) {
+ QCOMPARE(peter.readDatagram(peterBuffer, sizeof(peterBuffer)), qint64(paulMessage.length()));
+ QCOMPARE(paul.readDatagram(paulBuffer, sizeof(peterBuffer)), qint64(peterMessage.length()));
+ } else {
+ QVERIFY(peter.readDatagram(peterBuffer, sizeof(peterBuffer)) != paulMessage.length());
+ QVERIFY(paul.readDatagram(paulBuffer, sizeof(peterBuffer)) != peterMessage.length());
+ }
+
+ QCOMPARE(QByteArray(peterBuffer, paulMessage.length()), paulMessage);
+ QCOMPARE(QByteArray(paulBuffer, peterMessage.length()), peterMessage);
}
}
@@ -479,6 +482,22 @@ void tst_QUdpSocket::writeDatagram()
void tst_QUdpSocket::performance()
{
+#if defined(Q_OS_SYMBIAN)
+ // Large packets seems not to go through on Symbian
+ // Reason might be also fragmentation due to VPN connection etc
+
+ QFETCH_GLOBAL(bool, setProxy);
+ QFETCH_GLOBAL(int, proxyType);
+
+ int arrSize = 8192;
+ if (setProxy && proxyType == QNetworkProxy::Socks5Proxy)
+ arrSize = 1024;
+
+ QByteArray arr(arrSize, '@');
+#else
+ QByteArray arr(8192, '@');
+#endif // Q_OS_SYMBIAN
+
QUdpSocket server;
QVERIFY2(server.bind(), server.errorString().toLatin1().constData());
@@ -489,8 +508,6 @@ void tst_QUdpSocket::performance()
QUdpSocket client;
client.connectToHost(serverAddress, server.localPort());
- QByteArray arr(8192, '@');
-
QTime stopWatch;
stopWatch.start();
@@ -508,6 +525,14 @@ void tst_QUdpSocket::performance()
float secs = stopWatch.elapsed() / 1000.0;
qDebug("\t%.2fMB/%.2fs: %.2fMB/s", float(nbytes / (1024.0*1024.0)),
secs, float(nbytes / (1024.0*1024.0)) / secs);
+
+#if defined(Q_OS_SYMBIAN)
+ if(nbytes == 0) {
+ qDebug("No bytes passed through local UDP socket, since UDP socket write returns EWOULDBLOCK");
+ qDebug("Should try with blocking sockets, but it is not currently possible due to Open C defect");
+ }
+#endif
+
}
void tst_QUdpSocket::bindMode()
@@ -526,8 +551,47 @@ void tst_QUdpSocket::bindMode()
QVERIFY2(socket.bind(), socket.errorString().toLatin1().constData());
QUdpSocket socket2;
QVERIFY(!socket2.bind(socket.localPort()));
-
-#ifdef Q_OS_UNIX
+#if defined(Q_OS_SYMBIAN)
+ if(RProcess().HasCapability(ECapabilityNetworkControl)) {
+ qDebug("Test executed *with* NetworkControl capability");
+ // In Symbian OS ReuseAddressHint together with NetworkControl capability
+ // gives application *always* right to bind to port. I.e. it does not matter
+ // if first socket was bound with any bind flag. Since autotests in Symbian
+ // are currently executed with ALL -TCB rights, this path is the one executed.
+ QVERIFY(socket2.bind(socket.localPort(), QUdpSocket::ReuseAddressHint));
+ socket.close();
+ socket2.close();
+
+ QVERIFY2(socket.bind(0, QUdpSocket::ShareAddress), socket.errorString().toLatin1().constData());
+ QVERIFY(!socket2.bind(socket.localPort()));
+ QVERIFY2(socket2.bind(socket.localPort(), QUdpSocket::ReuseAddressHint), socket2.errorString().toLatin1().constData());
+ socket.close();
+ socket2.close();
+
+ QVERIFY2(socket.bind(0, QUdpSocket::DontShareAddress), socket.errorString().toLatin1().constData());
+ QVERIFY(!socket2.bind(socket.localPort()));
+ QVERIFY(socket2.bind(socket.localPort(), QUdpSocket::ReuseAddressHint));
+ socket.close();
+ socket2.close();
+ } else {
+ qDebug("Test executed *without* NetworkControl capability");
+ // If we don't have NetworkControl capability, attempt to bind already bound
+ // address will *always* fail. I.e. it does not matter if first socket was
+ // bound with any bind flag.
+ QVERIFY(!socket2.bind(socket.localPort(), QUdpSocket::ReuseAddressHint));
+ socket.close();
+
+ QVERIFY2(socket.bind(0, QUdpSocket::ShareAddress), socket.errorString().toLatin1().constData());
+ QVERIFY(!socket2.bind(socket.localPort()));
+ QVERIFY2(!socket2.bind(socket.localPort(), QUdpSocket::ReuseAddressHint), socket2.errorString().toLatin1().constData());
+ socket.close();
+
+ QVERIFY2(socket.bind(0, QUdpSocket::DontShareAddress), socket.errorString().toLatin1().constData());
+ QVERIFY(!socket2.bind(socket.localPort()));
+ QVERIFY(!socket2.bind(socket.localPort(), QUdpSocket::ReuseAddressHint));
+ socket.close();
+ }
+#elif defined(Q_OS_UNIX)
QVERIFY(!socket2.bind(socket.localPort(), QUdpSocket::ReuseAddressHint));
socket.close();
QVERIFY2(socket.bind(0, QUdpSocket::ShareAddress), socket.errorString().toLatin1().constData());
@@ -535,6 +599,7 @@ void tst_QUdpSocket::bindMode()
socket2.close();
QVERIFY2(socket2.bind(socket.localPort(), QUdpSocket::ReuseAddressHint), socket2.errorString().toLatin1().constData());
#else
+
// Depending on the user's privileges, this or will succeed or
// fail. Admins are allowed to reuse the address, but nobody else.
if (!socket2.bind(socket.localPort(), QUdpSocket::ReuseAddressHint), socket2.errorString().toLatin1().constData())
@@ -554,13 +619,16 @@ void tst_QUdpSocket::writeDatagramToNonExistingPeer_data()
QTest::addColumn<bool>("bind");
QTest::addColumn<QHostAddress>("peerAddress");
QHostAddress localhost(QHostAddress::LocalHost);
+#if !defined(Q_OS_SYMBIAN)
QHostAddress remote = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first();
+#endif
QTest::newRow("localhost-unbound") << false << localhost;
QTest::newRow("localhost-bound") << true << localhost;
-
+#if !defined(Q_OS_SYMBIAN)
QTest::newRow("remote-unbound") << false << remote;
QTest::newRow("remote-bound") << true << remote;
+#endif
}
void tst_QUdpSocket::writeDatagramToNonExistingPeer()
@@ -583,11 +651,14 @@ void tst_QUdpSocket::writeToNonExistingPeer_data()
{
QTest::addColumn<QHostAddress>("peerAddress");
QHostAddress localhost(QHostAddress::LocalHost);
+#if !defined(Q_OS_SYMBIAN)
QHostAddress remote = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first();
-
+#endif
// write (required to be connected)
QTest::newRow("localhost") << localhost;
+#if !defined(Q_OS_SYMBIAN)
QTest::newRow("remote") << remote;
+#endif
}
void tst_QUdpSocket::writeToNonExistingPeer()
@@ -638,8 +709,8 @@ void tst_QUdpSocket::writeToNonExistingPeer()
void tst_QUdpSocket::outOfProcessConnectedClientServerTest()
{
-#if defined(Q_OS_WINCE)
- QSKIP("This test depends on reading data from QProcess (not supported on Qt/WinCE.", SkipAll);
+#if defined(Q_OS_WINCE) || defined (Q_OS_SYMBIAN)
+ QSKIP("This test depends on reading data from QProcess (not supported on Qt/WinCE and Symbian).", SkipAll);
#endif
#if defined(QT_NO_PROCESS)
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
@@ -698,8 +769,8 @@ void tst_QUdpSocket::outOfProcessConnectedClientServerTest()
void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest()
{
-#if defined(Q_OS_WINCE)
- QSKIP("This test depends on reading data from QProcess (not supported on Qt/WinCE.", SkipAll);
+#if defined(Q_OS_WINCE) || defined (Q_OS_SYMBIAN)
+ QSKIP("This test depends on reading data from QProcess (not supported on Qt/WinCE and Symbian).", SkipAll);
#endif
#if defined(QT_NO_PROCESS)
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
diff --git a/tests/auto/qudpsocket/udpServer/udpServer.pro b/tests/auto/qudpsocket/udpServer/udpServer.pro
index f04833c..7438d40 100644
--- a/tests/auto/qudpsocket/udpServer/udpServer.pro
+++ b/tests/auto/qudpsocket/udpServer/udpServer.pro
@@ -3,4 +3,5 @@ QT = core network
CONFIG -= app_bundle
CONFIG += console
+symbian:TARGET.CAPABILITY="ALL -TCB"
diff --git a/tests/auto/qurl/qurl.pro b/tests/auto/qurl/qurl.pro
index c3b1543..72c93bc 100644
--- a/tests/auto/qurl/qurl.pro
+++ b/tests/auto/qurl/qurl.pro
@@ -1,6 +1,3 @@
load(qttest_p4)
SOURCES += tst_qurl.cpp
-
-QT -= gui
-
-
+QT = core
diff --git a/tests/auto/quuid/quuid.pro b/tests/auto/quuid/quuid.pro
index 6f3f9f2..f7608fa 100644
--- a/tests/auto/quuid/quuid.pro
+++ b/tests/auto/quuid/quuid.pro
@@ -1,6 +1,3 @@
load(qttest_p4)
QT = core
SOURCES += tst_quuid.cpp
-
-
-
diff --git a/tests/auto/qvariant/qvariant.pro b/tests/auto/qvariant/qvariant.pro
index 747b6c3..2c9c8d7 100644
--- a/tests/auto/qvariant/qvariant.pro
+++ b/tests/auto/qvariant/qvariant.pro
@@ -1,6 +1,5 @@
load(qttest_p4)
SOURCES += tst_qvariant.cpp
-
QT += network
contains(QT_CONFIG, qt3support): QT += qt3support
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp
index 709cba9..729e29b 100644
--- a/tests/auto/qvariant/tst_qvariant.cpp
+++ b/tests/auto/qvariant/tst_qvariant.cpp
@@ -266,6 +266,7 @@ private slots:
void convertByteArrayToBool() const;
void convertByteArrayToBool_data() const;
void toIntFromQString() const;
+ void toIntFromDouble() const;
void task256984_setValue();
void numericalConvert();
@@ -3052,6 +3053,31 @@ void tst_QVariant::toIntFromQString() const
QVERIFY(ok);
}
+/*!
+ We verify that:
+ 1. Conversion from (64 bit) double to int works (no overflow).
+ 2. Same conversion works for QVariant::convert.
+
+ Rationale: if 2147483630 is set in float and then converted to int,
+ there will be overflow and the result will be -2147483648.
+
+ See task 250267.
+ */
+void tst_QVariant::toIntFromDouble() const
+{
+ double d = 2147483630; // max int 2147483647
+ QVERIFY((int)d == 2147483630);
+
+ QVariant var(d);
+ QVERIFY( var.canConvert( QVariant::Int ) );
+
+ bool ok;
+ int result = var.toInt(&ok);
+
+ QVERIFY( ok == true );
+ QCOMPARE(result, 2147483630);
+}
+
void tst_QVariant::task256984_setValue()
{
QTransform t; //we just take a value so that we're sure that it will be shared
diff --git a/tests/auto/qvarlengtharray/qvarlengtharray.pro b/tests/auto/qvarlengtharray/qvarlengtharray.pro
index 20bf7b7..7a02790 100644
--- a/tests/auto/qvarlengtharray/qvarlengtharray.pro
+++ b/tests/auto/qvarlengtharray/qvarlengtharray.pro
@@ -1,5 +1,4 @@
load(qttest_p4)
QT = core
SOURCES += tst_qvarlengtharray.cpp
-
-
+QT = core
diff --git a/tests/auto/qvector/qvector.pro b/tests/auto/qvector/qvector.pro
index df3ee2d..80311b4 100644
--- a/tests/auto/qvector/qvector.pro
+++ b/tests/auto/qvector/qvector.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qvector.cpp
-
-
-
+QT = core
diff --git a/tests/auto/qwaitcondition/tst_qwaitcondition.cpp b/tests/auto/qwaitcondition/tst_qwaitcondition.cpp
index 87a895a..7d7fb2d 100644
--- a/tests/auto/qwaitcondition/tst_qwaitcondition.cpp
+++ b/tests/auto/qwaitcondition/tst_qwaitcondition.cpp
@@ -47,6 +47,12 @@
#include <qthread.h>
#include <qwaitcondition.h>
+#if defined(Q_OS_SYMBIAN)
+// Symbian Open C has a bug that causes very short waits to fail sometimes
+#define COND_WAIT_TIME 50
+#else
+#define COND_WAIT_TIME 1
+#endif
//TESTED_CLASS=
@@ -92,10 +98,10 @@ public:
void run()
{
- mutex.lock();
- cond.wakeOne();
- cond.wait(&mutex);
- mutex.unlock();
+ mutex.lock();
+ cond.wakeOne();
+ cond.wait(&mutex);
+ mutex.unlock();
}
};
@@ -108,15 +114,15 @@ public:
QWaitCondition *cond;
inline wait_QMutex_Thread_2()
- : mutex(0), cond(0)
+ : mutex(0), cond(0)
{ }
void run()
{
- mutex->lock();
- started.wakeOne();
- cond->wait(mutex);
- mutex->unlock();
+ mutex->lock();
+ started.wakeOne();
+ cond->wait(mutex);
+ mutex->unlock();
}
};
@@ -131,10 +137,10 @@ public:
void run()
{
- readWriteLock.lockForWrite();
- cond.wakeOne();
- cond.wait(&readWriteLock);
- readWriteLock.unlock();
+ readWriteLock.lockForWrite();
+ cond.wakeOne();
+ cond.wait(&readWriteLock);
+ readWriteLock.unlock();
}
};
@@ -147,15 +153,15 @@ public:
QWaitCondition *cond;
inline wait_QReadWriteLock_Thread_2()
- : readWriteLock(0), cond(0)
+ : readWriteLock(0), cond(0)
{ }
void run()
{
- readWriteLock->lockForRead();
- started.wakeOne();
- cond->wait(readWriteLock);
- readWriteLock->unlock();
+ readWriteLock->lockForRead();
+ started.wakeOne();
+ cond->wait(readWriteLock);
+ readWriteLock->unlock();
}
};
@@ -163,79 +169,79 @@ void tst_QWaitCondition::wait_QMutex()
{
int x;
for (int i = 0; i < iterations; ++i) {
- {
- QMutex mutex;
- QWaitCondition cond;
-
- mutex.lock();
-
- cond.wakeOne();
- QVERIFY(!cond.wait(&mutex, 1));
-
- cond.wakeAll();
- QVERIFY(!cond.wait(&mutex, 1));
-
- mutex.unlock();
- }
-
- {
- // test multiple threads waiting on separate wait conditions
- wait_QMutex_Thread_1 thread[ThreadCount];
-
- for (x = 0; x < ThreadCount; ++x) {
- thread[x].mutex.lock();
- thread[x].start();
- // wait for thread to start
- QVERIFY(thread[x].cond.wait(&thread[x].mutex, 1000));
- thread[x].mutex.unlock();
- }
-
- for (x = 0; x < ThreadCount; ++x) {
- QVERIFY(thread[x].isRunning());
- QVERIFY(!thread[x].isFinished());
- }
-
- for (x = 0; x < ThreadCount; ++x) {
- thread[x].mutex.lock();
- thread[x].cond.wakeOne();
- thread[x].mutex.unlock();
- }
-
- for (x = 0; x < ThreadCount; ++x) {
- QVERIFY(thread[x].wait(1000));
- }
- }
-
- {
- // test multiple threads waiting on a wait condition
- QMutex mutex;
- QWaitCondition cond1, cond2;
- wait_QMutex_Thread_2 thread[ThreadCount];
-
- mutex.lock();
- for (x = 0; x < ThreadCount; ++x) {
- thread[x].mutex = &mutex;
- thread[x].cond = (x < ThreadCount / 2) ? &cond1 : &cond2;
- thread[x].start();
- // wait for thread to start
- QVERIFY(thread[x].started.wait(&mutex, 1000));
- }
- mutex.unlock();
-
- for (x = 0; x < ThreadCount; ++x) {
- QVERIFY(thread[x].isRunning());
- QVERIFY(!thread[x].isFinished());
- }
-
- mutex.lock();
- cond1.wakeAll();
- cond2.wakeAll();
- mutex.unlock();
-
- for (x = 0; x < ThreadCount; ++x) {
- QVERIFY(thread[x].wait(1000));
- }
- }
+ {
+ QMutex mutex;
+ QWaitCondition cond;
+
+ mutex.lock();
+
+ cond.wakeOne();
+ QVERIFY(!cond.wait(&mutex, 1));
+
+ cond.wakeAll();
+ QVERIFY(!cond.wait(&mutex, 1));
+
+ mutex.unlock();
+ }
+
+ {
+ // test multiple threads waiting on separate wait conditions
+ wait_QMutex_Thread_1 thread[ThreadCount];
+
+ for (x = 0; x < ThreadCount; ++x) {
+ thread[x].mutex.lock();
+ thread[x].start();
+ // wait for thread to start
+ QVERIFY(thread[x].cond.wait(&thread[x].mutex, 1000));
+ thread[x].mutex.unlock();
+ }
+
+ for (x = 0; x < ThreadCount; ++x) {
+ QVERIFY(thread[x].isRunning());
+ QVERIFY(!thread[x].isFinished());
+ }
+
+ for (x = 0; x < ThreadCount; ++x) {
+ thread[x].mutex.lock();
+ thread[x].cond.wakeOne();
+ thread[x].mutex.unlock();
+ }
+
+ for (x = 0; x < ThreadCount; ++x) {
+ QVERIFY(thread[x].wait(1000));
+ }
+ }
+
+ {
+ // test multiple threads waiting on a wait condition
+ QMutex mutex;
+ QWaitCondition cond1, cond2;
+ wait_QMutex_Thread_2 thread[ThreadCount];
+
+ mutex.lock();
+ for (x = 0; x < ThreadCount; ++x) {
+ thread[x].mutex = &mutex;
+ thread[x].cond = (x < ThreadCount / 2) ? &cond1 : &cond2;
+ thread[x].start();
+ // wait for thread to start
+ QVERIFY(thread[x].started.wait(&mutex, 1000));
+ }
+ mutex.unlock();
+
+ for (x = 0; x < ThreadCount; ++x) {
+ QVERIFY(thread[x].isRunning());
+ QVERIFY(!thread[x].isFinished());
+ }
+
+ mutex.lock();
+ cond1.wakeAll();
+ cond2.wakeAll();
+ mutex.unlock();
+
+ for (x = 0; x < ThreadCount; ++x) {
+ QVERIFY(thread[x].wait(1000));
+ }
+ }
}
}
@@ -282,94 +288,99 @@ void tst_QWaitCondition::wait_QReadWriteLock()
int x;
for (int i = 0; i < iterations; ++i) {
- {
- QReadWriteLock readWriteLock;
- QWaitCondition waitCondition;
-
- readWriteLock.lockForRead();
-
- waitCondition.wakeOne();
- QVERIFY(!waitCondition.wait(&readWriteLock, 1));
-
- waitCondition.wakeAll();
- QVERIFY(!waitCondition.wait(&readWriteLock, 1));
-
- readWriteLock.unlock();
- }
-
- {
- QReadWriteLock readWriteLock;
- QWaitCondition waitCondition;
-
- readWriteLock.lockForWrite();
-
- waitCondition.wakeOne();
- QVERIFY(!waitCondition.wait(&readWriteLock, 1));
-
- waitCondition.wakeAll();
- QVERIFY(!waitCondition.wait(&readWriteLock, 1));
-
- readWriteLock.unlock();
- }
-
- {
- // test multiple threads waiting on separate wait conditions
- wait_QReadWriteLock_Thread_1 thread[ThreadCount];
-
- for (x = 0; x < ThreadCount; ++x) {
- thread[x].readWriteLock.lockForRead();
- thread[x].start();
- // wait for thread to start
- QVERIFY(thread[x].cond.wait(&thread[x].readWriteLock, 1000));
- thread[x].readWriteLock.unlock();
- }
-
- for (x = 0; x < ThreadCount; ++x) {
- QVERIFY(thread[x].isRunning());
- QVERIFY(!thread[x].isFinished());
- }
-
- for (x = 0; x < ThreadCount; ++x) {
- thread[x].readWriteLock.lockForRead();
- thread[x].cond.wakeOne();
- thread[x].readWriteLock.unlock();
- }
-
- for (x = 0; x < ThreadCount; ++x) {
- QVERIFY(thread[x].wait(1000));
- }
- }
-
- {
- // test multiple threads waiting on a wait condition
- QReadWriteLock readWriteLock;
- QWaitCondition cond1, cond2;
- wait_QReadWriteLock_Thread_2 thread[ThreadCount];
-
- readWriteLock.lockForWrite();
- for (x = 0; x < ThreadCount; ++x) {
- thread[x].readWriteLock = &readWriteLock;
- thread[x].cond = (x < ThreadCount / 2) ? &cond1 : &cond2;
- thread[x].start();
- // wait for thread to start
- QVERIFY(thread[x].started.wait(&readWriteLock, 1000));
- }
- readWriteLock.unlock();
-
- for (x = 0; x < ThreadCount; ++x) {
- QVERIFY(thread[x].isRunning());
- QVERIFY(!thread[x].isFinished());
- }
-
- readWriteLock.lockForWrite();
- cond1.wakeAll();
- cond2.wakeAll();
- readWriteLock.unlock();
-
- for (x = 0; x < ThreadCount; ++x) {
- QVERIFY(thread[x].wait(1000));
- }
- }
+ {
+ QReadWriteLock readWriteLock;
+ QWaitCondition waitCondition;
+
+ readWriteLock.lockForRead();
+
+ waitCondition.wakeOne();
+ QVERIFY(!waitCondition.wait(&readWriteLock, 1));
+
+ waitCondition.wakeAll();
+ QVERIFY(!waitCondition.wait(&readWriteLock, 1));
+
+ readWriteLock.unlock();
+ }
+
+ {
+ QReadWriteLock readWriteLock;
+ QWaitCondition waitCondition;
+
+ readWriteLock.lockForWrite();
+
+ waitCondition.wakeOne();
+ QVERIFY(!waitCondition.wait(&readWriteLock, 1));
+
+ waitCondition.wakeAll();
+ QVERIFY(!waitCondition.wait(&readWriteLock, 1));
+
+ readWriteLock.unlock();
+ }
+
+ {
+ // test multiple threads waiting on separate wait conditions
+ wait_QReadWriteLock_Thread_1 thread[ThreadCount];
+
+ for (x = 0; x < ThreadCount; ++x) {
+ thread[x].readWriteLock.lockForRead();
+ thread[x].start();
+ // wait for thread to start
+#if defined(Q_OS_SYMBIAN) && defined(Q_CC_WINSCW)
+ // Symbian emulator startup simultaneously with this thread causes additional delay
+ QVERIFY(thread[x].cond.wait(&thread[x].readWriteLock, 10000));
+#else
+ QVERIFY(thread[x].cond.wait(&thread[x].readWriteLock, 1000));
+#endif
+ thread[x].readWriteLock.unlock();
+ }
+
+ for (x = 0; x < ThreadCount; ++x) {
+ QVERIFY(thread[x].isRunning());
+ QVERIFY(!thread[x].isFinished());
+ }
+
+ for (x = 0; x < ThreadCount; ++x) {
+ thread[x].readWriteLock.lockForRead();
+ thread[x].cond.wakeOne();
+ thread[x].readWriteLock.unlock();
+ }
+
+ for (x = 0; x < ThreadCount; ++x) {
+ QVERIFY(thread[x].wait(1000));
+ }
+ }
+
+ {
+ // test multiple threads waiting on a wait condition
+ QReadWriteLock readWriteLock;
+ QWaitCondition cond1, cond2;
+ wait_QReadWriteLock_Thread_2 thread[ThreadCount];
+
+ readWriteLock.lockForWrite();
+ for (x = 0; x < ThreadCount; ++x) {
+ thread[x].readWriteLock = &readWriteLock;
+ thread[x].cond = (x < ThreadCount / 2) ? &cond1 : &cond2;
+ thread[x].start();
+ // wait for thread to start
+ QVERIFY(thread[x].started.wait(&readWriteLock, 1000));
+ }
+ readWriteLock.unlock();
+
+ for (x = 0; x < ThreadCount; ++x) {
+ QVERIFY(thread[x].isRunning());
+ QVERIFY(!thread[x].isFinished());
+ }
+
+ readWriteLock.lockForWrite();
+ cond1.wakeAll();
+ cond2.wakeAll();
+ readWriteLock.unlock();
+
+ for (x = 0; x < ThreadCount; ++x) {
+ QVERIFY(thread[x].wait(1000));
+ }
+ }
}
}
@@ -386,7 +397,7 @@ public:
QWaitCondition *cond;
inline wake_Thread()
- : mutex(0), cond(0)
+ : mutex(0), cond(0)
{ }
static inline void sleep(ulong s)
@@ -394,14 +405,14 @@ public:
void run()
{
- mutex->lock();
- ++count;
+ mutex->lock();
+ ++count;
dummy.wakeOne(); // this wakeup should be lost
- started.wakeOne();
+ started.wakeOne();
dummy.wakeAll(); // this one too
- cond->wait(mutex);
+ cond->wait(mutex);
--count;
- mutex->unlock();
+ mutex->unlock();
}
};
@@ -419,7 +430,7 @@ public:
QWaitCondition *cond;
inline wake_Thread_2()
- : readWriteLock(0), cond(0)
+ : readWriteLock(0), cond(0)
{ }
static inline void sleep(ulong s)
@@ -427,14 +438,14 @@ public:
void run()
{
- readWriteLock->lockForWrite();
- ++count;
+ readWriteLock->lockForWrite();
+ ++count;
dummy.wakeOne(); // this wakeup should be lost
started.wakeOne();
dummy.wakeAll(); // this one too
- cond->wait(readWriteLock);
+ cond->wait(readWriteLock);
--count;
- readWriteLock->unlock();
+ readWriteLock->unlock();
}
};
@@ -445,194 +456,194 @@ void tst_QWaitCondition::wakeOne()
int x;
// wake up threads, one at a time
for (int i = 0; i < iterations; ++i) {
- QMutex mutex;
- QWaitCondition cond;
+ QMutex mutex;
+ QWaitCondition cond;
- // QMutex
- wake_Thread thread[ThreadCount];
- bool thread_exited[ThreadCount];
-
- mutex.lock();
- for (x = 0; x < ThreadCount; ++x) {
- thread[x].mutex = &mutex;
- thread[x].cond = &cond;
- thread_exited[x] = FALSE;
- thread[x].start();
- // wait for thread to start
- QVERIFY(thread[x].started.wait(&mutex, 1000));
- // make sure wakeups are not queued... if nothing is
- // waiting at the time of the wakeup, nothing happens
- QVERIFY(!thread[x].dummy.wait(&mutex, 1));
- }
- mutex.unlock();
-
- QCOMPARE(wake_Thread::count, ThreadCount);
-
- // wake up threads one at a time
- for (x = 0; x < ThreadCount; ++x) {
- mutex.lock();
- cond.wakeOne();
- QVERIFY(!cond.wait(&mutex, 1));
- QVERIFY(!thread[x].dummy.wait(&mutex, 1));
- mutex.unlock();
-
- int exited = 0;
- for (int y = 0; y < ThreadCount; ++y) {
- if (thread_exited[y])
- continue;
- if (thread[y].wait(exited > 0 ? 1 : 1000)) {
- thread_exited[y] = TRUE;
- ++exited;
- }
- }
-
- QCOMPARE(exited, 1);
- QCOMPARE(wake_Thread::count, ThreadCount - (x + 1));
- }
-
- QCOMPARE(wake_Thread::count, 0);
+ // QMutex
+ wake_Thread thread[ThreadCount];
+ bool thread_exited[ThreadCount];
+
+ mutex.lock();
+ for (x = 0; x < ThreadCount; ++x) {
+ thread[x].mutex = &mutex;
+ thread[x].cond = &cond;
+ thread_exited[x] = FALSE;
+ thread[x].start();
+ // wait for thread to start
+ QVERIFY(thread[x].started.wait(&mutex, 1000));
+ // make sure wakeups are not queued... if nothing is
+ // waiting at the time of the wakeup, nothing happens
+ QVERIFY(!thread[x].dummy.wait(&mutex, 1));
+ }
+ mutex.unlock();
- // QReadWriteLock
- QReadWriteLock readWriteLock;
- wake_Thread_2 rwthread[ThreadCount];
+ QCOMPARE(wake_Thread::count, ThreadCount);
+ // wake up threads one at a time
+ for (x = 0; x < ThreadCount; ++x) {
+ mutex.lock();
+ cond.wakeOne();
+ QVERIFY(!cond.wait(&mutex, COND_WAIT_TIME));
+ QVERIFY(!thread[x].dummy.wait(&mutex, 1));
+ mutex.unlock();
+
+ int exited = 0;
+ for (int y = 0; y < ThreadCount; ++y) {
+ if (thread_exited[y])
+ continue;
+ if (thread[y].wait(exited > 0 ? 1 : 1000)) {
+ thread_exited[y] = TRUE;
+ ++exited;
+ }
+ }
+
+ QCOMPARE(exited, 1);
+ QCOMPARE(wake_Thread::count, ThreadCount - (x + 1));
+ }
+
+ QCOMPARE(wake_Thread::count, 0);
+
+ // QReadWriteLock
+ QReadWriteLock readWriteLock;
+ wake_Thread_2 rwthread[ThreadCount];
+
+ readWriteLock.lockForWrite();
+ for (x = 0; x < ThreadCount; ++x) {
+ rwthread[x].readWriteLock = &readWriteLock;
+ rwthread[x].cond = &cond;
+ thread_exited[x] = FALSE;
+ rwthread[x].start();
+ // wait for thread to start
+ QVERIFY(rwthread[x].started.wait(&readWriteLock, 1000));
+ // make sure wakeups are not queued... if nothing is
+ // waiting at the time of the wakeup, nothing happens
+ QVERIFY(!rwthread[x].dummy.wait(&readWriteLock, 1));
+ }
+ readWriteLock.unlock();
+
+ QCOMPARE(wake_Thread_2::count, ThreadCount);
+
+ // wake up threads one at a time
+ for (x = 0; x < ThreadCount; ++x) {
readWriteLock.lockForWrite();
- for (x = 0; x < ThreadCount; ++x) {
- rwthread[x].readWriteLock = &readWriteLock;
- rwthread[x].cond = &cond;
- thread_exited[x] = FALSE;
- rwthread[x].start();
- // wait for thread to start
- QVERIFY(rwthread[x].started.wait(&readWriteLock, 1000));
- // make sure wakeups are not queued... if nothing is
- // waiting at the time of the wakeup, nothing happens
- QVERIFY(!rwthread[x].dummy.wait(&readWriteLock, 1));
- }
- readWriteLock.unlock();
-
- QCOMPARE(wake_Thread_2::count, ThreadCount);
-
- // wake up threads one at a time
- for (x = 0; x < ThreadCount; ++x) {
- readWriteLock.lockForWrite();
- cond.wakeOne();
- QVERIFY(!cond.wait(&readWriteLock, 1));
- QVERIFY(!rwthread[x].dummy.wait(&readWriteLock, 1));
- readWriteLock.unlock();
-
- int exited = 0;
- for (int y = 0; y < ThreadCount; ++y) {
- if (thread_exited[y])
- continue;
- if (rwthread[y].wait(exited > 0 ? 1 : 1000)) {
- thread_exited[y] = TRUE;
- ++exited;
- }
- }
-
- QCOMPARE(exited, 1);
- QCOMPARE(wake_Thread_2::count, ThreadCount - (x + 1));
- }
-
- QCOMPARE(wake_Thread_2::count, 0);
+ cond.wakeOne();
+ QVERIFY(!cond.wait(&readWriteLock, COND_WAIT_TIME));
+ QVERIFY(!rwthread[x].dummy.wait(&readWriteLock, 1));
+ readWriteLock.unlock();
+
+ int exited = 0;
+ for (int y = 0; y < ThreadCount; ++y) {
+ if (thread_exited[y])
+ continue;
+ if (rwthread[y].wait(exited > 0 ? 1 : 1000)) {
+ thread_exited[y] = TRUE;
+ ++exited;
+ }
+ }
+
+ QCOMPARE(exited, 1);
+ QCOMPARE(wake_Thread_2::count, ThreadCount - (x + 1));
+ }
+
+ QCOMPARE(wake_Thread_2::count, 0);
}
// wake up threads, two at a time
for (int i = 0; i < iterations; ++i) {
- QMutex mutex;
- QWaitCondition cond;
+ QMutex mutex;
+ QWaitCondition cond;
// QMutex
- wake_Thread thread[ThreadCount];
- bool thread_exited[ThreadCount];
-
- mutex.lock();
- for (x = 0; x < ThreadCount; ++x) {
- thread[x].mutex = &mutex;
- thread[x].cond = &cond;
- thread_exited[x] = FALSE;
- thread[x].start();
- // wait for thread to start
- QVERIFY(thread[x].started.wait(&mutex, 1000));
- // make sure wakeups are not queued... if nothing is
- // waiting at the time of the wakeup, nothing happens
- QVERIFY(!thread[x].dummy.wait(&mutex, 1));
- }
- mutex.unlock();
-
- QCOMPARE(wake_Thread::count, ThreadCount);
-
- // wake up threads one at a time
- for (x = 0; x < ThreadCount; x += 2) {
- mutex.lock();
- cond.wakeOne();
- cond.wakeOne();
- QVERIFY(!cond.wait(&mutex, 1));
- QVERIFY(!thread[x].dummy.wait(&mutex, 1));
- QVERIFY(!thread[x + 1].dummy.wait(&mutex, 1));
- mutex.unlock();
-
- int exited = 0;
- for (int y = 0; y < ThreadCount; ++y) {
- if (thread_exited[y])
- continue;
- if (thread[y].wait(exited > 0 ? 1 : 1000)) {
- thread_exited[y] = TRUE;
- ++exited;
- }
- }
-
- QCOMPARE(exited, 2);
- QCOMPARE(wake_Thread::count, ThreadCount - (x + 2));
- }
-
- QCOMPARE(wake_Thread::count, 0);
+ wake_Thread thread[ThreadCount];
+ bool thread_exited[ThreadCount];
+
+ mutex.lock();
+ for (x = 0; x < ThreadCount; ++x) {
+ thread[x].mutex = &mutex;
+ thread[x].cond = &cond;
+ thread_exited[x] = FALSE;
+ thread[x].start();
+ // wait for thread to start
+ QVERIFY(thread[x].started.wait(&mutex, 1000));
+ // make sure wakeups are not queued... if nothing is
+ // waiting at the time of the wakeup, nothing happens
+ QVERIFY(!thread[x].dummy.wait(&mutex, 1));
+ }
+ mutex.unlock();
+
+ QCOMPARE(wake_Thread::count, ThreadCount);
+
+ // wake up threads one at a time
+ for (x = 0; x < ThreadCount; x += 2) {
+ mutex.lock();
+ cond.wakeOne();
+ cond.wakeOne();
+ QVERIFY(!cond.wait(&mutex, COND_WAIT_TIME));
+ QVERIFY(!thread[x].dummy.wait(&mutex, 1));
+ QVERIFY(!thread[x + 1].dummy.wait(&mutex, 1));
+ mutex.unlock();
+
+ int exited = 0;
+ for (int y = 0; y < ThreadCount; ++y) {
+ if (thread_exited[y])
+ continue;
+ if (thread[y].wait(exited > 0 ? 1 : 1000)) {
+ thread_exited[y] = TRUE;
+ ++exited;
+ }
+ }
+
+ QCOMPARE(exited, 2);
+ QCOMPARE(wake_Thread::count, ThreadCount - (x + 2));
+ }
+
+ QCOMPARE(wake_Thread::count, 0);
// QReadWriteLock
QReadWriteLock readWriteLock;
wake_Thread_2 rwthread[ThreadCount];
- readWriteLock.lockForWrite();
- for (x = 0; x < ThreadCount; ++x) {
- rwthread[x].readWriteLock = &readWriteLock;
- rwthread[x].cond = &cond;
- thread_exited[x] = FALSE;
- rwthread[x].start();
- // wait for thread to start
- QVERIFY(rwthread[x].started.wait(&readWriteLock, 1000));
- // make sure wakeups are not queued... if nothing is
- // waiting at the time of the wakeup, nothing happens
- QVERIFY(!rwthread[x].dummy.wait(&readWriteLock, 1));
- }
- readWriteLock.unlock();
-
- QCOMPARE(wake_Thread_2::count, ThreadCount);
-
- // wake up threads one at a time
- for (x = 0; x < ThreadCount; x += 2) {
- readWriteLock.lockForWrite();
- cond.wakeOne();
- cond.wakeOne();
- QVERIFY(!cond.wait(&readWriteLock, 1));
- QVERIFY(!rwthread[x].dummy.wait(&readWriteLock, 1));
- QVERIFY(!rwthread[x + 1].dummy.wait(&readWriteLock, 1));
- readWriteLock.unlock();
-
- int exited = 0;
- for (int y = 0; y < ThreadCount; ++y) {
- if (thread_exited[y])
- continue;
- if (rwthread[y].wait(exited > 0 ? 1 : 1000)) {
- thread_exited[y] = TRUE;
- ++exited;
- }
- }
-
- QCOMPARE(exited, 2);
- QCOMPARE(wake_Thread_2::count, ThreadCount - (x + 2));
- }
-
- QCOMPARE(wake_Thread_2::count, 0);
+ readWriteLock.lockForWrite();
+ for (x = 0; x < ThreadCount; ++x) {
+ rwthread[x].readWriteLock = &readWriteLock;
+ rwthread[x].cond = &cond;
+ thread_exited[x] = FALSE;
+ rwthread[x].start();
+ // wait for thread to start
+ QVERIFY(rwthread[x].started.wait(&readWriteLock, 1000));
+ // make sure wakeups are not queued... if nothing is
+ // waiting at the time of the wakeup, nothing happens
+ QVERIFY(!rwthread[x].dummy.wait(&readWriteLock, 1));
+ }
+ readWriteLock.unlock();
+
+ QCOMPARE(wake_Thread_2::count, ThreadCount);
+
+ // wake up threads one at a time
+ for (x = 0; x < ThreadCount; x += 2) {
+ readWriteLock.lockForWrite();
+ cond.wakeOne();
+ cond.wakeOne();
+ QVERIFY(!cond.wait(&readWriteLock, COND_WAIT_TIME));
+ QVERIFY(!rwthread[x].dummy.wait(&readWriteLock, 1));
+ QVERIFY(!rwthread[x + 1].dummy.wait(&readWriteLock, 1));
+ readWriteLock.unlock();
+
+ int exited = 0;
+ for (int y = 0; y < ThreadCount; ++y) {
+ if (thread_exited[y])
+ continue;
+ if (rwthread[y].wait(exited > 0 ? 1 : 1000)) {
+ thread_exited[y] = TRUE;
+ ++exited;
+ }
+ }
+
+ QCOMPARE(exited, 2);
+ QCOMPARE(wake_Thread_2::count, ThreadCount - (x + 2));
+ }
+
+ QCOMPARE(wake_Thread_2::count, 0);
}
}
@@ -640,69 +651,69 @@ void tst_QWaitCondition::wakeAll()
{
int x;
for (int i = 0; i < iterations; ++i) {
- QMutex mutex;
- QWaitCondition cond;
+ QMutex mutex;
+ QWaitCondition cond;
- // QMutex
- wake_Thread thread[ThreadCount];
-
- mutex.lock();
- for (x = 0; x < ThreadCount; ++x) {
- thread[x].mutex = &mutex;
- thread[x].cond = &cond;
- thread[x].start();
- // wait for thread to start
- QVERIFY(thread[x].started.wait(&mutex, 1000));
- }
- mutex.unlock();
-
- QCOMPARE(wake_Thread::count, ThreadCount);
-
- // wake up all threads at once
- mutex.lock();
- cond.wakeAll();
- QVERIFY(!cond.wait(&mutex, 1));
- mutex.unlock();
-
- int exited = 0;
- for (x = 0; x < ThreadCount; ++x) {
- if (thread[x].wait(1000))
- ++exited;
- }
-
- QCOMPARE(exited, ThreadCount);
- QCOMPARE(wake_Thread::count, 0);
+ // QMutex
+ wake_Thread thread[ThreadCount];
- // QReadWriteLock
- QReadWriteLock readWriteLock;
- wake_Thread_2 rwthread[ThreadCount];
-
- readWriteLock.lockForWrite();
- for (x = 0; x < ThreadCount; ++x) {
- rwthread[x].readWriteLock = &readWriteLock;
- rwthread[x].cond = &cond;
- rwthread[x].start();
- // wait for thread to start
- QVERIFY(rwthread[x].started.wait(&readWriteLock, 1000));
- }
- readWriteLock.unlock();
-
- QCOMPARE(wake_Thread_2::count, ThreadCount);
-
- // wake up all threads at once
- readWriteLock.lockForWrite();
- cond.wakeAll();
- QVERIFY(!cond.wait(&readWriteLock, 1));
- readWriteLock.unlock();
-
- exited = 0;
- for (x = 0; x < ThreadCount; ++x) {
- if (rwthread[x].wait(1000))
- ++exited;
- }
-
- QCOMPARE(exited, ThreadCount);
- QCOMPARE(wake_Thread_2::count, 0);
+ mutex.lock();
+ for (x = 0; x < ThreadCount; ++x) {
+ thread[x].mutex = &mutex;
+ thread[x].cond = &cond;
+ thread[x].start();
+ // wait for thread to start
+ QVERIFY(thread[x].started.wait(&mutex, 1000));
+ }
+ mutex.unlock();
+
+ QCOMPARE(wake_Thread::count, ThreadCount);
+
+ // wake up all threads at once
+ mutex.lock();
+ cond.wakeAll();
+ QVERIFY(!cond.wait(&mutex, COND_WAIT_TIME));
+ mutex.unlock();
+
+ int exited = 0;
+ for (x = 0; x < ThreadCount; ++x) {
+ if (thread[x].wait(1000))
+ ++exited;
+ }
+
+ QCOMPARE(exited, ThreadCount);
+ QCOMPARE(wake_Thread::count, 0);
+
+ // QReadWriteLock
+ QReadWriteLock readWriteLock;
+ wake_Thread_2 rwthread[ThreadCount];
+
+ readWriteLock.lockForWrite();
+ for (x = 0; x < ThreadCount; ++x) {
+ rwthread[x].readWriteLock = &readWriteLock;
+ rwthread[x].cond = &cond;
+ rwthread[x].start();
+ // wait for thread to start
+ QVERIFY(rwthread[x].started.wait(&readWriteLock, 1000));
+ }
+ readWriteLock.unlock();
+
+ QCOMPARE(wake_Thread_2::count, ThreadCount);
+
+ // wake up all threads at once
+ readWriteLock.lockForWrite();
+ cond.wakeAll();
+ QVERIFY(!cond.wait(&readWriteLock, COND_WAIT_TIME));
+ readWriteLock.unlock();
+
+ exited = 0;
+ for (x = 0; x < ThreadCount; ++x) {
+ if (rwthread[x].wait(1000))
+ ++exited;
+ }
+
+ QCOMPARE(exited, ThreadCount);
+ QCOMPARE(wake_Thread_2::count, 0);
}
}
diff --git a/tests/auto/qwidget/qwidget.pro b/tests/auto/qwidget/qwidget.pro
index d394400..59c1753 100644
--- a/tests/auto/qwidget/qwidget.pro
+++ b/tests/auto/qwidget/qwidget.pro
@@ -14,4 +14,8 @@ LIBS += -framework Security -framework AppKit
OBJECTIVE_SOURCES += tst_qwidget_mac_helpers.mm
}
-!wince*:win32: LIBS += -luser32 -lgdi32
+symbian {
+ INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+}
+
+!wince*:!symbian:win32: LIBS += -luser32 -lgdi32
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 34971a9..33722c7 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -67,6 +67,14 @@
#include <qcalendarwidget.h>
#include <qmainwindow.h>
#include <QtGui/qpaintengine.h>
+#include <private/qbackingstore_p.h>
+
+#ifdef Q_WS_S60
+#include <avkon.hrh> // EEikStatusPaneUidTitle
+#include <akntitle.h> // CAknTitlePane
+#include <akncontext.h> // CAknContextPane
+#include <eikspane.h> // CEikStatusPane
+#endif
#ifdef Q_WS_QWS
# include <qscreen_qws.h>
@@ -356,6 +364,8 @@ private slots:
void focusWidget_task254563();
void rectOutsideCoordinatesLimit_task144779();
+ void destroyBackingStore();
+
private:
bool ensureScreenSize(int width, int height);
QWidget *testWidget;
@@ -1079,6 +1089,9 @@ void tst_QWidget::enabledPropagation()
void tst_QWidget::acceptDropsPropagation()
{
+#ifdef QT_NO_DRAGANDDROP
+ QSKIP("Drag'n drop disabled in this build", SkipAll);
+#else
QWidget *childWidget = new QWidget(testWidget);
childWidget->show();
QVERIFY(!testWidget->acceptDrops());
@@ -1122,6 +1135,7 @@ void tst_QWidget::acceptDropsPropagation()
QVERIFY(childWidget->acceptDrops());
QVERIFY(!grandChildWidget->acceptDrops());
QVERIFY(grandChildWidget->testAttribute(Qt::WA_DropSiteRegistered));
+#endif
}
void tst_QWidget::isEnabledTo()
@@ -1409,7 +1423,7 @@ void tst_QWidget::mapFromAndTo()
subWindow2->setGeometry(75, 75, 100, 100);
subSubWindow->setGeometry(10, 10, 10, 10);
-#ifndef Q_OS_WINCE //still no proper minimizing
+#if !defined (Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) //still no proper minimizing
//update visibility
if (windowMinimized) {
if (!windowHidden) {
@@ -1814,6 +1828,9 @@ void tst_QWidget::windowState()
pos = QPoint(10,10);
size = QSize(100,100);
}
+#elif defined(Q_WS_S60)
+ QPoint pos = QPoint(10,10);
+ QSize size = QSize(100,100);
#else
const QPoint pos(500, 500);
const QSize size(200, 200);
@@ -1928,7 +1945,7 @@ void tst_QWidget::showMaximized()
layouted.showNormal();
QVERIFY(!(layouted.windowState() & Qt::WindowMaximized));
-#if !defined(Q_WS_QWS) && !defined(Q_OS_WINCE)
+#if !defined(Q_WS_QWS) && !defined(Q_OS_WINCE) && !defined(Q_WS_S60)
//embedded may choose a different size to fit on the screen.
QCOMPARE(layouted.size(), layouted.sizeHint());
#endif
@@ -1969,6 +1986,13 @@ void tst_QWidget::showMaximized()
QVERIFY(widget.isMaximized());
}
+ {
+ QWidget widget;
+ widget.setGeometry(0, 0, 10, 10);
+ widget.showMaximized();
+ QVERIFY(widget.size().width() > 20 && widget.size().height() > 20);
+ }
+
#ifdef QT3_SUPPORT
#if !defined(Q_WS_QWS)
//embedded respects max/min sizes by design -- maybe wrong design, but that's the way it is now.
@@ -2020,7 +2044,7 @@ void tst_QWidget::showFullScreen()
layouted.showNormal();
QVERIFY(!(layouted.windowState() & Qt::WindowFullScreen));
-#if !defined(Q_WS_QWS) && !defined(Q_OS_WINCE)
+#if !defined(Q_WS_QWS) && !defined(Q_OS_WINCE) && !defined (Q_WS_S60)
//embedded may choose a different size to fit on the screen.
QCOMPARE(layouted.size(), layouted.sizeHint());
#endif
@@ -2451,6 +2475,9 @@ void tst_QWidget::hideWhenFocusWidgetIsChild()
actualFocusWidget.sprintf("%p %s %s", qApp->focusWidget(), qApp->focusWidget()->objectName().toLatin1().constData(), qApp->focusWidget()->metaObject()->className());
expectedFocusWidget.sprintf("%p %s %s", edit2, edit2->objectName().toLatin1().constData(), edit2->metaObject()->className());
QCOMPARE(actualFocusWidget, expectedFocusWidget);
+
+ delete edit2;
+ delete parentWidget;
}
void tst_QWidget::normalGeometry()
@@ -3354,6 +3381,9 @@ void tst_QWidget::widgetAt()
#if defined(Q_OS_WINCE)
QEXPECT_FAIL("", "Windows CE does only support rectangular regions", Continue); //See also task 147191
#endif
+#if defined(Q_OS_SYMBIAN)
+ QEXPECT_FAIL("", "Symbian/S60 does only support rectangular regions", Continue); //See also task 147191
+#endif
QCOMPARE(QApplication::widgetAt(100,100)->objectName(), w1->objectName());
QCOMPARE(QApplication::widgetAt(101,101)->objectName(), w2->objectName());
@@ -3369,6 +3399,9 @@ void tst_QWidget::widgetAt()
#if defined(Q_OS_WINCE)
QEXPECT_FAIL("", "Windows CE does only support rectangular regions", Continue); //See also task 147191
#endif
+#if defined(Q_OS_SYMBIAN)
+ QEXPECT_FAIL("", "Symbian/S60 does only support rectangular regions", Continue); //See also task 147191
+#endif
QVERIFY(QApplication::widgetAt(100,100) == w1);
QVERIFY(QApplication::widgetAt(101,101) == w2);
@@ -3428,6 +3461,34 @@ QString textPropertyToString(Display *display, XTextProperty& text_prop)
#endif
+#if defined(Q_WS_S60)
+// Returns the application's status pane control, if not present returns NULL.
+static CCoeControl* GetStatusPaneControl( TInt aPaneId )
+{
+ const TUid paneUid = { aPaneId };
+
+ CEikStatusPane* statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
+ if (statusPane && statusPane->PaneCapabilities(paneUid).IsPresent()){
+ CCoeControl* control = NULL;
+ // ControlL shouldn't leave because the pane is present
+ TRAPD(err, control = statusPane->ControlL(paneUid));
+ return err != KErrNone ? NULL : control;
+ }
+ return NULL;
+}
+// Returns the application's title pane, if not present returns NULL.
+static CAknTitlePane* TitlePane()
+{
+ return static_cast<CAknTitlePane*>(GetStatusPaneControl(EEikStatusPaneUidTitle));
+}
+
+// Returns the application's title pane, if not present returns NULL.
+static CAknContextPane* ContextPane()
+{
+ return static_cast<CAknContextPane*>(GetStatusPaneControl(EEikStatusPaneUidContext));
+}
+#endif
+
static QString visibleWindowTitle(QWidget *window, Qt::WindowState state = Qt::WindowNoState)
{
QString vTitle;
@@ -3490,6 +3551,13 @@ static QString visibleWindowTitle(QWidget *window, Qt::WindowState state = Qt::W
if (win)
vTitle = win->caption();
}
+#elif defined (Q_WS_S60)
+ CAknTitlePane* titlePane = TitlePane();
+ if(titlePane)
+ {
+ const TDesC* nTitle = titlePane->Text();
+ vTitle = QString::fromUtf16(nTitle->Ptr(), nTitle->Length());
+ }
#endif
return vTitle;
@@ -3520,6 +3588,9 @@ void tst_QWidget::windowTitle()
void tst_QWidget::windowIconText()
{
+#ifdef Q_OS_SYMBIAN
+ QSKIP("Symbian/S60 windows don't have window icon text", SkipAll);
+#endif
QWidget widget(0);
widget.setWindowTitle("Application Name");
@@ -5312,7 +5383,7 @@ void tst_QWidget::moveChild()
QCOMPARE(pos, child.pos());
QCOMPARE(parent.r, QRegion(oldGeometry) - child.geometry());
-#ifndef Q_WS_MAC
+#if !defined(Q_WS_MAC)
// should be scrolled in backingstore
QCOMPARE(child.r, QRegion());
#endif
@@ -6108,7 +6179,10 @@ void tst_QWidget::compatibilityChildInsertedEvents()
EventRecorder::EventList()
<< qMakePair(&widget, QEvent::PolishRequest)
<< qMakePair(&widget, QEvent::Type(QEvent::User + 1))
-#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS)
+#ifdef Q_OS_SYMBIAN
+ << qMakePair(&widget, QEvent::SymbianDeferredFocusChanged)
+#endif
+#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60)
<< qMakePair(&widget, QEvent::UpdateRequest)
#endif
;
@@ -6203,7 +6277,10 @@ void tst_QWidget::compatibilityChildInsertedEvents()
<< qMakePair(&widget, QEvent::PolishRequest)
<< qMakePair(&widget, QEvent::Type(QEvent::User + 1))
<< qMakePair(&widget, QEvent::Type(QEvent::User + 2))
-#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS)
+#ifdef Q_OS_SYMBIAN
+ << qMakePair(&widget, QEvent::SymbianDeferredFocusChanged)
+#endif
+#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60)
<< qMakePair(&widget, QEvent::UpdateRequest)
#endif
;
@@ -6298,7 +6375,10 @@ void tst_QWidget::compatibilityChildInsertedEvents()
<< qMakePair(&widget, QEvent::PolishRequest)
<< qMakePair(&widget, QEvent::Type(QEvent::User + 1))
<< qMakePair(&widget, QEvent::Type(QEvent::User + 2))
-#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS)
+#ifdef Q_OS_SYMBIAN
+ << qMakePair(&widget, QEvent::SymbianDeferredFocusChanged)
+#endif
+#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60)
<< qMakePair(&widget, QEvent::UpdateRequest)
#endif
;
@@ -7352,7 +7432,7 @@ void tst_QWidget::repaintWhenChildDeleted()
}
#endif
ColorWidget w(0, Qt::red);
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(Q_WS_S60)
QPoint startPoint = QApplication::desktop()->availableGeometry(&w).topLeft();
startPoint.rx() += 50;
startPoint.ry() += 50;
@@ -7386,7 +7466,7 @@ void tst_QWidget::repaintWhenChildDeleted()
void tst_QWidget::hideOpaqueChildWhileHidden()
{
ColorWidget w(0, Qt::red);
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(Q_WS_S60)
QPoint startPoint = QApplication::desktop()->availableGeometry(&w).topLeft();
startPoint.rx() += 50;
startPoint.ry() += 50;
@@ -8261,7 +8341,12 @@ void tst_QWidget::customDpi()
custom->logicalDpiX();
QCOMPARE(custom->metricCallCount, 1);
child->logicalDpiX();
+#ifdef Q_WS_S60
+ // QWidget::metric is not recursive on Symbian
+ QCOMPARE(custom->metricCallCount, 1);
+#else
QCOMPARE(custom->metricCallCount, 2);
+#endif
delete topLevel;
}
@@ -9102,8 +9187,8 @@ void tst_QWidget::toplevelLineEditFocus()
#endif
QTest::qWait(200);
- QCOMPARE(QApplication::activeWindow(), &w);
- QCOMPARE(QApplication::focusWidget(), &w);
+ QCOMPARE(QApplication::activeWindow(), (QWidget*)&w);
+ QCOMPARE(QApplication::focusWidget(), (QWidget*)&w);
}
void tst_QWidget::focusWidget_task254563()
@@ -9121,6 +9206,32 @@ void tst_QWidget::focusWidget_task254563()
QVERIFY(top.focusWidget() != widget); //dangling pointer
}
+void tst_QWidget::destroyBackingStore()
+{
+ UpdateWidget w;
+ w.show();
+
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&w);
+#endif
+ QApplication::processEvents();
+
+ w.reset();
+ w.update();
+ delete qt_widget_private(&w)->topData()->backingStore;
+ qt_widget_private(&w)->topData()->backingStore = 0;
+ qt_widget_private(&w)->topData()->backingStore = new QWidgetBackingStore(&w);
+
+ w.update();
+ QApplication::processEvents();
+ QCOMPARE(w.numPaintEvents, 1);
+
+ // Check one more time, because the second time around does more caching.
+ w.update();
+ QApplication::processEvents();
+ QCOMPARE(w.numPaintEvents, 2);
+}
+
void tst_QWidget::rectOutsideCoordinatesLimit_task144779()
{
QWidget main;
@@ -9163,7 +9274,7 @@ void tst_QWidget::inputFocus_task257832()
QSKIP("No input context", SkipSingle);
widget->setFocus();
context->setFocusWidget(widget);
- QCOMPARE(context->focusWidget(), widget);
+ QCOMPARE(context->focusWidget(), static_cast<QWidget*>(widget));
widget->setReadOnly(true);
QVERIFY(!context->focusWidget());
delete widget;
diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
index 85705da..00b1f17 100644
--- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
+++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
@@ -158,6 +158,8 @@ void tst_QWindowSurface::flushOutsidePaintEvent()
qt_x11_wait_for_window_manager(&w);
#elif defined(Q_WS_QWS)
QApplication::sendPostedEvents(); //for the glib event loop
+#elif defined(Q_WS_S60)
+ QTest::qWait(5000);
#endif
VERIFY_COLOR(w.geometry(), w.color);
w.reset();
diff --git a/tests/auto/qwineventnotifier/qwineventnotifier.pro b/tests/auto/qwineventnotifier/qwineventnotifier.pro
index d985df6..0c8bd2b 100644
--- a/tests/auto/qwineventnotifier/qwineventnotifier.pro
+++ b/tests/auto/qwineventnotifier/qwineventnotifier.pro
@@ -1,6 +1,3 @@
load(qttest_p4)
SOURCES += tst_qwineventnotifier.cpp
-
QT = core
-
-
diff --git a/tests/auto/qwizard/qwizard.pro b/tests/auto/qwizard/qwizard.pro
index 867ab9c..a22e45c 100644
--- a/tests/auto/qwizard/qwizard.pro
+++ b/tests/auto/qwizard/qwizard.pro
@@ -5,5 +5,6 @@ SOURCES += tst_qwizard.cpp
#SOURCES += /home/jasplin/dev/research/qwizard/src/qwizard.cpp
#HEADERS += /home/jasplin/dev/research/qwizard/src/qwizard.h
RESOURCES = qwizard.qrc
+TARGET.EPOCHEAPSIZE = 0x200000 0xF00000
diff --git a/tests/auto/qwmatrix/qwmatrix.pro b/tests/auto/qwmatrix/qwmatrix.pro
index d2ecd49..58ea706 100644
--- a/tests/auto/qwmatrix/qwmatrix.pro
+++ b/tests/auto/qwmatrix/qwmatrix.pro
@@ -1,6 +1,6 @@
load(qttest_p4)
SOURCES += tst_qwmatrix.cpp
-unix:!mac:LIBS+=-lm
+unix:!mac:!symbian*:LIBS+=-lm
diff --git a/tests/auto/qwritelocker/qwritelocker.pro b/tests/auto/qwritelocker/qwritelocker.pro
index 42cdd45..acae4ef 100644
--- a/tests/auto/qwritelocker/qwritelocker.pro
+++ b/tests/auto/qwritelocker/qwritelocker.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qwritelocker.cpp
QT = core
-
-
diff --git a/tests/auto/qwsembedwidget/qwsembedwidget.pro b/tests/auto/qwsembedwidget/qwsembedwidget.pro
index 3ee12a3..bd3c32c 100644
--- a/tests/auto/qwsembedwidget/qwsembedwidget.pro
+++ b/tests/auto/qwsembedwidget/qwsembedwidget.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qwsembedwidget.cpp
-
-
-
+QT = core
diff --git a/tests/auto/qwsinputmethod/qwsinputmethod.pro b/tests/auto/qwsinputmethod/qwsinputmethod.pro
index 9721acc..69cce78 100644
--- a/tests/auto/qwsinputmethod/qwsinputmethod.pro
+++ b/tests/auto/qwsinputmethod/qwsinputmethod.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qwsinputmethod.cpp
-
-
-
+QT = core
diff --git a/tests/auto/qwswindowsystem/qwswindowsystem.pro b/tests/auto/qwswindowsystem/qwswindowsystem.pro
index 8276081..49466ee 100644
--- a/tests/auto/qwswindowsystem/qwswindowsystem.pro
+++ b/tests/auto/qwswindowsystem/qwswindowsystem.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qwswindowsystem.cpp
-
-
-
+QT = core
diff --git a/tests/auto/qxml/qxml.pro b/tests/auto/qxml/qxml.pro
index 6c767cb..304fc54 100644
--- a/tests/auto/qxml/qxml.pro
+++ b/tests/auto/qxml/qxml.pro
@@ -3,7 +3,7 @@ load(qttest_p4)
SOURCES += tst_qxml.cpp
QT = core xml
-wince*: {
+wince*|symbian*: {
addFiles.sources = 0x010D.xml
addFiles.path = .
DEPLOYMENT += addFiles
diff --git a/tests/auto/qxmlformatter/qxmlformatter.pro b/tests/auto/qxmlformatter/qxmlformatter.pro
index e3d16f6..4c00d73 100644
--- a/tests/auto/qxmlformatter/qxmlformatter.pro
+++ b/tests/auto/qxmlformatter/qxmlformatter.pro
@@ -3,7 +3,7 @@ SOURCES += tst_qxmlformatter.cpp
include (../xmlpatterns.pri)
-wince*:{
+wince*|symbian*:{
addFiles.sources = baselines input
addFiles.path = .
DEPLOYMENT += addFiles
diff --git a/tests/auto/qxmlquery/qxmlquery.pro b/tests/auto/qxmlquery/qxmlquery.pro
index 3db3734..cfab564 100644
--- a/tests/auto/qxmlquery/qxmlquery.pro
+++ b/tests/auto/qxmlquery/qxmlquery.pro
@@ -10,15 +10,15 @@ RESOURCES = input.qrc
QT += network
-!wince* {
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
-} else {
-DEFINES += SRCDIR=\\\"./\\\"
+wince* {
+ DEFINES += SRCDIR=\\\"./\\\"
+} else:!symbian {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
include (../xmlpatterns.pri)
-wince*: {
+wince*|symbian*: {
addFiles.sources = pushBaselines input.xml
addFiles.path = .
diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp
index a7275bb..7096630 100644
--- a/tests/auto/qxmlquery/tst_qxmlquery.cpp
+++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp
@@ -65,6 +65,10 @@
#include "TestFundament.h"
#include "../network-settings.h"
+#if defined(Q_OS_SYMBIAN)
+#define SRCDIR ""
+#endif
+
/*!
\class tst_QXmlQuery
\internal
@@ -88,6 +92,7 @@ public:
, m_pushTestsCount(0)
, m_testNetwork(true)
{
+ Q_SET_DEFAULT_IAP
}
private Q_SLOTS:
diff --git a/tests/auto/qxmlsimplereader/qxmlsimplereader.pro b/tests/auto/qxmlsimplereader/qxmlsimplereader.pro
index e7e8007..bfdec58 100644
--- a/tests/auto/qxmlsimplereader/qxmlsimplereader.pro
+++ b/tests/auto/qxmlsimplereader/qxmlsimplereader.pro
@@ -12,8 +12,8 @@ QT += network xml
QT -= gui
-wince*: {
+wince*|symbian*: {
addFiles.sources = encodings parser xmldocs
addFiles.path = .
DEPLOYMENT += addFiles
-} \ No newline at end of file
+}
diff --git a/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp
index 83eb7cc..44057ec 100644
--- a/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp
+++ b/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp
@@ -117,7 +117,7 @@ void XmlServer::run()
i += cnt;
sock->flush();
QTest::qSleep(1);
-
+
if (quit_soon) {
sock->abort();
break;
@@ -576,11 +576,15 @@ void tst_QXmlSimpleReader::inputFromSocket()
{
QFETCH(QString, file_name);
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Symbian: Skipped due to problems in Open C and QtNetwork", SkipAll);
+#endif
+
#if defined(Q_OS_WIN32) && (defined(Q_CC_INTEL) || defined(Q_CC_MINGW) || defined(Q_CC_MSVC_NET))
QSKIP("Regression caused by QHOstInfo change 294548, see task 202231.", SkipAll);
#endif
QTcpSocket sock;
- sock.connectToHost("localhost", TEST_PORT);
+ sock.connectToHost(QHostAddress::LocalHost, TEST_PORT);
const bool connectionSuccess = sock.waitForConnected();
if(!connectionSuccess) {
diff --git a/tests/auto/qxmlstream/qxmlstream.pro b/tests/auto/qxmlstream/qxmlstream.pro
index 46eed56..ac03d42 100644
--- a/tests/auto/qxmlstream/qxmlstream.pro
+++ b/tests/auto/qxmlstream/qxmlstream.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qxmlstream.cpp
QT = core xml network
-wince*: {
+wince*|symbian*: {
addFiles.sources = data XML-Test-Suite
addFiles.path = .
DEPLOYMENT += addFiles
diff --git a/tests/auto/qzip/qzip.pro b/tests/auto/qzip/qzip.pro
index 17b9543..632c743 100644
--- a/tests/auto/qzip/qzip.pro
+++ b/tests/auto/qzip/qzip.pro
@@ -1,11 +1,11 @@
load(qttest_p4)
SOURCES += tst_qzip.cpp
-wince*: {
+wince*|symbian: {
addFiles.sources = testdata
addFiles.path = .
DEPLOYMENT += addFiles
- DEFINES += SRCDIR=\\\".\\\"
+ !symbian:DEFINES += SRCDIR=\\\".\\\"
} else {
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
diff --git a/tests/auto/qzip/tst_qzip.cpp b/tests/auto/qzip/tst_qzip.cpp
index 152d268..c9a55f3 100644
--- a/tests/auto/qzip/tst_qzip.cpp
+++ b/tests/auto/qzip/tst_qzip.cpp
@@ -44,6 +44,10 @@
#include <private/qzipwriter_p.h>
#include <private/qzipreader_p.h>
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR "."
+#endif
+
class tst_QZip : public QObject
{
Q_OBJECT
diff --git a/tests/auto/symbian/orientationchange/orientationchange.pro b/tests/auto/symbian/orientationchange/orientationchange.pro
new file mode 100644
index 0000000..08b34f9
--- /dev/null
+++ b/tests/auto/symbian/orientationchange/orientationchange.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+HEADERS +=
+SOURCES += tst_orientationchange.cpp
+
+symbian {
+ INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+}
diff --git a/tests/auto/symbian/orientationchange/tst_orientationchange.cpp b/tests/auto/symbian/orientationchange/tst_orientationchange.cpp
new file mode 100644
index 0000000..480b748
--- /dev/null
+++ b/tests/auto/symbian/orientationchange/tst_orientationchange.cpp
@@ -0,0 +1,165 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#ifdef Q_OS_SYMBIAN
+
+#include <eikenv.h>
+#include <aknappui.h>
+
+class tst_orientationchange : public QObject
+{
+ Q_OBJECT
+public:
+ tst_orientationchange(){};
+ ~tst_orientationchange(){};
+
+private slots:
+ void resizeEventOnOrientationChange();
+};
+
+class TestWidget : public QWidget
+{
+public:
+ TestWidget(QWidget *parent = 0);
+
+ void reset();
+public:
+ void resizeEvent(QResizeEvent *event);
+
+public:
+ QSize resizeEventSize;
+ int resizeEventCount;
+};
+
+TestWidget::TestWidget(QWidget *parent)
+: QWidget(parent)
+{
+ reset();
+}
+
+void TestWidget::reset()
+{
+ resizeEventSize = QSize();
+ resizeEventCount = 0;
+}
+
+void TestWidget::resizeEvent(QResizeEvent *event)
+{
+ QWidget::resizeEvent(event);
+
+ // Size delivered in first resize event is stored.
+ if (!resizeEventCount)
+ resizeEventSize = event->size();
+
+ resizeEventCount++;
+}
+
+void tst_orientationchange::resizeEventOnOrientationChange()
+{
+ // This will test that when orientation 'changes', then
+ // at most one resize event is generated.
+
+ TestWidget *normalWidget = new TestWidget();
+ TestWidget *fullScreenWidget = new TestWidget();
+ TestWidget *maximizedWidget = new TestWidget();
+
+ fullScreenWidget->showFullScreen();
+ maximizedWidget->showMaximized();
+ normalWidget->show();
+
+ QCoreApplication::sendPostedEvents();
+ QCoreApplication::sendPostedEvents();
+
+ QCOMPARE(fullScreenWidget->resizeEventCount, 1);
+ QCOMPARE(fullScreenWidget->size(), fullScreenWidget->resizeEventSize);
+ QCOMPARE(maximizedWidget->resizeEventCount, 1);
+ QCOMPARE(maximizedWidget->size(), maximizedWidget->resizeEventSize);
+ QCOMPARE(normalWidget->resizeEventCount, 1);
+ QCOMPARE(normalWidget->size(), normalWidget->resizeEventSize);
+
+ fullScreenWidget->reset();
+ maximizedWidget->reset();
+ normalWidget->reset();
+
+ // Assumes that Qt application is AVKON application.
+ CAknAppUi *appUi = static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi());
+
+ // Determine 'opposite' orientation to the current orientation.
+
+ CAknAppUi::TAppUiOrientation orientation = CAknAppUi::EAppUiOrientationLandscape;
+ if (fullScreenWidget->size().width() > fullScreenWidget->size().height()) {
+ orientation = CAknAppUi::EAppUiOrientationPortrait;
+ }
+
+ TRAPD(err, appUi->SetOrientationL(orientation));
+
+ QCoreApplication::sendPostedEvents();
+ QCoreApplication::sendPostedEvents();
+
+ // setOrientationL is not guaranteed to change orientation
+ // (if emulator configured to support just portrait or landscape, then
+ // setOrientationL call shouldn't do anything).
+ // So let's ensure that we do not get resize event twice.
+
+ QVERIFY(fullScreenWidget->resizeEventCount <= 1);
+ if (fullScreenWidget->resizeEventCount) {
+ QCOMPARE(fullScreenWidget->size(), fullScreenWidget->resizeEventSize);
+ }
+ QVERIFY(maximizedWidget->resizeEventCount <= 1);
+ if (fullScreenWidget->resizeEventCount) {
+ QCOMPARE(maximizedWidget->size(), maximizedWidget->resizeEventSize);
+ }
+ QCOMPARE(normalWidget->resizeEventCount, 0);
+
+ TRAP(err, appUi->SetOrientationL(CAknAppUi::EAppUiOrientationUnspecified));
+
+ delete normalWidget;
+ delete fullScreenWidget;
+ delete maximizedWidget;
+}
+
+QTEST_MAIN(tst_orientationchange)
+#include "tst_orientationchange.moc"
+#else
+QTEST_NOOP_MAIN
+#endif
diff --git a/tests/auto/symbian/qmainexceptions/qmainexceptions.pro b/tests/auto/symbian/qmainexceptions/qmainexceptions.pro
new file mode 100644
index 0000000..16111c1
--- /dev/null
+++ b/tests/auto/symbian/qmainexceptions/qmainexceptions.pro
@@ -0,0 +1,3 @@
+load(qttest_p4)
+HEADERS +=
+SOURCES += tst_qmainexceptions.cpp
diff --git a/tests/auto/symbian/qmainexceptions/tst_qmainexceptions.cpp b/tests/auto/symbian/qmainexceptions/tst_qmainexceptions.cpp
new file mode 100644
index 0000000..ae70ce3
--- /dev/null
+++ b/tests/auto/symbian/qmainexceptions/tst_qmainexceptions.cpp
@@ -0,0 +1,468 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <e32base.h>
+#include <typeinfo>
+#include <stdexcept>
+#include <euserhl.h>
+
+#ifdef Q_OS_SYMBIAN
+
+typedef void TLeavingFunc();
+
+class tst_qmainexceptions : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qmainexceptions(){};
+ ~tst_qmainexceptions(){};
+
+ void TestSchedulerCatchesError(TLeavingFunc* f, int error);
+ void TestSymbianRoundTrip(int leave, int trap);
+ void TestStdRoundTrip(const std::exception& thrown, const std::exception& caught);
+
+ bool event(QEvent *event);
+
+public slots:
+ void initTestCase();
+private slots:
+ void trap();
+ void cleanupstack();
+ void leave();
+ void testTranslateBadAlloc();
+ void testTranslateBigAlloc();
+ void testRoundTrip();
+ void testTrap();
+ void testPropagation();
+ void testDtor1();
+ void testDtor2();
+ void testNestedExceptions();
+ void testScopedPointer();
+ void testHybrid();
+};
+
+class CDummy : public CBase
+{
+public:
+ CDummy(){}
+ ~CDummy(){}
+};
+
+void tst_qmainexceptions::initTestCase()
+{
+}
+
+void tst_qmainexceptions::trap()
+{
+ TTrapHandler *th= User::TrapHandler();
+ QVERIFY((int)th);
+}
+
+void tst_qmainexceptions::cleanupstack()
+{
+ __UHEAP_MARK;
+ //fails if OOM
+ CDummy* dummy1 = new (ELeave) CDummy;
+ __UHEAP_CHECK(1);
+ CleanupStack::PushL(dummy1);
+ CleanupStack::PopAndDestroy(dummy1);
+ __UHEAP_MARKEND;
+}
+
+void tst_qmainexceptions::leave()
+{
+ __UHEAP_MARK;
+ CDummy* dummy1 = 0;
+ TRAPD(err,{
+ CDummy* csDummy = new (ELeave) CDummy;
+ CleanupStack::PushL(csDummy);
+ __UHEAP_FAILNEXT(1);
+ dummy1 = new (ELeave) CDummy;
+ //CleanupStack::PopAndDestroy(csDummy); not executed as previous line throws
+ });
+ QCOMPARE(err,KErrNoMemory);
+ QVERIFY(!((int)dummy1));
+ __UHEAP_MARKEND;
+}
+
+class CTestActive : public CActive
+{
+public:
+ CTestActive(TLeavingFunc* aFunc) : CActive(EPriorityStandard), iFunc(aFunc)
+ {
+ CActiveScheduler::Add(this);
+ }
+ ~CTestActive()
+ {
+ Cancel();
+ }
+ void DoCancel() {}
+ void Test()
+ {
+ // complete this AO in a nested scheduler, to make it synchronous
+ TRequestStatus* s = &iStatus;
+ SetActive();
+ User::RequestComplete(s, KErrNone);
+ CActiveScheduler::Start();
+ }
+ void RunL()
+ {
+ (*iFunc)();
+ CActiveScheduler::Stop(); // will only get here if iFunc does not leave
+ }
+ TInt RunError(TInt aError)
+ {
+ error = aError;
+ CActiveScheduler::Stop(); // will only get here if iFunc leaves
+ return KErrNone;
+ }
+public:
+ TLeavingFunc* iFunc;
+ int error;
+};
+
+void tst_qmainexceptions::TestSchedulerCatchesError(TLeavingFunc* f, int error)
+{
+ CTestActive *act = new(ELeave) CTestActive(f);
+ act->Test();
+ QCOMPARE(act->error, error);
+ delete act;
+}
+
+void ThrowBadAlloc()
+{
+ throw std::bad_alloc();
+}
+
+void TranslateThrowBadAllocL()
+{
+ QT_TRYCATCH_LEAVING(ThrowBadAlloc());
+}
+
+void tst_qmainexceptions::testTranslateBadAlloc()
+{
+ // bad_alloc should give KErrNoMemory in an AO
+ TestSchedulerCatchesError(&TranslateThrowBadAllocL, KErrNoMemory);
+}
+
+void BigAlloc()
+{
+ // allocate too much memory - it's expected that 100M ints is too much, but keep doubling if not.
+ int *x = 0;
+ int n = 100000000;
+ do {
+ x = new int[n];
+ delete [] x;
+ n = n * 2;
+ } while (x);
+}
+
+void TranslateBigAllocL()
+{
+ QT_TRYCATCH_LEAVING(BigAlloc());
+}
+
+void tst_qmainexceptions::testTranslateBigAlloc()
+{
+ // this test will fail if new does not throw on failure, otherwise should give KErrNoMemory in AO
+ TestSchedulerCatchesError(&TranslateBigAllocL, KErrNoMemory);
+}
+
+void tst_qmainexceptions::TestSymbianRoundTrip(int leave, int trap)
+{
+ // check that leave converted to exception, converted to error gives expected error code
+ int trapped;
+ QT_TRYCATCH_ERROR(
+ trapped,
+ QT_TRAP_THROWING(
+ User::LeaveIfError(leave)));
+ QCOMPARE(trap, trapped);
+}
+
+void tst_qmainexceptions::TestStdRoundTrip(const std::exception& thrown, const std::exception& caught)
+{
+ bool ok = false;
+ try {
+ QT_TRAP_THROWING(qt_symbian_exception2LeaveL(thrown));
+ } catch (const std::exception& ex) {
+ const std::type_info& exType = typeid(ex);
+ const std::type_info& caughtType = typeid(caught);
+ QCOMPARE(exType, caughtType);
+ ok = true;
+ }
+ QCOMPARE(ok, true);
+}
+
+void tst_qmainexceptions::testRoundTrip()
+{
+ for (int e=-50; e<0; e++)
+ TestSymbianRoundTrip(e, e);
+ TestSymbianRoundTrip(KErrNone, KErrNone);
+ // positive error codes are not errors
+ TestSymbianRoundTrip(1, KErrNone);
+ TestSymbianRoundTrip(1000000000, KErrNone);
+ TestStdRoundTrip(std::bad_alloc(), std::bad_alloc());
+ TestStdRoundTrip(std::invalid_argument("abc"), std::invalid_argument(""));
+ TestStdRoundTrip(std::underflow_error("abc"), std::underflow_error(""));
+ TestStdRoundTrip(std::overflow_error("abc"), std::overflow_error(""));
+}
+
+void tst_qmainexceptions::testTrap()
+{
+ // testing qt_exception2SymbianLeaveL
+ TRAPD(err, qt_symbian_exception2LeaveL(std::bad_alloc()));
+ QCOMPARE(err, KErrNoMemory);
+}
+
+bool tst_qmainexceptions::event(QEvent *aEvent)
+{
+ if (aEvent->type() == QEvent::User+1)
+ throw std::bad_alloc();
+ else if (aEvent->type() == QEvent::User+2) {
+ QEvent event(QEvent::Type(QEvent::User+1));
+ QApplication::sendEvent(this, &event);
+ }
+ return QObject::event(aEvent);
+}
+
+void tst_qmainexceptions::testPropagation()
+{
+ // test exception thrown from event is propagated back to sender
+ QEvent event(QEvent::Type(QEvent::User+1));
+ bool caught = false;
+ try {
+ QApplication::sendEvent(this, &event);
+ } catch (const std::bad_alloc&) {
+ caught = true;
+ }
+ QCOMPARE(caught, true);
+
+ // testing nested events propagate back to top level sender
+ caught = false;
+ QEvent event2(QEvent::Type(QEvent::User+2));
+ try {
+ QApplication::sendEvent(this, &event2);
+ } catch (const std::bad_alloc&) {
+ caught = true;
+ }
+ QCOMPARE(caught, true);
+}
+
+void tst_qmainexceptions::testDtor1()
+{
+ // destructors work on exception
+ int i = 0;
+ struct SAutoInc {
+ SAutoInc(int& aI) : i(aI) { ++i; }
+ ~SAutoInc() { --i; }
+ int &i;
+ } ai(i);
+ QCOMPARE(i, 1);
+ try {
+ SAutoInc ai2(i);
+ QCOMPARE(i, 2);
+ throw std::bad_alloc();
+ QFAIL("should not get here");
+ } catch (const std::bad_alloc&) {
+ QCOMPARE(i, 1);
+ }
+ QCOMPARE(i, 1);
+}
+
+void tst_qmainexceptions::testDtor2()
+{
+ // memory is cleaned up correctly on exception
+ // this crashes with winscw compiler build < 481
+ __UHEAP_MARK;
+ try {
+ QString str("abc");
+ str += "def";
+ throw std::bad_alloc();
+ QFAIL("should not get here");
+ } catch (const std::bad_alloc&) { }
+ __UHEAP_MARKEND;
+}
+
+void tst_qmainexceptions::testNestedExceptions()
+{
+ // throwing exceptions while handling exceptions
+ struct Oops {
+ Oops* next;
+ Oops(int level) : next(level > 0 ? new Oops(level-1) : 0) {}
+ ~Oops() {
+ try { throw std::bad_alloc(); }
+ catch (const std::exception&) {delete next;}
+ }
+ };
+ try {
+ Oops oops(5);
+ throw std::bad_alloc();
+ }
+ catch (const std::exception&) {}
+}
+
+class CTestRef : public CBase
+{
+public:
+ CTestRef(int& aX) : iX(aX) { iX++; }
+ ~CTestRef() { iX--; }
+ int& iX;
+};
+
+void tst_qmainexceptions::testScopedPointer()
+{
+ int x = 0;
+ {
+ QScopedPointer<CTestRef> ptr(q_check_ptr(new CTestRef(x)));
+ QCOMPARE(x, 1);
+ }
+ QCOMPARE(x, 0);
+ try {
+ QScopedPointer<CTestRef> ptr(q_check_ptr(new CTestRef(x)));
+ QCOMPARE(x, 1);
+ throw 1;
+ } catch (int) {
+ QCOMPARE(x, 0);
+ }
+ QCOMPARE(x, 0);
+}
+
+int dtorFired[20];
+int* recDtor;
+
+class CDtorOrder : public CBase
+{
+public:
+ CDtorOrder(TInt aId) : iId(aId) {}
+ ~CDtorOrder() { *(recDtor++)=iId; }
+ TInt iId;
+};
+
+class QDtorOrder
+{
+public:
+ QDtorOrder(int aId) : iId(aId) {}
+ ~QDtorOrder() { *(recDtor++)=iId; }
+ int iId;
+};
+
+class RDtorOrder : public RHandleBase
+{
+public:
+ TInt Connect(TInt aId) {iId = aId; SetHandle(aId); return KErrNone; }
+ void Close() { *(recDtor++)=iId; }
+ TInt iId;
+};
+
+enum THybridAction {EHybridLeave, EHybridThrow, EHybridPass};
+
+void HybridFuncLX(THybridAction aAction)
+{
+ recDtor = dtorFired;
+ QDtorOrder q1(1);
+ {QDtorOrder q2(2);}
+ CDtorOrder* c1 = new(ELeave) CDtorOrder(11);
+ CleanupStack::PushL(c1);
+ {LManagedHandle<RDtorOrder> r1;
+ r1->Connect(21) OR_LEAVE;}
+ CDtorOrder* c2 = new(ELeave) CDtorOrder(12);
+ CleanupStack::PushL(c2);
+ QDtorOrder q3(3);
+ LManagedHandle<RDtorOrder> r2;
+ r2->Connect(22) OR_LEAVE;
+ CDtorOrder* c3 = new(ELeave) CDtorOrder(13);
+ CleanupStack::PushL(c3);
+ CleanupStack::PopAndDestroy(c3);
+ QDtorOrder q4(4);
+ switch (aAction)
+ {
+ case EHybridLeave:
+ User::Leave(KErrNotFound);
+ break;
+ case EHybridThrow:
+ throw std::bad_alloc();
+ break;
+ default:
+ break;
+ }
+ CleanupStack::PopAndDestroy(2);
+}
+
+void tst_qmainexceptions::testHybrid()
+{
+ TRAPD(error,
+ QT_TRYCATCH_LEAVING(
+ HybridFuncLX(EHybridLeave);
+ ) );
+ QCOMPARE(error, KErrNotFound);
+ int expected1[] = {2, 21, 13, 12, 11, 4, 22, 3, 1};
+ QCOMPARE(int(sizeof(expected1)/sizeof(int)), int(recDtor - dtorFired));
+ for (int i=0; i<sizeof(expected1)/sizeof(int); i++)
+ QCOMPARE(expected1[i], dtorFired[i]);
+
+ TRAP(error,
+ QT_TRYCATCH_LEAVING(
+ HybridFuncLX(EHybridThrow);
+ ) );
+ QCOMPARE(error, KErrNoMemory);
+ int expected2[] = {2, 21, 13, 4, 22, 3, 1, 12, 11};
+ QCOMPARE(int(sizeof(expected2)/sizeof(int)), int(recDtor - dtorFired));
+ for (int i=0; i<sizeof(expected2)/sizeof(int); i++)
+ QCOMPARE(expected2[i], dtorFired[i]);
+
+ TRAP(error,
+ QT_TRYCATCH_LEAVING(
+ HybridFuncLX(EHybridPass);
+ ) );
+ QCOMPARE(error, KErrNone);
+ int expected3[] = {2, 21, 13, 12, 11, 4, 22, 3, 1};
+ QCOMPARE(int(sizeof(expected3)/sizeof(int)), int(recDtor - dtorFired));
+ for (int i=0; i<sizeof(expected3)/sizeof(int); i++)
+ QCOMPARE(expected3[i], dtorFired[i]);
+}
+
+
+QTEST_MAIN(tst_qmainexceptions)
+#include "tst_qmainexceptions.moc"
+#else
+QTEST_NOOP_MAIN
+#endif
diff --git a/tests/auto/symbian/qsymbiantests.pro b/tests/auto/symbian/qsymbiantests.pro
new file mode 100644
index 0000000..648335e
--- /dev/null
+++ b/tests/auto/symbian/qsymbiantests.pro
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS = qmainexceptions orientationchange \ No newline at end of file
diff --git a/tests/auto/uiloader/uiloader/tst_uiloader.cpp b/tests/auto/uiloader/uiloader/tst_uiloader.cpp
index 553fb9c..505ef0a 100644
--- a/tests/auto/uiloader/uiloader/tst_uiloader.cpp
+++ b/tests/auto/uiloader/uiloader/tst_uiloader.cpp
@@ -46,6 +46,9 @@
#include <QApplication>
#include <QDir>
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR ""
+#endif
class uiLoaderAutotest: public QObject
{
diff --git a/tests/auto/uiloader/uiloader/uiloader.pro b/tests/auto/uiloader/uiloader/uiloader.pro
index 1c4da0b..d99df00 100644
--- a/tests/auto/uiloader/uiloader/uiloader.pro
+++ b/tests/auto/uiloader/uiloader/uiloader.pro
@@ -3,7 +3,7 @@ load(qttest_p4)
TEMPLATE = app
!embedded:CONFIG += uitools
TARGET = ../tst_uiloader
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\"
win32 {
CONFIG(debug, debug|release) {
@@ -16,7 +16,7 @@ win32 {
QT += xml svg network
contains(QT_CONFIG, qt3support): QT += qt3support
-wince*: {
+wince*|symbian: {
configuration.sources = ../*.ini
configuration.path = .
diff --git a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp
index f054f57..a81b1da 100644
--- a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp
+++ b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp
@@ -102,6 +102,8 @@ tst_XmlPatterns::tst_XmlPatterns() : m_generatedTests(0)
, m_command(QLatin1String("xmlpatterns"))
, m_dontRun(false)
{
+ Q_SET_DEFAULT_IAP
+
Q_ASSERT(m_normalizeTestName.isValid());
Q_ASSERT(m_filenameInStderr.isValid());
}