summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/arthur/common/paintcommands.cpp7
-rw-r--r--tests/arthur/common/paintcommands.h2
-rw-r--r--tests/arthur/common/qengines.cpp7
-rw-r--r--tests/arthur/common/qengines.h3
-rw-r--r--tests/arthur/lance/lance.pro8
-rw-r--r--tests/arthur/lance/main.cpp7
-rw-r--r--tests/auto/JoinResults.py66
-rw-r--r--tests/auto/_Categories/Qt3Support.txt51
-rw-r--r--tests/auto/_Categories/QtCore.txt108
-rw-r--r--tests/auto/_Categories/QtDBus.txt15
-rw-r--r--tests/auto/_Categories/QtGui.txt192
-rw-r--r--tests/auto/_Categories/QtHelp.txt5
-rw-r--r--tests/auto/_Categories/QtNetwork.txt31
-rw-r--r--tests/auto/_Categories/QtOpenGl.txt1
-rw-r--r--tests/auto/_Categories/QtScript.txt13
-rw-r--r--tests/auto/_Categories/QtSql.txt12
-rw-r--r--tests/auto/_Categories/QtSvg.txt3
-rw-r--r--tests/auto/_Categories/QtTest.txt1
-rw-r--r--tests/auto/_Categories/QtWebkit.txt2
-rw-r--r--tests/auto/_Categories/QtXml.txt5
-rw-r--r--tests/auto/_Categories/QtXmlPatterns.txt27
-rw-r--r--tests/auto/_Categories/all_categories.txt16
-rw-r--r--tests/auto/_Categories/phonon.txt2
-rw-r--r--tests/auto/_Categories/qmake.txt0
-rw-r--r--tests/auto/_networkselftest/_networkselftest.pro2
-rw-r--r--tests/auto/_networkselftest/tst_networkselftest.cpp30
-rw-r--r--tests/auto/auto.pro2
-rw-r--r--tests/auto/autobuildruncategory.bat11
-rw-r--r--tests/auto/autobuildrunsingle.bat71
-rw-r--r--tests/auto/autobuildtests.bat19
-rw-r--r--tests/auto/autobuildtestsmain.bat38
-rw-r--r--tests/auto/checkxmlfiles/checkxmlfiles.pro2
-rw-r--r--tests/auto/collections/collections.pro4
-rw-r--r--tests/auto/collections/tst_collections.cpp6
-rw-r--r--tests/auto/compilecategory.bat4
-rw-r--r--tests/auto/compilerwarnings/compilerwarnings.pro1
-rw-r--r--tests/auto/compilesingle.bat28
-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.h198
-rw-r--r--tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp232
-rw-r--r--tests/auto/headers/headers.pro2
-rw-r--r--tests/auto/languagechange/tst_languagechange.cpp20
-rw-r--r--tests/auto/network-settings.h277
-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.cpp13
-rw-r--r--tests/auto/qabstractmessagehandler/qabstractmessagehandler.pro1
-rw-r--r--tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro2
-rw-r--r--tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp12
-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/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.cpp6
-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.cpp19
-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.pro8
-rw-r--r--tests/auto/qcssparser/tst_cssparser.cpp4
-rw-r--r--tests/auto/qdatastream/qdatastream.pro11
-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.cpp25
-rw-r--r--tests/auto/qdebug/qdebug.pro4
-rw-r--r--tests/auto/qdesktopservices/qdesktopservices.pro25
-rw-r--r--tests/auto/qdesktopservices/tst_qdesktopservices.cpp203
-rw-r--r--tests/auto/qdir/qdir.pro9
-rw-r--r--tests/auto/qdir/tst_qdir.cpp116
-rw-r--r--tests/auto/qdiriterator/qdiriterator.pro2
-rw-r--r--tests/auto/qdiriterator/tst_qdiriterator.cpp7
-rw-r--r--tests/auto/qdirmodel/qdirmodel.pro11
-rw-r--r--tests/auto/qdirmodel/tst_qdirmodel.cpp28
-rw-r--r--tests/auto/qdom/qdom.pro4
-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.pro7
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp27
-rw-r--r--tests/auto/qfileinfo/qfileinfo.pro3
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp51
-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.cpp5
-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/qftp/.gitattributes2
-rw-r--r--tests/auto/qftp/qftp.pro5
-rw-r--r--tests/auto/qftp/tst_qftp.cpp34
-rw-r--r--tests/auto/qgetputenv/qgetputenv.pro4
-rw-r--r--tests/auto/qglobal/qglobal.pro3
-rw-r--r--tests/auto/qglobal/tst_qglobal.cpp62
-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.cpp4
-rw-r--r--tests/auto/qgroupbox/tst_qgroupbox.cpp84
-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.cpp21
-rw-r--r--tests/auto/qhttp/qhttp.pro8
-rw-r--r--tests/auto/qhttp/tst_qhttp.cpp279
-rw-r--r--tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp28
-rw-r--r--tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp35
-rw-r--r--tests/auto/qicoimageformat/qicoimageformat.pro7
-rw-r--r--tests/auto/qicoimageformat/tst_qticoimageformat.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.pro10
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp4
-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.cpp216
-rw-r--r--tests/auto/qiodevice/qiodevice.pro5
-rw-r--r--tests/auto/qiodevice/tst_qiodevice.cpp9
-rw-r--r--tests/auto/qitemdelegate/tst_qitemdelegate.cpp7
-rw-r--r--tests/auto/qitemmodel/qitemmodel.pro2
-rw-r--r--tests/auto/qitemview/tst_qitemview.cpp9
-rw-r--r--tests/auto/qkeyevent/tst_qkeyevent.cpp59
-rw-r--r--tests/auto/qkeysequence/tst_qkeysequence.cpp2
-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.pro3
-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.cpp87
-rw-r--r--tests/auto/qlocalsocket/lackey/lackey.pro2
-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.pro20
-rw-r--r--tests/auto/qlocalsocket/tst_qlocalsocket.cpp94
-rw-r--r--tests/auto/qmainwindow/qmainwindow.pro3
-rw-r--r--tests/auto/qmap/qmap.pro4
-rw-r--r--tests/auto/qmenu/tst_qmenu.cpp9
-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.pro4
-rw-r--r--tests/auto/qmutex/qmutex.pro2
-rw-r--r--tests/auto/qmutexlocker/qmutexlocker.pro2
-rw-r--r--tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp29
-rw-r--r--tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp7
-rw-r--r--tests/auto/qnetworkreply/.gitattributes5
-rw-r--r--tests/auto/qnetworkreply/echo/echo.pro2
-rw-r--r--tests/auto/qnetworkreply/test/test.pro16
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp102
-rw-r--r--tests/auto/qnumeric/qnumeric.pro3
-rw-r--r--tests/auto/qobject/tst_qobject.cpp16
-rw-r--r--tests/auto/qobject/tst_qobject.pro6
-rw-r--r--tests/auto/qobjectrace/qobjectrace.pro3
-rw-r--r--tests/auto/qobjectrace/tst_qobjectrace.cpp30
-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.cpp118
-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.pro10
-rw-r--r--tests/auto/qpluginloader/tst_qpluginloader.cpp65
-rw-r--r--tests/auto/qpoint/qpoint.pro5
-rw-r--r--tests/auto/qpointarray/qpointarray.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.cpp273
-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.pro12
-rw-r--r--tests/auto/qresourceengine/tst_resourceengine.cpp4
-rw-r--r--tests/auto/qscopedpointer/.gitignore1
-rw-r--r--tests/auto/qscopedpointer/qscopedpointer.pro3
-rw-r--r--tests/auto/qscopedpointer/tst_qscopedpointer.cpp282
-rw-r--r--tests/auto/qscriptengine/qscriptengine.pro5
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp6
-rw-r--r--tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro9
-rw-r--r--tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp2
-rw-r--r--tests/auto/qscriptqobject/qscriptqobject.pro4
-rw-r--r--tests/auto/qscriptqobject/tst_qscriptqobject.cpp6
-rw-r--r--tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro4
-rw-r--r--tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp5
-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.cpp32
-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.cpp92
-rw-r--r--tests/auto/qsocks5socketengine/qsocks5socketengine.pro2
-rw-r--r--tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp54
-rw-r--r--tests/auto/qsound/qsound.pro2
-rw-r--r--tests/auto/qsplitter/qsplitter.pro2
-rw-r--r--tests/auto/qsql/qsql.pro8
-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.pro6
-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.cpp88
-rw-r--r--tests/auto/qstandarditem/tst_qstandarditem.cpp4
-rw-r--r--tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp4
-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.pro5
-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.cpp40
-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.cpp90
-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.pro2
-rw-r--r--tests/auto/qtextcodec/tst_qtextcodec.cpp5
-rw-r--r--tests/auto/qtextedit/qtextedit.pro9
-rw-r--r--tests/auto/qtextedit/tst_qtextedit.cpp33
-rw-r--r--tests/auto/qtextlayout/qtextlayout.pro3
-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.pro11
-rw-r--r--tests/auto/qtextstream/tst_qtextstream.cpp26
-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.cpp89
-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.cpp103
-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.cpp133
-rw-r--r--tests/auto/qwidget/qwidget.pro6
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp133
-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.pro2
-rw-r--r--tests/auto/qxmlquery/tst_qxmlquery.cpp1
-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.pro5
-rw-r--r--tests/auto/symbian/qmainexceptions/tst_qmainexceptions.cpp318
-rw-r--r--tests/auto/symbian/qsymbiantests.pro2
-rw-r--r--tests/auto/xmlpatterns/tst_xmlpatterns.cpp2
-rw-r--r--tests/benchmarks/qfile/main.cpp5
-rw-r--r--tests/benchmarks/qgraphicsview/benchapps/scrolltest/main.cpp2
-rw-r--r--tests/benchmarks/qiodevice/main.cpp2
-rwxr-xr-xtests/benchmarks/qiodevice/qiodevice.pro1
380 files changed, 11680 insertions, 1629 deletions
diff --git a/tests/arthur/common/paintcommands.cpp b/tests/arthur/common/paintcommands.cpp
index 7d8617c849..7d18196ce5 100644
--- a/tests/arthur/common/paintcommands.cpp
+++ b/tests/arthur/common/paintcommands.cpp
@@ -351,7 +351,7 @@ void PaintCommands::staticInit()
"^gradient_setCoordinateMode\\s+(\\w*)$",
"gradient_setCoordinateMode <coordinate method enum>",
"gradient_setCoordinateMode ObjectBoundingMode");
-
+#ifdef QT3_SUPPORT
DECL_PAINTCOMMANDSECTION("qt3 drawing ops");
DECL_PAINTCOMMAND("qt3_drawArc", command_qt3_drawArc,
"^qt3_drawArc\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)$",
@@ -377,7 +377,7 @@ void PaintCommands::staticInit()
"^qt3_drawRoundRect\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s*(-?\\w)?\\s*(-?\\w)?$",
"qt3_drawRoundRect <x> <y> <w> <h> [rx] [ry]",
"qt3_drawRoundRect 10 10 20 20 3 3");
-
+#endif
DECL_PAINTCOMMANDSECTION("drawing ops");
DECL_PAINTCOMMAND("drawPoint", command_drawPoint,
"^drawPoint\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)$",
@@ -1237,6 +1237,7 @@ void PaintCommands::command_drawArc(QRegExp re)
m_painter->drawArc(x, y, w, h, angle, sweep);
}
+#ifdef QT3_SUPPORT
/***************************************************************************************************/
void PaintCommands::command_qt3_drawRect(QRegExp re)
{
@@ -1352,7 +1353,7 @@ void PaintCommands::command_qt3_drawArc(QRegExp re)
static_cast<Q3Painter*>(m_painter)->drawArc(x, y, w, h, angle, sweep);
#endif
}
-
+#endif //QT3_SUPPORT
/***************************************************************************************************/
void PaintCommands::command_drawText(QRegExp re)
{
diff --git a/tests/arthur/common/paintcommands.h b/tests/arthur/common/paintcommands.h
index 91aad0f689..2c346d7be7 100644
--- a/tests/arthur/common/paintcommands.h
+++ b/tests/arthur/common/paintcommands.h
@@ -181,12 +181,14 @@ private:
void command_gradient_setCoordinateMode(QRegExp re);
// commands: drawing ops
+#ifdef QT3_SUPPORT
void command_qt3_drawArc(QRegExp re);
void command_qt3_drawChord(QRegExp re);
void command_qt3_drawEllipse(QRegExp re);
void command_qt3_drawPie(QRegExp re);
void command_qt3_drawRect(QRegExp re);
void command_qt3_drawRoundRect(QRegExp re);
+#endif
void command_drawArc(QRegExp re);
void command_drawChord(QRegExp re);
void command_drawConvexPolygon(QRegExp re);
diff --git a/tests/arthur/common/qengines.cpp b/tests/arthur/common/qengines.cpp
index ce1afe419c..00677ac36f 100644
--- a/tests/arthur/common/qengines.cpp
+++ b/tests/arthur/common/qengines.cpp
@@ -101,6 +101,7 @@ void QtEngines::init()
m_engines << new GLEngine;
#endif
+#ifndef QT_NO_PRINTER
m_engines << new PDFEngine
#ifdef Q_WS_X11
<< new PSEngine
@@ -109,7 +110,8 @@ void QtEngines::init()
<< new WinPrintEngine
#endif
;
-
+#endif //QT_NO_PRINTER
+
m_foreignEngines << new RSVGEngine;
}
@@ -433,7 +435,7 @@ void WidgetEngine::cleanup()
delete m_widget;
}
-
+#ifndef QT_NO_PRINTER
PDFEngine::PDFEngine()
{
}
@@ -606,6 +608,7 @@ void PSEngine::cleanup()
delete printer; printer = 0;
}
#endif
+#endif //QT_NO_PRINTER
RSVGEngine::RSVGEngine()
{
diff --git a/tests/arthur/common/qengines.h b/tests/arthur/common/qengines.h
index 38ec480d11..b7c835320d 100644
--- a/tests/arthur/common/qengines.h
+++ b/tests/arthur/common/qengines.h
@@ -158,6 +158,7 @@ private:
WidgetEngineWidget *m_widget;
};
+#ifndef QT_NO_PRINTER
class PDFEngine : public QEngine
{
public:
@@ -218,7 +219,7 @@ private:
QString m_tempFile;
};
#endif
-
+#endif //QT_NO_PRINTER
class RSVGEngine : public QEngine
{
diff --git a/tests/arthur/lance/lance.pro b/tests/arthur/lance/lance.pro
index ee9e08b6c6..3692f21afa 100644
--- a/tests/arthur/lance/lance.pro
+++ b/tests/arthur/lance/lance.pro
@@ -12,6 +12,12 @@ RESOURCES += icons.qrc
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2):QT += opengl
contains(QT_CONFIG, qt3support):QT += qt3support
-QT += xml svg
+symbian*: {
+ testData.sources = $$QT_BUILD_TREE/tests/arthur/data/qps
+ testData.path = .
+ DEPLOYMENT += testData
+}
+
+QT += xml svg
diff --git a/tests/arthur/lance/main.cpp b/tests/arthur/lance/main.cpp
index f95b426238..b199cd50b8 100644
--- a/tests/arthur/lance/main.cpp
+++ b/tests/arthur/lance/main.cpp
@@ -199,7 +199,6 @@ static void displayCommands()
" pixmap_load filename name_in_script\n"
" image_load filename name_in_script\n");
}
-
static InteractiveWidget *interactive_widget = 0;
static void runInteractive()
@@ -581,6 +580,7 @@ int main(int argc, char **argv)
case PrinterType:
{
+#ifndef QT_NO_PRINTER
PaintCommands pcmd(QStringList(), 800, 800);
pcmd.setVerboseMode(verboseMode);
pcmd.setType(type);
@@ -608,11 +608,13 @@ int main(int argc, char **argv)
}
Q_ASSERT(!p.paintingActive());
+#endif
break;
}
case PsType:
case PdfType:
{
+#ifndef QT_NO_PRINTER
PaintCommands pcmd(QStringList(), 800, 800);
pcmd.setVerboseMode(verboseMode);
pcmd.setType(type);
@@ -635,6 +637,7 @@ int main(int argc, char **argv)
pt.end();
printf("write file: %s\n", qPrintable(file));
+#endif
break;
}
case GrabType:
@@ -657,7 +660,6 @@ int main(int argc, char **argv)
printf("%s grabbed to %s\n", qPrintable(files.at(j)), qPrintable(filename));
break;
}
-
default:
break;
}
@@ -668,7 +670,6 @@ int main(int argc, char **argv)
QObject::connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
app.exec();
}
-
delete activeWidget;
#endif
return 0;
diff --git a/tests/auto/JoinResults.py b/tests/auto/JoinResults.py
new file mode 100644
index 0000000000..8a98572f60
--- /dev/null
+++ b/tests/auto/JoinResults.py
@@ -0,0 +1,66 @@
+import string, sys, os, datetime, time, re
+import socket
+
+Enviroment=''
+RstPath=''
+QtVersion=''
+
+def JoinResults():
+ timestamp = time.localtime()
+
+ #result_qt_WITH_symbian_ON_2008-05-15_09-42-48_USING_4.4.0-rc1.xml
+ rstFileName = time.strftime(RstPath+'\\result\\result_qt_WITH_symbian_ON_%Y-%m-%d_%H-%M-%S_USING_'+QtVersion+'.xml', timestamp)
+ rst = open(rstFileName,'w')
+
+ rst.write('<?xml version="1.0" encoding="ISO-8859-1"?>\n')
+ rst.write('<Testrun>\n')
+ rst.write('<Environment>\n')
+ rst.write('<HostName>'+socket.gethostname()+'</HostName>\n')
+ rst.write('<MakeSpec>symbian-'+Enviroment+'</MakeSpec>\n')
+ rst.write('</Environment>\n')
+ rst.write(time.strftime('<Timestamp date="%Y-%m-%d" time="%H:%M:%S"/>\n',timestamp))
+
+
+ for root, dirs, files in os.walk(RstPath):
+ for name in files:
+ if not re.search('result_qt_WITH_', name ) and \
+ re.match(name.split('.')[1], 'xml'):
+ rst.write('<TestCase name="'+name.split('.')[0]+'">\n')
+ path = root+'/'+name
+ temp = open(path,'r')
+ templines = temp.readlines()
+ Validate( templines )
+ rst.writelines(templines);
+ temp.close()
+ rst.write('</TestCase>\n')
+
+ rst.write('</Testrun>\n')
+ rst.close
+
+def Validate(lines):
+ regexp1 = re.compile('\s*</TestFunction>\s*')
+ regexp2 = re.compile('\s*<TestFunction name=\s*')
+ regexp1Flag = False
+ regexp2Flag = False
+ for index, line in enumerate(lines):
+ if len(line) > 0 and regexp1.search(line):
+ if regexp1Flag:
+ lines[index] = ''
+ else:
+ regexp1Flag = True
+ elif len(line) > 0 and regexp2.search(line):
+ if regexp2Flag:
+ lines[index] = ''
+ else:
+ regexp2Flag = True
+ else:
+ regexp1Flag = False
+ regexp2Flag = False
+
+
+if __name__ == '__main__':
+ Enviroment = sys.argv[1]
+ RstPath = sys.argv[2]
+ QtVersion = sys.argv[3]
+
+ JoinResults()
diff --git a/tests/auto/_Categories/Qt3Support.txt b/tests/auto/_Categories/Qt3Support.txt
new file mode 100644
index 0000000000..a55523c383
--- /dev/null
+++ b/tests/auto/_Categories/Qt3Support.txt
@@ -0,0 +1,51 @@
+q3accel
+q3action
+q3actiongroup
+q3buttongroup
+q3canvas
+q3checklistitem
+q3combobox
+q3cstring
+q3databrowser
+q3dateedit
+q3datetimeedit
+q3deepcopy
+q3dict
+q3dns
+q3dockwindow
+q3filedialog
+q3frame
+q3groupbox
+q3hbox
+q3header
+q3iconview
+q3listbox
+q3listview
+q3listviewitemiterator
+q3mainwindow
+q3popupmenu
+q3process
+q3progressbar
+q3progressdialog
+q3ptrlist
+q3richtext
+q3scrollview
+q3semaphore
+q3serversocket
+q3socket
+q3socketdevice
+q3sqlcursor
+q3sqlselectcursor
+q3stylesheet
+q3tabdialog
+q3table
+q3textbrowser
+q3textedit
+q3textstream
+q3timeedit
+q3toolbar
+q3uridrag
+q3urloperator
+q3valuelist
+q3valuevector
+q3widgetstack
diff --git a/tests/auto/_Categories/QtCore.txt b/tests/auto/_Categories/QtCore.txt
new file mode 100644
index 0000000000..7238bf88dd
--- /dev/null
+++ b/tests/auto/_Categories/QtCore.txt
@@ -0,0 +1,108 @@
+# QtCore
+
+collections
+exceptionsafety
+qabstractitemmodel
+#Requires STL
+qalgorithms
+qatomicint
+qatomicpointer
+qbitarray
+qbuffer
+qbytearray
+qbytearraymatcher
+qcache
+qchar
+qcoreapplication
+qcryptographichash
+qdatastream
+qdate
+qdatetime
+qdebug
+qdir
+qdiriterator
+qevent
+qeventloop
+qexplicitlyshareddatapointer
+qfile cetest-subdir: test
+qfileinfo
+qfilesystemwatcher
+qflags
+qfuture
+qfuturewatcher
+qgetputenv
+qglobal
+qhash
+qiodevice
+qlibrary cetest-subdir: tst
+qline
+qlist
+qlocale cetest-subdir: test
+qmap
+qmetaobject
+qmetatype
+qmutex
+qmutexlocker
+qnumeric
+qobject cetest-pro: tst_qobject.pro
+qobjectperformance
+qobjectrace
+qplugin cetest-pro: tst_qplugin.pro
+qpluginloader cetest-subdir: tst
+qpoint
+qpointer
+qprocess cetest-subdir: test
+qqueue
+qrand
+qreadlocker
+qreadwritelock
+qrect
+qregexp
+qresourceengine
+qsemaphore
+qset
+qsettings
+qsharedmemory cetest-subdir: test
+qsharedpointer
+qsignalmapper
+qsignalspy
+qsize
+qsizef
+qsocketnotifier
+#Requires STL
+qstl
+qstring
+qstringlist
+qstringmatcher
+qsysinfo
+qsystemsemaphore cetest-subdir: test
+#qtconcurrentfilter Not supported yet for s60 -> skip(std)
+# Uses std, though unclear if it is actually needed. To be re-investigated when QT_NO_CONCURRENT is removed.
+#qtconcurrentiteratekernel
+#qtconcurrentmap not supported yet for s60 -> skip(std)
+qtconcurrentrun
+qtconcurrentthreadengine
+qtemporaryfile
+qtextboundaryfinder
+qtextcodec
+qtextstream cetest-subdir: test
+qthread
+qthreadonce
+qthreadpool
+qthreadstorage
+qtime
+qtimeline
+qtimer
+# Requires MD5 Qt solutions to work
+#qtmd5
+qtranslator
+qurl
+quuid
+qvariant
+qvarlengtharray
+qvector
+qwaitcondition
+qwineventnotifier
+qwritelocker
+q_func_info
+utf8
diff --git a/tests/auto/_Categories/QtDBus.txt b/tests/auto/_Categories/QtDBus.txt
new file mode 100644
index 0000000000..26490f1460
--- /dev/null
+++ b/tests/auto/_Categories/QtDBus.txt
@@ -0,0 +1,15 @@
+qdbusabstractadaptor
+qdbusconnection
+qdbuscontext
+qdbusinterface
+qdbuslocalcalls
+qdbusmarshall
+qdbusmetaobject
+qdbusmetatype
+qdbuspendingcall
+qdbuspendingreply
+qdbusperformance
+qdbusreply
+qdbusserver
+qdbusthreading
+qdbusxmlparser
diff --git a/tests/auto/_Categories/QtGui.txt b/tests/auto/_Categories/QtGui.txt
new file mode 100644
index 0000000000..b03a870bfc
--- /dev/null
+++ b/tests/auto/_Categories/QtGui.txt
@@ -0,0 +1,192 @@
+languagechange
+modeltest
+qabstractbutton
+qabstractitemview
+#qabstractprintdialog NO PRINTING SUPPORT
+qabstractproxymodel
+qabstractscrollarea
+qabstractslider
+qabstractspinbox
+qabstracttextdocumentlayout
+#qaccessibility Requires sql support -> disabled for now
+#qaccessibility_mac
+qaction
+qactiongroup
+qapplication cetest-subdir: test
+qboxlayout
+qbrush
+qbuttongroup
+qcalendarwidget
+qcheckbox
+qclipboard cetest-subdir: test
+qcolor
+qcolordialog
+qcolumnview
+qcombobox
+qcommandlinkbutton
+qcompleter
+qcomplextext
+#qcopchannel QCOP NOT SUPPORTED
+qcssparser
+qdatawidgetmapper
+qdatetimeedit
+qdesktopservices
+qdesktopwidget
+qdial
+qdialog
+qdialogbuttonbox
+qdirectpainter cetest-subdir: test
+qdirmodel
+qdockwidget
+qdoublespinbox
+qdoublevalidator
+qdrag
+qerrormessage
+qfiledialog
+qfileiconprovider
+qfilesystemmodel
+qfocusevent
+qfocusframe
+qfont
+qfontcombobox
+qfontdatabase
+qfontdialog
+qfontmetrics
+qformlayout
+qgraphicsgridlayout
+qgraphicsitem
+qgraphicsitemanimation
+qgraphicslayout
+qgraphicslayoutitem
+qgraphicslinearlayout
+qgraphicspixmapitem
+qgraphicspolygonitem
+qgraphicsproxywidget
+qgraphicsscene
+qgraphicsview
+qgraphicswidget
+qgridlayout
+qgroupbox
+qguivariant
+qheaderview
+qicoimageformat
+qicon
+qimage
+qimageiohandler
+qimagereader
+qimagewriter
+qinputdialog
+qintvalidator
+qitemdelegate
+qitemeditorfactory
+qitemmodel
+qitemselectionmodel
+qitemview
+qkeyevent
+qkeysequence
+qlabel
+qlayout
+qlcdnumber
+qlineedit
+qlistview
+qlistwidget
+#qmacstyle
+qmainwindow
+#qmdiarea Not relevant for S60, skip for now
+#qmdisubwindow not relevant for S60, skip for now
+qmenu
+qmenubar
+#qmessagebox that's a hanger
+qmouseevent
+qmouseevent_modal
+qmovie
+qmultiscreen
+qpaintengine
+qpainter
+qpainterpath
+qpainterpathstroker
+qpalette
+qpathclipper
+qpen
+qpicture
+qpixmap
+qpixmapcache
+qpixmapfilter
+qplaintextedit
+qpointarray
+#qprinter NO PRINTING SUPPORT ON SYMBIAN YET
+#qprinterinfo
+qprogressbar
+qprogressdialog
+qpushbutton
+qradiobutton
+qregexpvalidator
+qregion
+qscrollarea
+qscrollbar
+qshortcut
+qsidebar
+qsizegrip
+qslider
+qsortfilterproxymodel
+qsound
+qspinbox
+qsplitter
+qstackedlayout
+qstackedwidget
+qstandarditem
+qstandarditemmodel
+qstatusbar
+qstringlistmodel
+qstyle
+qstyleoption
+qstylesheetstyle
+qsyntaxhighlighter
+#qsystemtrayicon not relevant for s60, skip for now
+qtabbar
+qtableview
+qtablewidget
+qtabwidget
+qtessellator
+qtextblock
+qtextbrowser
+qtextcursor
+qtextdocument
+qtextdocumentfragment
+qtextdocumentlayout
+qtextedit
+qtextformat
+qtextlayout
+qtextlist
+qtextobject
+qtextodfwriter
+#This test can only be compiled on HW currently, because it does not use reduced exports
+#Because we are planning to use class level exports also in HW later on, there is no
+#sense to enable this at all
+#qtextpiecetable
+qtextscriptengine
+qtexttable
+qtoolbar
+qtoolbox
+qtoolbutton
+qtooltip
+qtransform
+qtransformedscreen
+qtreeview
+qtreewidget
+qtreewidgetitemiterator
+qtwidgets
+qundogroup
+qundostack
+qwidget
+qwidgetaction
+qwidget_window
+qwindowsurface
+qwizard
+qwmatrix
+qworkspace
+qwsembedwidget
+qwsinputmethod
+qwswindowsystem
+qx11info
+qzip
diff --git a/tests/auto/_Categories/QtHelp.txt b/tests/auto/_Categories/QtHelp.txt
new file mode 100644
index 0000000000..89e01fc380
--- /dev/null
+++ b/tests/auto/_Categories/QtHelp.txt
@@ -0,0 +1,5 @@
+qhelpcontentmodel
+qhelpenginecore
+qhelpgenerator
+qhelpindexmodel
+qhelpprojectdata
diff --git a/tests/auto/_Categories/QtNetwork.txt b/tests/auto/_Categories/QtNetwork.txt
new file mode 100644
index 0000000000..f5d191d1bc
--- /dev/null
+++ b/tests/auto/_Categories/QtNetwork.txt
@@ -0,0 +1,31 @@
+_networkselftest
+#qsocketnotifier
+qabstractnetworkcache
+qabstractsocket
+qftp
+qhostaddress
+qhostinfo
+qhttp
+qhttpnetworkconnection
+qhttpnetworkreply
+qhttpsocketengine
+qlocalsocket cetest-subdir: test
+qnativesocketengine
+qnetworkaddressentry
+qnetworkcachemetadata
+qnetworkcookie
+qnetworkcookiejar
+qnetworkdiskcache
+qnetworkinterface
+qnetworkproxy
+qnetworkreply cetest-subdir: test
+qnetworkrequest
+qsocks5socketengine
+qsslcertificate
+qsslcipher
+qsslerror
+qsslkey
+qsslsocket
+qtcpserver cetest-subdir: test
+qtcpsocket cetest-subdir: test
+qudpsocket cetest-subdir: test
diff --git a/tests/auto/_Categories/QtOpenGl.txt b/tests/auto/_Categories/QtOpenGl.txt
new file mode 100644
index 0000000000..a4e12badbc
--- /dev/null
+++ b/tests/auto/_Categories/QtOpenGl.txt
@@ -0,0 +1 @@
+qgl \ No newline at end of file
diff --git a/tests/auto/_Categories/QtScript.txt b/tests/auto/_Categories/QtScript.txt
new file mode 100644
index 0000000000..abd93a4bff
--- /dev/null
+++ b/tests/auto/_Categories/QtScript.txt
@@ -0,0 +1,13 @@
+qscriptable
+qscriptclass
+qscriptcontext
+qscriptcontextinfo
+qscriptengine
+qscriptengineagent
+#qscriptenginedebugger does not compile, requires QtScriptTools.lib
+qscriptjstestsuite
+qscriptqobject
+qscriptstring
+qscriptv8testsuite
+qscriptvalue
+qscriptvalueiterator
diff --git a/tests/auto/_Categories/QtSql.txt b/tests/auto/_Categories/QtSql.txt
new file mode 100644
index 0000000000..1232500962
--- /dev/null
+++ b/tests/auto/_Categories/QtSql.txt
@@ -0,0 +1,12 @@
+qsql
+qsqlbatch
+qsqldatabase
+qsqldriver
+qsqlerror
+qsqlfield
+qsqlquery
+qsqlquerymodel
+qsqlrecord
+qsqlrelationaltablemodel
+qsqltablemodel
+qsqlthread
diff --git a/tests/auto/_Categories/QtSvg.txt b/tests/auto/_Categories/QtSvg.txt
new file mode 100644
index 0000000000..8bd3cb2697
--- /dev/null
+++ b/tests/auto/_Categories/QtSvg.txt
@@ -0,0 +1,3 @@
+qsvgdevice
+qsvggenerator
+qsvgrenderer
diff --git a/tests/auto/_Categories/QtTest.txt b/tests/auto/_Categories/QtTest.txt
new file mode 100644
index 0000000000..082a028349
--- /dev/null
+++ b/tests/auto/_Categories/QtTest.txt
@@ -0,0 +1 @@
+selftests
diff --git a/tests/auto/_Categories/QtWebkit.txt b/tests/auto/_Categories/QtWebkit.txt
new file mode 100644
index 0000000000..5c29b205ae
--- /dev/null
+++ b/tests/auto/_Categories/QtWebkit.txt
@@ -0,0 +1,2 @@
+qwebframe
+qwebpage
diff --git a/tests/auto/_Categories/QtXml.txt b/tests/auto/_Categories/QtXml.txt
new file mode 100644
index 0000000000..ec5664610e
--- /dev/null
+++ b/tests/auto/_Categories/QtXml.txt
@@ -0,0 +1,5 @@
+qdom
+qxml
+qxmlinputsource
+qxmlsimplereader
+qxmlstream
diff --git a/tests/auto/_Categories/QtXmlPatterns.txt b/tests/auto/_Categories/QtXmlPatterns.txt
new file mode 100644
index 0000000000..17de3efd80
--- /dev/null
+++ b/tests/auto/_Categories/QtXmlPatterns.txt
@@ -0,0 +1,27 @@
+checkxmlfiles
+patternistexamplefiletree
+patternistexamples
+patternistheaders
+qabstractmessagehandler
+qabstracturiresolver
+qabstractxmlforwarditerator
+qabstractxmlnodemodel
+qabstractxmlreceiver
+qapplicationargumentparser
+qautoptr
+qsimplexmlnodemodel
+qsourcelocation
+qtokenautomaton
+qxmlformatter
+qxmlitem
+qxmlname
+qxmlnamepool
+qxmlnodemodelindex
+qxmlquery
+qxmlresultitems
+qxmlserializer
+xmlpatterns
+xmlpatternsdiagnosticsts
+xmlpatternsview
+xmlpatternsxqts
+xmlpatternsxslts
diff --git a/tests/auto/_Categories/all_categories.txt b/tests/auto/_Categories/all_categories.txt
new file mode 100644
index 0000000000..cc31f4b2cf
--- /dev/null
+++ b/tests/auto/_Categories/all_categories.txt
@@ -0,0 +1,16 @@
+#unsorted
+
+atwrapper
+bic
+compile
+compilerwarnings
+headers
+macgui
+macplist
+symbols
+uiloader
+moc
+rcc
+uic
+uic3
+qmake \ No newline at end of file
diff --git a/tests/auto/_Categories/phonon.txt b/tests/auto/_Categories/phonon.txt
new file mode 100644
index 0000000000..67911b3f12
--- /dev/null
+++ b/tests/auto/_Categories/phonon.txt
@@ -0,0 +1,2 @@
+mediaobject
+mediaobject_wince_ds9
diff --git a/tests/auto/_Categories/qmake.txt b/tests/auto/_Categories/qmake.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/_Categories/qmake.txt
diff --git a/tests/auto/_networkselftest/_networkselftest.pro b/tests/auto/_networkselftest/_networkselftest.pro
index 9e2ad0e91b..a2e1adf5b5 100644
--- a/tests/auto/_networkselftest/_networkselftest.pro
+++ b/tests/auto/_networkselftest/_networkselftest.pro
@@ -2,5 +2,5 @@ load(qttest_p4)
SOURCES += tst_networkselftest.cpp
QT = core network
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/_networkselftest/tst_networkselftest.cpp b/tests/auto/_networkselftest/tst_networkselftest.cpp
index cb82733214..cfb5c3caa3 100644
--- a/tests/auto/_networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/_networkselftest/tst_networkselftest.cpp
@@ -43,9 +43,17 @@
#include <QtNetwork/QtNetwork>
#include "../network-settings.h"
+#if defined(Q_OS_SYMBIAN)
+#define SRCDIR ""
+#endif
+
class tst_NetworkSelfTest: public QObject
{
Q_OBJECT
+public:
+ tst_NetworkSelfTest();
+ virtual ~tst_NetworkSelfTest();
+
private slots:
void hostTest();
void dnsResolution_data();
@@ -60,7 +68,7 @@ private slots:
void httpServer();
void httpsServer();
void httpProxy();
- void httpProxyBasicAuth();
+ void httpProxyBasicAuth();
void httpProxyNtlmAuth();
void socks5Proxy();
void socks5ProxyAuth();
@@ -303,6 +311,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
@@ -354,13 +371,18 @@ void tst_NetworkSelfTest::remotePortsOpen_data()
QTest::newRow("https") << 443;
QTest::newRow("http-proxy") << 3128;
QTest::newRow("http-proxy-auth-basic") << 3129;
- QTest::newRow("http-proxy-auth-ntlm") << 3130;
+ QTest::newRow("http-proxy-auth-ntlm") << 3130;
QTest::newRow("socks5-proxy") << 1080;
QTest::newRow("socks5-proxy-auth") << 1081;
}
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 +536,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 +551,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/auto.pro b/tests/auto/auto.pro
index b4a660003e..1e349d8272 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -1,3 +1,4 @@
+QT = core
TEMPLATE = subdirs
# Directories
@@ -245,6 +246,7 @@ SUBDIRS += _networkselftest \
qprogressdialog \
qpropertyanimation \
qpushbutton \
+ qscopedpointer \
qqueue \
qradiobutton \
qreadlocker \
diff --git a/tests/auto/autobuildruncategory.bat b/tests/auto/autobuildruncategory.bat
new file mode 100644
index 0000000000..3f434ee74c
--- /dev/null
+++ b/tests/auto/autobuildruncategory.bat
@@ -0,0 +1,11 @@
+@echo off
+REM Compile all test cases from given category file
+
+REM Create root directory for autotest results
+IF NOT EXIST %3 MKDIR %3
+
+REM Set Module variable
+FOR /F %%i IN ("%1") DO SET MODULE=%%~ni
+
+REM run single test
+FOR /F "eol=# tokens=1*" %%i in (%1) do CALL autobuildrunsingle.bat %2 %%i %3 %4 %%j %%k
diff --git a/tests/auto/autobuildrunsingle.bat b/tests/auto/autobuildrunsingle.bat
new file mode 100644
index 0000000000..adb9871924
--- /dev/null
+++ b/tests/auto/autobuildrunsingle.bat
@@ -0,0 +1,71 @@
+@echo off
+REM runtest
+
+SET QTVERSION=%4
+
+IF %1 == winscw goto winscw:
+IF %1 == armv5 goto armv5:
+IF %1 == gcce goto gcce:
+goto end:
+
+:winscw
+IF EXIST \epoc32\release\winscw\udeb\tst_%2.exe (
+ call \epoc32\release\winscw\udeb\tst_%2.exe -lightxml
+ if ERRORLEVEL 1 (
+ echo ^<TestFunction name="PANIC"^> >> \Epoc32\winscw\c\system\data\out.txt
+ echo ^<Incident type="fail" file="" line="0"^> >> \Epoc32\winscw\c\system\data\out.txt
+ echo ^<DataTag^>^<![CDATA[ message ]]^>^</DataTag^> >> \Epoc32\winscw\c\system\data\out.txt
+ echo ^<Description^>^<![CDATA['MESSAGE: TEST CASE PANICS]]^>^</Description^> >> \Epoc32\winscw\c\system\data\out.txt
+ echo ^</Incident^> >> \Epoc32\winscw\c\system\data\out.txt
+ echo ^</TestFunction^> >> \Epoc32\winscw\c\system\data\out.txt )
+ copy /Y \Epoc32\winscw\c\system\data\out.txt %3\%2.xml
+ goto end:
+) ELSE (
+goto notExist:
+)
+
+:ARMV5
+IF EXIST \epoc32\release\armv5\urel\tst_%2.exe (
+ pushd .
+ cd %2
+ IF _%5 == _cetest-subdir: (
+ echo Running cetest from subdir: %6
+ cd %6
+ )
+ IF _%5 == _cetest-pro: (
+ call cetest -release -f %6 -project-delete -lightxml -o %3\%2.xml
+ ) ELSE (
+ call cetest -release -project-delete -lightxml -o %3\%2.xml
+ )
+ if EXIST %3\%2.xml if ERRORLEVEL 1 (
+ echo ^<TestFunction name="PANIC"^> >> %3\%2.xml
+ echo ^<Incident type="fail" file="" line="0"^> >> %3\%2.xml
+ echo ^<DataTag^>^<![CDATA[ message ]]^>^</DataTag^> >> %3\%2.xml
+ echo ^<Description^>^<![CDATA['MESSAGE: TEST CASE PANICS]]^>^</Description^> >> %3\%2.xml
+ echo ^</Incident^> >> %3\%2.xml
+ echo ^</TestFunction^> >> %3\%2.xml
+ )
+ popd
+ goto end:
+) ELSE (
+goto notExist:
+)
+
+:gcce
+goto end:
+
+:notExist
+echo AAA: %3\%2.xml
+echo ^<Environment^> >> %3\%2.xml
+echo ^<QtVersion^>%QTVERSION%^</QtVersion^> >> %3\%2.xml
+echo ^<QTestVersion^>%QTVERSION%^</QTestVersion^> >> %3\%2.xml
+echo ^</Environment^> >> %3\%2.xml
+echo ^<TestFunction name="initTestCase"^> >> %3\%2.xml
+echo ^<Incident type="fail" file="" line="0"^> >> %3\%2.xml
+echo ^<DataTag^>^<![CDATA[ message ]]^>^</DataTag^> >> %3\%2.xml
+echo ^<Description^>^<![CDATA['MESSAGE: COMPILE FAIL]]^>^</Description^> >> %3\%2.xml
+echo ^</Incident^> >> %3\%2.xml
+echo ^</TestFunction^> >> %3\%2.xml
+goto end:
+
+:end
diff --git a/tests/auto/autobuildtests.bat b/tests/auto/autobuildtests.bat
new file mode 100644
index 0000000000..55ffad7585
--- /dev/null
+++ b/tests/auto/autobuildtests.bat
@@ -0,0 +1,19 @@
+@echo off
+REM NOTE: If this script is modified, it is likely that next automatic test will fail horribly,
+REM unless manual pull from repository is done before running it.
+
+
+REM Sync git
+cd ..\..\
+call git clean -dfx
+//call git reset --hard
+call git pull
+
+
+REM Auto tests builder
+REM 1. argument is enviroment: wincw, armv5 or gcce
+REM 2. argument is result's path: like \autotestResults
+REM 3. argument is path to pscp.exe: like c:\
+
+call tests\auto\autobuildtestsmain.bat %1 %2 %3
+
diff --git a/tests/auto/autobuildtestsmain.bat b/tests/auto/autobuildtestsmain.bat
new file mode 100644
index 0000000000..33ccd15512
--- /dev/null
+++ b/tests/auto/autobuildtestsmain.bat
@@ -0,0 +1,38 @@
+@echo off
+SET QTVERSION=4.4.2
+
+IF NOT EXIST %2\result\sent MKDIR %2\result\sent
+
+REM Delete old results
+del /Q %2\*.*
+
+REM Build enviroment
+set path=%cd%\bin;%path%
+make confclean
+configure -cetest -platform win32-mwc -xplatform symbian-abld -openssl-linked -qconfig symbian
+call bldmake bldfiles
+call abld clean
+call abld reallyclean
+IF %1 == winscw call abld build winscw udeb
+IF %1 == armv5 call abld build armv5 urel
+IF %1 == gcce call abld build gcce urel
+
+REM Build auto tests
+cd \qts60\tests\auto
+for %%i in (QtCore QtGui QtNetwork QtXml QtSvg QtScript) do call compilecategory.bat _Categories\%%i.txt %1
+
+
+REM run auto tests
+cd \qts60\tests\auto
+for %%i in (QtCore QtGui QtNetwork QtXml QtSvg QtScript) do call autobuildruncategory.bat _Categories\%%i.txt %1 %2 %QTVERSION%
+
+REM Collect test results
+cd \qts60\tests\auto
+echo call python joinresults.py %1 %2 %QTVERSION%
+call python joinresults.py %1 %2 %QTVERSION%
+
+REM send the result file
+call %3pscp.exe -i "%USERPROFILE%\.ssh\puttyssh.ppk" %2\Result\*.xml qtestmaster@kramer-nokia.troll.no:/home/qtestmaster/results
+
+REM Copy the result file to different directory that it not sent again
+move %2\Result\*.xml %2\Result\sent
diff --git a/tests/auto/checkxmlfiles/checkxmlfiles.pro b/tests/auto/checkxmlfiles/checkxmlfiles.pro
index 96985c9c5e..c368c02114 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 f47c2eb2e5..876e9034c4 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 b457cc8efb..6102530135 100644
--- a/tests/auto/collections/tst_collections.cpp
+++ b/tests/auto/collections/tst_collections.cpp
@@ -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);
diff --git a/tests/auto/compilecategory.bat b/tests/auto/compilecategory.bat
new file mode 100644
index 0000000000..59e31b56e8
--- /dev/null
+++ b/tests/auto/compilecategory.bat
@@ -0,0 +1,4 @@
+@echo off
+REM Compile all test cases from given gategory file
+
+FOR /F "eol=# tokens=1*" %%i in (%1) do CALL compilesingle.bat %%i %2
diff --git a/tests/auto/compilerwarnings/compilerwarnings.pro b/tests/auto/compilerwarnings/compilerwarnings.pro
index 9e16c5ee96..beb0279094 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/compilesingle.bat b/tests/auto/compilesingle.bat
new file mode 100644
index 0000000000..a9bb5f469c
--- /dev/null
+++ b/tests/auto/compilesingle.bat
@@ -0,0 +1,28 @@
+@echo off
+REM Compile test case from folder as a parameter
+
+pushd .
+cd %1
+REM call abld reallyclean
+call qmake -r
+call bldmake bldfiles
+
+REM reallyclean is not always deleting executables for some reason, so do that explicitly before building
+
+IF %2 == winscw (
+call abld reallyclean winscw
+call del /q /f \epoc32\release\winscw\udeb\tst_%1.exe
+call abld build winscw udeb
+)
+IF %2 == armv5 (
+call abld reallyclean armv5
+call del /q /f \epoc32\release\armv5\urel\tst_%1.exe
+call abld build armv5 urel
+)
+IF %2 == gcce (
+call abld reallyclean gcce
+call del /q /f \epoc32\release\gcce\urel\tst_%1.exe
+call abld build gcce urel
+)
+
+popd \ No newline at end of file
diff --git a/tests/auto/exceptionsafety/exceptionsafety.pro b/tests/auto/exceptionsafety/exceptionsafety.pro
index 23b8f73528..d162219f7c 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 11df291dde..e42eabb6f7 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 0000000000..72a02ca9ba
--- /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 0000000000..577c59ab0c
--- /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 0000000000..d0945a4eeb
--- /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 0000000000..3c8b389f3b
--- /dev/null
+++ b/tests/auto/exceptionsafety_objects/oomsimulator.h
@@ -0,0 +1,198 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <malloc.h>
+#include <limits.h>
+#include "3rdparty/memcheck.h"
+
+/* 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();
+}
+
+static bool mallocFailActive = false;
+static int mallocFailIndex = 0;
+static int mallocCount = 0;
+
+struct AllocFailer
+{
+ inline AllocFailer() { mallocFailActive = true; setAllocFailIndex(0); }
+ inline ~AllocFailer() { deactivate(); }
+
+ inline void setAllocFailIndex(int index)
+ {
+ if (RUNNING_ON_VALGRIND) {
+ VALGRIND_ENABLE_OOM_AT_ALLOC_INDEX(VALGRIND_GET_ALLOC_INDEX + index + 1);
+ } else {
+ mallocFailIndex = index;
+ }
+ }
+
+ inline void deactivate()
+ {
+ mallocFailActive = false;
+ VALGRIND_ENABLE_OOM_AT_ALLOC_INDEX(INT_MAX);
+ }
+
+ inline int currentAllocIndex() const
+ {
+ if (RUNNING_ON_VALGRIND) {
+ return VALGRIND_GET_ALLOC_INDEX;
+ } else {
+ return mallocCount;
+ }
+ }
+};
+
+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;
+}
+
+static void *new_helper(std::size_t size)
+{
+ void *ptr = malloc(size);
+ if (!ptr)
+ throw std::bad_alloc();
+ return ptr;
+}
+
+// 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); }
+
+// 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 0000000000..dd5f8da90d
--- /dev/null
+++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp
@@ -0,0 +1,232 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QtGui>
+#include <QtTest/QtTest>
+
+QT_USE_NAMESPACE
+
+// this test only works with GLIBC (let moc run regardless, because it doesn't know about __GLIBC__)
+#if defined(QT_NO_EXCEPTIONS) || (!defined(__GLIBC__) && !defined(Q_MOC_RUN))
+ QTEST_NOOP_MAIN
+#else
+
+#include "oomsimulator.h"
+#include "3rdparty/memcheck.h"
+
+class tst_ExceptionSafetyObjects: public QObject
+{
+ Q_OBJECT
+
+public slots:
+ void initTestCase();
+
+private slots:
+ void objects_data();
+ void objects();
+
+ void widgets_data();
+ void widgets();
+};
+
+// helper structs to create an arbitrary widget
+struct AbstractObjectCreator
+{
+ virtual QObject *create(QObject *parent) = 0;
+};
+
+Q_DECLARE_METATYPE(AbstractObjectCreator *)
+
+template <typename T>
+struct ObjectCreator : public AbstractObjectCreator
+{
+ QObject *create(QObject *parent)
+ {
+ return parent ? new T(parent) : new T;
+ }
+};
+
+void tst_ExceptionSafetyObjects::objects_data()
+{
+ QTest::addColumn<AbstractObjectCreator *>("objectCreator");
+
+#define NEWROW(T) QTest::newRow(#T) << static_cast<AbstractObjectCreator *>(new ObjectCreator<T >)
+ NEWROW(QObject);
+}
+
+// create and destructs an object, and lets each and every allocation
+// during construction and destruction fail.
+static void doOOMTest(AbstractObjectCreator *creator, QObject *parent)
+{
+ AllocFailer allocFailer;
+ int currentOOMIndex = 0;
+ bool caught = false;
+
+ int allocStartIndex = 0;
+ int allocEndIndex = 0;
+ int lastAllocCount = 0;
+
+ do {
+ allocFailer.setAllocFailIndex(++currentOOMIndex);
+
+ caught = false;
+ lastAllocCount = allocEndIndex - allocStartIndex;
+ allocStartIndex = allocFailer.currentAllocIndex();
+
+ try {
+ QScopedPointer<QObject> ptr(creator->create(parent));
+ } catch (const std::bad_alloc &) {
+ caught = true;
+ }
+
+ allocEndIndex = allocFailer.currentAllocIndex();
+
+ } while (caught || allocEndIndex - allocStartIndex != lastAllocCount);
+
+ allocFailer.deactivate();
+}
+
+static bool alloc1Failed = false;
+static bool alloc2Failed = false;
+static bool alloc3Failed = false;
+static bool alloc4Failed = false;
+static bool malloc1Failed = false;
+static bool malloc2Failed = false;
+
+// 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 = true; }
+ try { delete [] new double[5]; } catch (const std::bad_alloc &) { alloc2Failed = true; }
+ void *buf = malloc(42);
+ if (buf)
+ free(buf);
+ else
+ malloc1Failed = true;
+ }
+
+ ~SelfTestObject()
+ {
+ try { delete new int; } catch (const std::bad_alloc &) { alloc3Failed = true; }
+ try { delete [] new double[5]; } catch (const std::bad_alloc &) { alloc4Failed = true; }
+ void *buf = malloc(42);
+ if (buf)
+ free(buf);
+ else
+ malloc2Failed = true;
+ }
+};
+
+void tst_ExceptionSafetyObjects::initTestCase()
+{
+ if (RUNNING_ON_VALGRIND) {
+ QVERIFY2(VALGRIND_GET_ALLOC_INDEX != -1u,
+ "You must use a valgrind with oom simulation support");
+ // running in valgrind - don't use glibc hooks
+ disableHooks();
+ }
+
+ // sanity check whether OOM simulation works
+ AllocFailer allocFailer;
+
+ // malloc fail index is 0 -> this malloc should fail.
+ void *buf = malloc(42);
+ QVERIFY(!buf);
+
+ // malloc fail index is 1 - second malloc should fail.
+ allocFailer.setAllocFailIndex(1);
+ buf = malloc(42);
+ QVERIFY(buf);
+ free(buf);
+ buf = malloc(42);
+ QVERIFY(!buf);
+
+ allocFailer.deactivate();
+
+ doOOMTest(new ObjectCreator<SelfTestObject>, 0);
+}
+
+void tst_ExceptionSafetyObjects::objects()
+{
+ QFETCH(AbstractObjectCreator *, objectCreator);
+
+ doOOMTest(objectCreator, 0);
+}
+
+template <typename T>
+struct WidgetCreator : public AbstractObjectCreator
+{
+ QObject *create(QObject *parent)
+ {
+ return parent ? new T(static_cast<QWidget *>(parent)) : new T;
+ }
+};
+
+void tst_ExceptionSafetyObjects::widgets_data()
+{
+ QTest::addColumn<AbstractObjectCreator *>("widgetCreator");
+
+#undef NEWROW
+#define NEWROW(T) QTest::newRow(#T) << static_cast<AbstractObjectCreator *>(new WidgetCreator<T >)
+ NEWROW(QWidget);
+ NEWROW(QPushButton);
+ NEWROW(QLabel);
+ NEWROW(QFrame);
+ NEWROW(QStackedWidget);
+}
+
+void tst_ExceptionSafetyObjects::widgets()
+{
+ QFETCH(AbstractObjectCreator *, widgetCreator);
+
+ doOOMTest(widgetCreator, 0);
+
+ QWidget parent;
+ doOOMTest(widgetCreator, &parent);
+}
+
+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 9da40ce00b..703da7c91b 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 b91dd83422..f856f67458 100644
--- a/tests/auto/languagechange/tst_languagechange.cpp
+++ b/tests/auto/languagechange/tst_languagechange.cpp
@@ -212,7 +212,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 +240,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 +259,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 9d658d77e6..9488fda62f 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,89 @@
**
****************************************************************************/
#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()
{
- return QString("qt-test-server");
+#ifdef Q_OS_SYMBIAN
+ loadTestSettings();
+
+ if(QtNetworkSettings::entries.contains("server.localname")) {
+ QtNetworkSettingsRecord* entry = entries["server.localname"];
+ return entry->recordValue();
+ }
+#endif
+ return QString("qttest");
+ //return QString("aspiriniks");
+ //return QString("qt-test-server");
}
static QString serverDomainName()
{
- return QString("qt-test-net");
+#ifdef Q_OS_SYMBIAN
+ loadTestSettings();
+
+ if(QtNetworkSettings::entries.contains("server.domainname")) {
+ QtNetworkSettingsRecord* entry = entries["server.domainname"];
+ return entry->recordValue();
+ }
+#endif
+ return QString("it.local");
+ //return QString("troll.no");
}
static QString serverName()
{
+#ifdef Q_OS_SYMBIAN
+ loadTestSettings();
+#endif
return serverLocalName() + "." + serverDomainName();
}
static QString winServerName()
@@ -62,14 +128,215 @@ public:
}
static QString wildcardServerName()
{
- return "qt-test-server.wildcard.dev." + serverDomainName();
+ //return "qt-test-server.wildcard.dev." + serverDomainName();
+ return "qttest.wildcard.dev." + serverDomainName();
+ }
+ static const char *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 serverIp.data();
+ }
+#endif
+ return "10.10.14.172";
+ }
+
+ 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();
+ }
+#endif
+ /*QByteArray expected( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] " );
+ 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");*/
+
+ QByteArray expected( "* OK [CAPABILITY IMAP4 IMAP4REV1] " );
+ 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 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 QT_NETWORK_LIB
static QHostAddress serverIP()
{
return QHostInfo::fromName(serverName()).addresses().first();
}
#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/patternistexamplefiletree/patternistexamplefiletree.pro b/tests/auto/patternistexamplefiletree/patternistexamplefiletree.pro
index 9e962d0976..772c833a7e 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 90fc1664e0..4092fc8e23 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 be93266016..fe4d670565 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 0000000000..e04709aa2e
--- /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 fa60affc43..b30e3fb857 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 b9a5883d6c..c5e9af371b 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 9bc660d41d..5ad1020478 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 e7b94d14e6..6a6b39510c 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,7 +455,8 @@ void tst_QAbstractItemView::basic_tests(TestView *view)
QCOMPARE(view->dragEnabled(), false);
view->setDragEnabled(true);
QCOMPARE(view->dragEnabled(), true);
-
+#endif
+
// setAlternatingRowColors
view->setAlternatingRowColors(false);
QCOMPARE(view->alternatingRowColors(), 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,7 +568,8 @@ 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();
view->tst_doAutoScroll();
diff --git a/tests/auto/qabstractmessagehandler/qabstractmessagehandler.pro b/tests/auto/qabstractmessagehandler/qabstractmessagehandler.pro
index 4b2e7b4646..5c501030c0 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 cffadb05c9..11e340d4e5 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 7768699c60..2a4a1a75fa 100644
--- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
+++ b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
@@ -81,8 +81,12 @@ public:
: QNetworkDiskCache(parent)
, gotData(false)
{
- QString location = QDesktopServices::storageLocation(QDesktopServices::DataLocation)
- + QLatin1String("/cache/");
+#ifdef Q_OS_SYMBIAN
+ QString location = QLatin1String("./cache/");
+#else
+ QString location = QDesktopServices::storageLocation(QDesktopServices::DataLocation)
+ + QLatin1String("/cache/");
+#endif
setCacheDirectory(location);
clear();
}
@@ -99,13 +103,15 @@ public:
tst_QAbstractNetworkCache::tst_QAbstractNetworkCache()
{
+ Q_SET_DEFAULT_IAP
+
QCoreApplication::setOrganizationName(QLatin1String("Trolltech"));
QCoreApplication::setApplicationName(QLatin1String("autotest_qabstractnetworkcache"));
QCoreApplication::setApplicationVersion(QLatin1String("1.0"));
}
tst_QAbstractNetworkCache::~tst_QAbstractNetworkCache()
-{
+{
}
static bool AlwaysTrue = true;
diff --git a/tests/auto/qabstracturiresolver/qabstracturiresolver.pro b/tests/auto/qabstracturiresolver/qabstracturiresolver.pro
index de9a36896e..0d76208760 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 f6dca8b0f0..6bc0c59c50 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 ad3f2b2f0b..2bd2ba4589 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 3c71baf4b5..b6bc193de7 100644
--- a/tests/auto/qaction/tst_qaction.cpp
+++ b/tests/auto/qaction/tst_qaction.cpp
@@ -242,7 +242,7 @@ void tst_QAction::setStandardKeys()
QList<QKeySequence> expected;
#ifdef Q_WS_MAC
expected << QKeySequence("CTRL+C");
-#elif defined(Q_WS_WIN) || defined(Q_WS_QWS)
+#elif defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
expected << QKeySequence("CTRL+C") << QKeySequence("CTRL+INSERT");
#else
expected << QKeySequence("CTRL+C") << QKeySequence("F16") << QKeySequence("CTRL+INSERT");
diff --git a/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro b/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro
index 904a62ace2..93a03db7ae 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 cda7940789..7c3de3cf7d 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 7cb6bfa877..f2da9d3806 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 26b5b90428..4a09d5f176 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 d4e88f607f..d192bad5dc 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 505840907c..9eab0848d1 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 182b06ab22..ec110c62cd 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 14a1665869..3c9ef53897 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 fc5842dce7..ea8365766b 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 0000000000..e04709aa2e
--- /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 f41c7ae125..d14534ba98 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 c004be1e67..e3380284bd 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 d09320bf73..728b0b646f 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 9c70e764c7..9c34fd3214 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 d8c53269d3..fca4ef687c 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 ba70cffb04..508eba1d9e 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 bcdf043724..c01f274a5e 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,7 +196,9 @@ 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
-#endif
+#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);
const QStringList stringArgument = QStringList() << "Test string.";
diff --git a/tests/auto/qcolumnview/tst_qcolumnview.cpp b/tests/auto/qcolumnview/tst_qcolumnview.cpp
index 0b3ba7a35d..f202d44076 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 60bf1c8ebd..f36a6fe622 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 67c9ac9e17..dbb90fdccb 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -1233,7 +1233,6 @@ void tst_QComboBox::insertItem()
testWidget->setEditable(true);
if (editable)
testWidget->setEditText("FOO");
-
#if defined (QT3_SUPPORT)
if (testQt3Support)
testWidget->insertItem(itemLabel, insertIndex);
@@ -1247,7 +1246,7 @@ void tst_QComboBox::insertItem()
QCOMPARE(testWidget->count(), initialItems.count() + 1);
QCOMPARE(testWidget->itemText(expectedIndex), itemLabel);
-
+
if (editable)
QCOMPARE(testWidget->currentText(), QString("FOO"));
}
@@ -1894,10 +1893,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
@@ -1914,13 +1913,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() );
}
@@ -2222,7 +2225,7 @@ void tst_QComboBox::setItemDelegate()
QComboBox comboBox;
QStyledItemDelegate *itemDelegate = new QStyledItemDelegate;
comboBox.setItemDelegate(itemDelegate);
- QCOMPARE(comboBox.itemDelegate(), itemDelegate);
+ QCOMPARE(static_cast<QStyledItemDelegate*>(comboBox.itemDelegate()), itemDelegate);
}
void tst_QComboBox::task253944_itemDelegateIsReset()
@@ -2232,10 +2235,10 @@ void tst_QComboBox::task253944_itemDelegateIsReset()
comboBox.setItemDelegate(itemDelegate);
comboBox.setEditable(true);
- QCOMPARE(comboBox.itemDelegate(), itemDelegate);
+ QCOMPARE(static_cast<QStyledItemDelegate*>(comboBox.itemDelegate()), itemDelegate);
comboBox.setStyleSheet("QComboBox { border: 1px solid gray; }");
- QCOMPARE(comboBox.itemDelegate(), itemDelegate);
+ QCOMPARE(static_cast<QStyledItemDelegate*>(comboBox.itemDelegate()), itemDelegate);
}
QTEST_MAIN(tst_QComboBox)
diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp
index a65490d452..8ce59a4374 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 64a4ad4134..27f5e58d6d 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 07d88574fa..aa9a7c49fd 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 723e4d3a13..2a61403411 100644
--- a/tests/auto/qcssparser/qcssparser.pro
+++ b/tests/auto/qcssparser/qcssparser.pro
@@ -1,12 +1,16 @@
load(qttest_p4)
SOURCES += tst_cssparser.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_cssparser.cpp b/tests/auto/qcssparser/tst_cssparser.cpp
index cd2c0f490b..ce923e1a75 100644
--- a/tests/auto/qcssparser/tst_cssparser.cpp
+++ b/tests/auto/qcssparser/tst_cssparser.cpp
@@ -98,7 +98,7 @@ void tst_CssParser::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_CssParser::marginValue_data()
{
diff --git a/tests/auto/qdatastream/qdatastream.pro b/tests/auto/qdatastream/qdatastream.pro
index 40231ea8bb..317c3bfc27 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,14 @@ 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
+ 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 3c70a2682a..0049480df3 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 ea61c59b8c..6e2781b3d8 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 35c82b2372..9a4f60460d 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 ab98d1d86a..93bf4edc88 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));
- QCOMPARE(testWidget->date().year(), 2005);
+
+ // 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 57aac48e86..6e75a092e7 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 537b105bfa..3c96e85a38 100644
--- a/tests/auto/qdesktopservices/qdesktopservices.pro
+++ b/tests/auto/qdesktopservices/qdesktopservices.pro
@@ -5,4 +5,29 @@ TARGET = tst_qdesktopservices
include(../src/qdesktopservices.pri)
+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 7c196cbd42..c69b11230a 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();
@@ -97,6 +109,141 @@ void tst_qdesktopservices::openUrl()
#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, QString() );
+ 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 404a1374fe..8fe5d839b0 100644
--- a/tests/auto/qdir/qdir.pro
+++ b/tests/auto/qdir/qdir.pro
@@ -8,6 +8,15 @@ 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
+
+ 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 e900ed065a..60bb1775b3 100644
--- a/tests/auto/qdir/tst_qdir.cpp
+++ b/tests/auto/qdir/tst_qdir.cpp
@@ -48,9 +48,14 @@
#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
@@ -198,7 +203,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 +300,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 +310,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 +347,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;
@@ -553,17 +559,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
+ // 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,7 +637,6 @@ void tst_QDir::entryList()
// lock up. The actual result depends on the file system.
return;
}
-
bool doContentCheck = true;
#ifdef Q_OS_UNIX
if (qstrcmp(QTest::currentDataTag(), "QDir::AllEntries | QDir::Writable") == 0) {
@@ -604,6 +653,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 +673,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
@@ -659,19 +713,28 @@ void tst_QDir::entryListWithSymLinks()
QDir dir;
dir.mkdir("myDir");
QFile("testfile.cpp").open(QIODevice::WriteOnly);
+#if !defined(Q_OS_SYMBIAN)
QVERIFY(QFile::link("myDir", "myLinkToDir.lnk"));
+#endif
QVERIFY(QFile::link("testfile.cpp", "myLinkToFile.lnk"));
{
QStringList entryList = QDir().entryList();
QVERIFY(entryList.contains("myDir"));
+#if !defined(Q_OS_SYMBIAN)
QVERIFY(entryList.contains("myLinkToDir.lnk"));
+#endif
QVERIFY(entryList.contains("myLinkToFile.lnk"));
}
{
QStringList entryList = QDir().entryList(QDir::Dirs);
QVERIFY(entryList.contains("myDir"));
+#if !defined(Q_OS_SYMBIAN)
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"));
}
{
@@ -734,7 +797,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);
@@ -789,7 +852,7 @@ void tst_QDir::current()
if (!currentDir.isEmpty()) {
QDir newCurrent = QDir::current();
QDir::setCurrent(oldDir);
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
QCOMPARE(newCurrent.absolutePath().toLower(), currentDir.toLower());
#else
QCOMPARE(newCurrent.absolutePath(), currentDir);
@@ -810,7 +873,7 @@ void tst_QDir::cd_data()
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();
@@ -889,7 +952,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 +1005,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 +1047,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 +1066,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 +1128,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 +1178,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 +1203,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 +1245,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 +1269,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 +1284,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 2db6617585..ece886cbcb 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 79e44d18a9..5708b50a49 100644
--- a/tests/auto/qdiriterator/tst_qdiriterator.cpp
+++ b/tests/auto/qdiriterator/tst_qdiriterator.cpp
@@ -92,7 +92,7 @@ tst_QDirIterator::tst_QDirIterator()
QFile::remove("entrylist/directory/entrylist4.lnk");
#ifndef Q_NO_SYMLINKS
-#ifdef Q_OS_WIN
+#ifdef Q_OS_WIN || defined(Q_OS_SYMBIAN)
// ### Sadly, this is a platform difference right now.
QFile::link("entrylist/file", "entrylist/linktofile.lnk");
QFile::link("entrylist/directory", "entrylist/linktodirectory.lnk");
@@ -200,6 +200,11 @@ void tst_QDirIterator::iterateRelativeDirectory()
QFETCH(QStringList, nameFilters);
QFETCH(QStringList, entries);
+#if defined(Q_OS_SYMBIAN)
+ QEXPECT_FAIL("no flags", "Symlink to directories is currently unsupported by Open C", Continue);
+ QEXPECT_FAIL("QDir::Subdirectories | QDir::FollowSymlinks", "Symlink to directories is currently unsupported by Open C", Continue);
+#endif // defined(Q_OS_SYMBIAN)
+
QDirIterator it(dirName, nameFilters, filters, flags);
QStringList list;
while (it.hasNext()) {
diff --git a/tests/auto/qdirmodel/qdirmodel.pro b/tests/auto/qdirmodel/qdirmodel.pro
index 2bf07734e3..6b3a707d5c 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,13 @@ wince*: {
sourceFile.sources = tst_qdirmodel.cpp
sourceFile.path = .
DEPLOYMENT += addit tests sourceFile
- DEFINES += SRCDIR=\\\"./\\\"
+}
+
+wince*: {
+ DEFINES += SRCDIR=\\\"./\\\"
+} symbian: {
+ 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 bf1a8f4026..8684bbe2d0 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 7738fb75f8..84b721e454 100644
--- a/tests/auto/qdom/qdom.pro
+++ b/tests/auto/qdom/qdom.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qdom.cpp
QT = core xml
QT -= gui
-wince*: {
+wince*|symbian*: {
addFiles.sources = testdata doubleNamespaces.xml umlaut.xml
addFiles.path = .
DEPLOYMENT += addFiles
@@ -15,3 +15,5 @@ wince*: {
else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
+
+symbian: TARGET.EPOCHEAPSIZE="0x100000 0x1000000"
diff --git a/tests/auto/qevent/qevent.pro b/tests/auto/qevent/qevent.pro
index 219f97e1a7..5c142996f1 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 042494fecf..6b113e0ef2 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()
{ }
+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) {
+#ifdef Q_OS_SYMBIAN
+ // This will hopefully run last, so stop the active scheduler.
+ CActiveScheduler::Stop();
+#endif
+ }
+ }
+ 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;
+};
+
+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 3a221997aa..8a45aa27b2 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 8d26f5e847..80102f0ee3 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 66f29dd542..fd8fa981c9 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);
@@ -956,7 +966,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");
@@ -1041,11 +1055,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());
@@ -1056,6 +1066,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");
@@ -1068,11 +1081,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");
@@ -1091,8 +1100,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());
@@ -1105,18 +1113,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()
@@ -1329,7 +1343,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
@@ -1638,7 +1652,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
@@ -1911,8 +1925,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
@@ -2049,7 +2063,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;
@@ -2277,7 +2291,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
@@ -2460,9 +2474,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';
@@ -2499,7 +2515,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 28a11baf5c..3c238eca53 100644
--- a/tests/auto/qfiledialog/qfiledialog.pro
+++ b/tests/auto/qfiledialog/qfiledialog.pro
@@ -6,10 +6,15 @@ 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 c31ecf240c..86bf237fa6 100644
--- a/tests/auto/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp
@@ -304,6 +304,7 @@ void tst_QFiledialog::filesSelectedSignal()
fd.show();
QListView *listView = qFindChild<QListView*>(&fd, "listView");
QVERIFY(listView);
+
QModelIndex root = listView->rootIndex();
QTRY_COMPARE(listView->model()->rowCount(root) > 0, true);
QModelIndex file;
@@ -471,10 +472,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
@@ -539,14 +541,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
@@ -561,7 +563,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);
}
@@ -924,8 +933,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());
@@ -1230,6 +1239,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);
@@ -1703,6 +1715,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 91b630d5dd..d46a83ba62 100644
--- a/tests/auto/qfileinfo/qfileinfo.pro
+++ b/tests/auto/qfileinfo/qfileinfo.pro
@@ -6,10 +6,11 @@ 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
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index 512f2b640c..2a19a04b22 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -168,6 +168,7 @@ tst_QFileInfo::~tst_QFileInfo()
QFile::remove("brokenlink.lnk");
QFile::remove("link.lnk");
QFile::remove("file1");
+ QFile::remove("dummyfile");
}
// Testing get/set functions
@@ -236,6 +237,7 @@ void tst_QFileInfo::copy()
tst_QFileInfo::tst_QFileInfo()
{
+ Q_SET_DEFAULT_IAP
}
void tst_QFileInfo::isFile_data()
@@ -264,6 +266,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")) {
@@ -286,10 +289,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;
@@ -313,7 +318,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;
@@ -323,8 +327,7 @@ 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;
@@ -395,7 +398,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" << "";
@@ -430,7 +433,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();
@@ -489,6 +492,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");
@@ -521,7 +527,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";
@@ -719,8 +725,9 @@ void tst_QFileInfo::permission()
QFETCH(QString, file);
QFETCH(int, perms);
QFETCH(bool, expected);
+ QEXPECT_FAIL("data0", "No user based rights in Symbian OS - SOS needs platform security tests instead", Abort);
QFileInfo fi(file);
- QCOMPARE(fi.permission((QFile::Permissions)perms), expected);
+ QCOMPARE(fi.permission(QFile::Permissions(perms)), expected);
}
void tst_QFileInfo::size_data()
@@ -770,7 +777,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;
@@ -791,7 +798,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/");
@@ -842,6 +849,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);
@@ -885,6 +895,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);
@@ -947,6 +960,7 @@ void tst_QFileInfo::isSymLink()
{
QFile::remove("link.lnk");
QFile::remove("brokenlink.lnk");
+ QFile::remove("dummyfile");
QFileInfo info1("tst_qfileinfo.cpp");
QVERIFY( !info1.isSymLink() );
@@ -960,11 +974,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()
@@ -1075,6 +1091,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
QVERIFY(!QFileInfo("c:\\pagefile.sys").isWritable());
@@ -1089,10 +1109,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 55f3b5c5a4..8701318528 100644
--- a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro
+++ b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro
@@ -8,4 +8,11 @@ QT = core gui
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 d49083f3e5..72841bb871 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 c4d1d6f680..8b8616acb8 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 c883c63313..a93a645e29 100644
--- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -96,7 +96,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 +314,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);
diff --git a/tests/auto/qflags/qflags.pro b/tests/auto/qflags/qflags.pro
index 1e62db1f55..cd7f759b8b 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 cee683990d..35811f1a97 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 72c95f26a3..7dd2fd0c34 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/qftp/.gitattributes b/tests/auto/qftp/.gitattributes
index d220f58303..e04709aa2e 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 84d8c19a08..c060296e7f 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 28f3f4908c..7942d4b895 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()
@@ -190,10 +201,12 @@ void tst_QFtp::initTestCase_data()
QTest::addColumn<bool>("setProxy");
QTest::addColumn<int>("proxyType");
- QTest::newRow("WithoutProxy") << false << 0;
+ 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('%'))
@@ -1544,11 +1556,16 @@ void tst_QFtp::binaryAscii()
ResMapIt it2 = resultMap.find(QFtp::Get);
QVERIFY(it2 != resultMap.end());
QVERIFY(it2.value().success);
+/*
+#ifdef Q_OS_SYMBIAN
+ QVERIFY(getData.size() == putData.size());
+#else
+*/
// most modern ftp servers leave the file as it is by default
// (and do not remove the windows line ending), the -1 below could be
// deleted in the future
QVERIFY(getData.size() == putData.size()-1);
-
+//#endi
//////////////////////////////////////////////////////////////////
// cleanup (i.e. remove the file) -- this also tests the remove command
init();
@@ -2042,4 +2059,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 ed3eac937e..cbde2727a5 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 373061b25a..8f1e00a2cb 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 62bfd81891..49e5d7de80 100644
--- a/tests/auto/qglobal/tst_qglobal.cpp
+++ b/tests/auto/qglobal/tst_qglobal.cpp
@@ -50,6 +50,7 @@ private slots:
void qInternalCallbacks();
void for_each();
void qassert();
+ void qtry();
};
void tst_QGlobal::qIsNull()
@@ -190,5 +191,66 @@ 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);
+}
+
QTEST_MAIN(tst_QGlobal)
#include "tst_qglobal.moc"
diff --git a/tests/auto/qgraphicsscene/qgraphicsscene.pro b/tests/auto/qgraphicsscene/qgraphicsscene.pro
index b8a5c8fbaa..6b8bc7095e 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 4ef1cdd80f..d3b8883e58 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 5562f192cc..5e7e53da6e 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 8056d745b0..b9f0260dea 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -2287,6 +2287,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.
@@ -2320,6 +2323,7 @@ void tst_QGraphicsView::acceptDrops()
// Switching the view to not accept drops.
view.setAcceptDrops(false);
QVERIFY(!view.viewport()->acceptDrops());
+#endif
}
void tst_QGraphicsView::optimizationFlags()
diff --git a/tests/auto/qgroupbox/tst_qgroupbox.cpp b/tests/auto/qgroupbox/tst_qgroupbox.cpp
index 3b9485157d..4933debf37 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() );
diff --git a/tests/auto/qhash/qhash.pro b/tests/auto/qhash/qhash.pro
index 1c60fc20d8..6fedb824f7 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 90d05a0b90..2090fbe388 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 c3d7c2d35e..50d2325f37 100644
--- a/tests/auto/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp
@@ -87,10 +87,11 @@
# endif
#endif
+#include "../network-settings.h"
+
//TESTED_CLASS=
//TESTED_FILES=
-const char * const lupinellaIp = "10.3.4.6";
class tst_QHostInfo : public QObject
{
@@ -160,10 +161,11 @@ void tst_QHostInfo::staticInformation()
tst_QHostInfo::tst_QHostInfo()
{
+ Q_SET_DEFAULT_IAP
}
tst_QHostInfo::~tst_QHostInfo()
-{
+{
}
void tst_QHostInfo::initTestCase()
@@ -212,14 +214,21 @@ 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() << int(QHostInfo::NoError);
+ QTest::newRow("literal_ip4") << QtNetworkSettings::serverIP() << QtNetworkSettings::serverIP() << 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("lupinella_00") << "l" << lupinellaIp << int(QHostInfo::NoError);
- QTest::newRow("lupinella_01") << "lupinella" << lupinellaIp << int(QHostInfo::NoError);
+ QTest::newRow("lupinella_01") << "lupinella" << lupinellaIp << int(QHostInfo::NoError);
QTest::newRow("lupinella_02") << "lupinella.troll.no" << lupinellaIp << int(QHostInfo::NoError);
QTest::newRow("lupinella_03") << "lupinella.trolltech.com" << 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);
@@ -383,10 +392,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) || defined(Q_OS_SYMBIAN)
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 9c2f5cb1b7..8678a19652 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 9e9db286d3..a6bec39ed4 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()
@@ -317,7 +329,7 @@ void tst_QHttp::get_data()
QTest::newRow( QString("failprot_02_%1").arg(i).toLatin1() ) << QtNetworkSettings::serverName() << 80u
<< QString("qtest/rfc3252.txt") << 1 << 400 << QByteArray() << (bool)(i==1);
- // doc.trolltech.com uses transfer-encoding=chunked
+ //doc.trolltech.com uses transfer-encoding=chunked
/* doc.trolltech.com no longer seams to be using chuncked encodig.
QTest::newRow( QString("chunked_01_%1").arg(i).toLatin1() ) << QString("test.troll.no") << 80u
<< QString("/") << 1 << 200 << trolltech << (bool)(i==1);
@@ -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;
@@ -1228,7 +1242,11 @@ void tst_QHttp::unexpectedRemoteClose()
QCoreApplication::instance()->processEvents();
QEventLoop loop;
+#ifndef Q_OS_SYMBIAN
QTimer::singleShot(3000, &loop, SLOT(quit()));
+#else
+ QTimer::singleShot(30000, &loop, SLOT(quit()));
+#endif
QHttp http;
QObject::connect(&http, SIGNAL(done(bool)), &loop, SLOT(quit()));
@@ -1380,7 +1398,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 +1476,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/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
index aa0705de56..cea6229875 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);
@@ -101,6 +105,10 @@ private Q_SLOTS:
};
+tst_QHttpNetworkConnection::tst_QHttpNetworkConnection()
+{
+ Q_SET_DEFAULT_IAP
+}
void tst_QHttpNetworkConnection::initTestCase()
{
@@ -200,8 +208,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()
@@ -369,7 +377,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()
@@ -412,8 +420,17 @@ 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;
do {
@@ -426,6 +443,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 687ec2efab..ce96a2c7ab 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;
@@ -305,11 +306,11 @@ void tst_QHttpSocketEngine::simpleConnectToIMAP()
socketDevice.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128));
- QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143));
+ QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143));
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState);
QVERIFY(socketDevice.waitForWrite());
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState);
- QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP());
+ QVERIFY(socketDevice.peerAddress() == QHostAddress(QtNetworkSettings::serverIP()));
QVERIFY(!socketDevice.localAddress().isNull());
QVERIFY(socketDevice.localPort() > 0);
@@ -323,9 +324,9 @@ void tst_QHttpSocketEngine::simpleConnectToIMAP()
array.resize(available);
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");
+ // Check that the greeting is what we expect it to be
+ 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);
@@ -527,9 +528,11 @@ 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");
+ QVERIFY(!tcpSocketNonBlocking_data.isEmpty());
+ QCOMPARE(tcpSocketNonBlocking_data.at(0).toLatin1().constData(),
+ 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);
@@ -692,11 +695,11 @@ void tst_QHttpSocketEngine::passwordAuth()
socketDevice.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128, "qsockstest", "password"));
- QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143));
+ QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143));
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState);
QVERIFY(socketDevice.waitForWrite());
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState);
- QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP());
+ QVERIFY(socketDevice.peerAddress() == QHostAddress(QtNetworkSettings::serverIP()));
// Wait for the greeting
QVERIFY(socketDevice.waitForRead());
@@ -707,10 +710,10 @@ void tst_QHttpSocketEngine::passwordAuth()
QByteArray array;
array.resize(available);
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 19c13b70ca..df121b61d3 100644
--- a/tests/auto/qicoimageformat/qicoimageformat.pro
+++ b/tests/auto/qicoimageformat/qicoimageformat.pro
@@ -12,6 +12,13 @@ wince*: {
}
addPlugins.path = imageformats
DEPLOYMENT += addFiles addPlugins
+} else:symbian* {
+ addFiles.sources = icons
+ addFiles.path = .
+ addPlugins.sources = qico.dll
+ addPlugins.path = imageformats
+ DEPLOYMENT += addFiles addPlugins
+ DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x",""))
} else {
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
diff --git a/tests/auto/qicoimageformat/tst_qticoimageformat.cpp b/tests/auto/qicoimageformat/tst_qticoimageformat.cpp
index fbd3821373..62cb4feaad 100644
--- a/tests/auto/qicoimageformat/tst_qticoimageformat.cpp
+++ b/tests/auto/qicoimageformat/tst_qticoimageformat.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_QtIcoImageFormat : public QObject
{
Q_OBJECT
diff --git a/tests/auto/qicon/qicon.pro b/tests/auto/qicon/qicon.pro
index c8d77e8571..982bc5a2d8 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 a266c16462..5ca15013be 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)
@@ -124,7 +128,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);
@@ -179,7 +182,6 @@ void tst_QIcon::actualSize2_data()
void tst_QIcon::actualSize2()
{
QIcon icon;
-
const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/");
icon.addPixmap(QPixmap(prefix + "image.png"));
@@ -238,7 +240,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 f10a488590..69d6f0f414 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 06c9a56463..af02bbf146 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;
+#if defined(Q_OS_WINCE)
+ int bigValue = 2000;
+#elif defined(Q_OS_SYMBIAN)
+ int bigValue = 2000;
#else
- int bigValue = 2000;
+ 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 2c9510e637..44a0ddcb2e 100644
--- a/tests/auto/qimagereader/qimagereader.pro
+++ b/tests/auto/qimagereader/qimagereader.pro
@@ -26,3 +26,13 @@ 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 dee4a171ec..ea30b3c920 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -790,7 +790,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 e62c1a5917..5a2c9088bd 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 0ebf06b459..f5b4e9154e 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 0000000000..b3ea8c276e
--- /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 0000000000..67a6819408
--- /dev/null
+++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp
@@ -0,0 +1,216 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../../shared/util.h"
+
+#include <qinputcontext.h>
+#include <qlineedit.h>
+#include <qplaintextedit.h>
+#include <qlayout.h>
+#include <qradiobutton.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);
+}
+
+void tst_QInputContext::requestSoftwareInputPanel()
+{
+ 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.
+ qApp->setAutoSipOnMouseFocus(true);
+ 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.
+ qApp->setAutoSipOnMouseFocus(false);
+ 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);
+}
+
+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 e2864e86bc..e695bf6843 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 f52fdaf4d4..8a76626f63 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()
@@ -120,7 +124,7 @@ void tst_QIODevice::constructing_QTcpSocket()
QVERIFY(!device->isOpen());
- socket.connectToHost(QtNetworkSettings::serverName(), 143);
+ socket.connectToHost(QtNetworkSettings::serverName(), 21);
QVERIFY(socket.waitForConnected(5000));
QVERIFY(device->isOpen());
@@ -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 65dd86f591..f1adc510d2 100644
--- a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
@@ -1120,8 +1120,11 @@ void tst_QItemDelegate::enterKey()
QTest::keyClick(editor, Qt::Key(key));
QApplication::processEvents();
-
- QCOMPARE(editor && editor->hasFocus(), expectedFocus);
+
+ if (widget == 2 || widget == 3) {
+ QVERIFY(!editor.isNull());
+ QCOMPARE(editor && editor->hasFocus(), expectedFocus);
+ }
}
diff --git a/tests/auto/qitemmodel/qitemmodel.pro b/tests/auto/qitemmodel/qitemmodel.pro
index 38c615b693..381a00831e 100644
--- a/tests/auto/qitemmodel/qitemmodel.pro
+++ b/tests/auto/qitemmodel/qitemmodel.pro
@@ -3,6 +3,8 @@ SOURCES += tst_qitemmodel.cpp
QT += sql
+symbian:TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb"
+
# NOTE: The deployment of the sqldrivers is disabled on purpose.
# If we deploy the plugins, they are loaded twice when running
# the tests on the autotest system. In that case we run out of
diff --git a/tests/auto/qitemview/tst_qitemview.cpp b/tests/auto/qitemview/tst_qitemview.cpp
index 73c08d1b6f..c9e6f4810f 100644
--- a/tests/auto/qitemview/tst_qitemview.cpp
+++ b/tests/auto/qitemview/tst_qitemview.cpp
@@ -256,7 +256,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;
@@ -354,18 +354,19 @@ 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);
view->setDropIndicatorShown(true);
QCOMPARE(view->showDropIndicator(), true);
-
+
// setDragEnabled
view->setDragEnabled(false);
QCOMPARE(view->dragEnabled(), false);
view->setDragEnabled(true);
QCOMPARE(view->dragEnabled(), true);
+#endif
// setAlternatingRowColors
view->setAlternatingRowColors(false);
@@ -459,7 +460,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/tst_qkeyevent.cpp b/tests/auto/qkeyevent/tst_qkeyevent.cpp
index 27b849e4b8..1e19a4943e 100644
--- a/tests/auto/qkeyevent/tst_qkeyevent.cpp
+++ b/tests/auto/qkeyevent/tst_qkeyevent.cpp
@@ -86,7 +86,7 @@ private:
KeyEventWidget::KeyEventWidget( QWidget* parent, const char* name )
- : QWidget( parent ), recievedKeyPress( FALSE ), recievedKeyRelease( FALSE ),
+ : QWidget( parent ), recievedKeyPress( false ), recievedKeyRelease( false ),
lastKeyPress( 0 ), lastKeyRelease( 0 )
{
setObjectName(name);
@@ -94,6 +94,8 @@ KeyEventWidget::KeyEventWidget( QWidget* parent, const char* name )
KeyEventWidget::~KeyEventWidget()
{
+ delete lastKeyPress;
+ delete lastKeyRelease;
}
QKeyEvent* KeyEventWidget::getLastKeyPress()
@@ -108,14 +110,18 @@ QKeyEvent* KeyEventWidget::getLastKeyRelease()
void KeyEventWidget::keyPressEvent( QKeyEvent* e )
{
- lastKeyPress = e;
- recievedKeyPress = TRUE;
+ if (lastKeyPress)
+ delete lastKeyPress;
+ lastKeyPress = new QKeyEvent(*e);
+ recievedKeyPress = true;
}
void KeyEventWidget::keyReleaseEvent( QKeyEvent* e )
{
- lastKeyRelease = e;
- recievedKeyRelease = TRUE;
+ if (lastKeyRelease)
+ delete lastKeyRelease;
+ lastKeyRelease = new QKeyEvent(*e);
+ recievedKeyRelease = true;
}
tst_QKeyEvent::tst_QKeyEvent()
@@ -151,13 +157,13 @@ void tst_QKeyEvent::sendRecieveKeyEvents_data()
continue;
}
if ( a == Qt::Key_Backtab ) // Actually SHIFT+Tab
- QTest::newRow( QString("key - %1").arg( a ).toLatin1() ) << int(Qt::Key_Tab) << FALSE << "";
+ QTest::newRow( QString("key - %1").arg( a ).toLatin1() ) << int(Qt::Key_Tab) << false << "";
else
- QTest::newRow( QString("key - %1").arg( a ).toLatin1() ) << a << FALSE << "";
+ 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) );
+ QTest::newRow( QString("key - %1").arg( a ).toLatin1() ) << a << true << QString( QChar(a) );
}
}
@@ -168,13 +174,12 @@ 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;
+ testWidget->recievedKeyPress = false;
-#ifdef Q_WS_WIN
+#ifdef Q_WS_WIN
// Will be eaten by Windows system
if ( key == Qt::Key_Print )
return;
@@ -203,7 +208,37 @@ void tst_QKeyEvent::sendRecieveKeyEvents()
if ( key >= Qt::Key_BracketRight && key <= Qt::Key_ydiaeresis )
return;
#endif // Q_WS_WIN
+
+#ifdef Q_OS_SYMBIAN
+ // Not supported on symbian
+ if ( key == Qt::Key_Print )
+ return;
+
+ // Not supported on symbian
+ if ( key == Qt::Key_SysReq )
+ return;
+
+ // Not supported on symbian
+ 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 supported on symbian
+ 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
@@ -214,7 +249,7 @@ void tst_QKeyEvent::sendRecieveKeyEvents()
QCOMPARE( ke->key(), key );
if ( textExpected )
QCOMPARE( ke->text(), text );
- testWidget->recievedKeyRelease = FALSE;
+ testWidget->recievedKeyRelease = false;
QTest::keyRelease( testWidget, (Qt::Key)key );
while ( !testWidget->recievedKeyRelease )
qApp->processEvents();
diff --git a/tests/auto/qkeysequence/tst_qkeysequence.cpp b/tests/auto/qkeysequence/tst_qkeysequence.cpp
index 2e4b85063e..d0dc5e259d 100644
--- a/tests/auto/qkeysequence/tst_qkeysequence.cpp
+++ b/tests/auto/qkeysequence/tst_qkeysequence.cpp
@@ -504,7 +504,7 @@ 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)
+#elif defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QSKIP("No need to translate modifiers on WinCE", SkipAll);
#endif
diff --git a/tests/auto/qlabel/qlabel.pro b/tests/auto/qlabel/qlabel.pro
index 141559efd7..c274b4a44e 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 3567a158c8..fb655c1aec 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 0c69b11f9b..0dfe1e947f 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 14b87837b0..25a50b5697 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 1366b7c6ba..5e98362ed5 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 718c5c6dac..436d7baa12 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 dd90f0460c..4046f1f76a 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 f3e646ad0a..fd5790b209 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 67437a699d..06c2cd89ae 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 5c9798b7d3..bad2942f23 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 56718d038c..715774ae6b 100644
--- a/tests/auto/qline/qline.pro
+++ b/tests/auto/qline/qline.pro
@@ -1,6 +1,7 @@
load(qttest_p4)
+SOURCES += tst_qline.cpp
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 3519afa2ba..ea0afa0b10 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 cc80931a6d..13b68c8d43 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 e581bd3acc..6f49a37749 100644
--- a/tests/auto/qlistwidget/tst_qlistwidget.cpp
+++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp
@@ -1435,6 +1435,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 b840e2dce9..7bc9f59521 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 9a5c54984e..6301d40120 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,64 @@ 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();
+
+#if 0
+ QTime nowTime = QTime::currentTime();
+ QDateTime nowDateTime = QDateTime::currentDateTime();
+ qDebug() << "locale.query(QSystemLocale::LanguageId)" << locale.query(QSystemLocale::LanguageId, QVariant()).toString();
+ qDebug() << "locale.query(QSystemLocale::CountryId)" << locale.query(QSystemLocale::CountryId, QVariant()).toString();
+ qDebug() << "locale.query(QSystemLocale::DecimalPoint)" << locale.query(QSystemLocale::DecimalPoint, QVariant()).toString();
+ qDebug() << "locale.query(QSystemLocale::GroupSeparator)" << locale.query(QSystemLocale::GroupSeparator, QVariant()).toString();
+ qDebug() << "locale.query(QSystemLocale::ZeroDigit)" << locale.query(QSystemLocale::ZeroDigit, QVariant()).toString();
+ qDebug() << "locale.query(QSystemLocale::NegativeSign)" << locale.query(QSystemLocale::NegativeSign, QVariant()).toString();
+ qDebug() << "locale.query(QSystemLocale::PositiveSign)" << locale.query(QSystemLocale::PositiveSign, QVariant()).toString();
+ qDebug() << "locale.query(QSystemLocale::DateFormatLong)" << locale.query(QSystemLocale::DateFormatLong, QVariant()).toString();
+ qDebug() << "locale.query(QSystemLocale::DateFormatShort)" << locale.query(QSystemLocale::DateFormatShort, QVariant()).toString();
+ qDebug() << "locale.query(QSystemLocale::TimeFormatLong)" << locale.query(QSystemLocale::TimeFormatLong, QVariant()).toString();
+ qDebug() << "locale.query(QSystemLocale::TimeFormatShort)" << locale.query(QSystemLocale::TimeFormatShort, QVariant()).toString();
+ qDebug() << "locale.query(QSystemLocale::DayNameLong)" << locale.query(QSystemLocale::DayNameLong, QVariant(1)).toString();
+ qDebug() << "locale.query(QSystemLocale::DayNameShort)" << locale.query(QSystemLocale::DayNameShort, QVariant(1)).toString();
+ qDebug() << "locale.query(QSystemLocale::MonthNameLong)" << locale.query(QSystemLocale::MonthNameLong, QVariant(2)).toString();
+ qDebug() << "locale.query(QSystemLocale::MonthNameShort)" << locale.query(QSystemLocale::MonthNameShort, QVariant(2)).toString();
+ qDebug() << "locale.query(QSystemLocale::DateToStringLong)" << locale.query(QSystemLocale::DateToStringLong, QVariant(date)).toString();
+ qDebug() << "locale.query(QSystemLocale::DateToStringShort)" << locale.query(QSystemLocale::DateToStringShort, QVariant(date)).toString();
+ qDebug() << "locale.query(QSystemLocale::TimeToStringLong)" << locale.query(QSystemLocale::TimeToStringLong, QVariant(nowTime)).toString();
+ qDebug() << "locale.query(QSystemLocale::TimeToStringShort)" << locale.query(QSystemLocale::TimeToStringShort, QVariant(nowTime)).toString();
+ qDebug() << "locale.query(QSystemLocale::DateTimeFormatLong)" << locale.query(QSystemLocale::DateTimeFormatLong, QVariant()).toString();
+ qDebug() << "locale.query(QSystemLocale::DateTimeFormatShort)" << locale.query(QSystemLocale::DateTimeFormatShort, QVariant()).toString();
+ qDebug() << "locale.query(QSystemLocale::DateTimeToStringLong)" << locale.query(QSystemLocale::DateTimeToStringLong, QVariant(nowDateTime)).toString();
+ qDebug() << "locale.query(QSystemLocale::DateTimeToStringShort)" << locale.query(QSystemLocale::DateTimeToStringShort, QVariant(nowDateTime)).toString();
+ qDebug() << "locale.query(QSystemLocale::MeasurementSystem)" << locale.query(QSystemLocale::MeasurementSystem, QVariant()).toString();
+ qDebug() << "locale.query(QSystemLocale::AMText)" << locale.query(QSystemLocale::AMText, QVariant()).toString();
+ qDebug() << "locale.query(QSystemLocale::PMText)" << locale.query(QSystemLocale::PMText, QVariant()).toString();
+#endif
+
+ TBuf<50> s60FormattedDate;
+ TRAPD(err, s60Date.FormatL(s60FormattedDate, s60DateFormat));
+ QVERIFY(err == KErrNone);
+ QString s60FinalResult = qt_TDes2QStringL(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 7460d8c1be..f073e7a7a9 100644
--- a/tests/auto/qlocalsocket/lackey/lackey.pro
+++ b/tests/auto/qlocalsocket/lackey/lackey.pro
@@ -15,4 +15,4 @@ DEFINES += QLOCALSOCKET_DEBUG
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 405fd3f35f..fbec9890e8 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 4df17deaad..0849453aac 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 7befdf91c1..e399a2951b 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,9 +30,18 @@ CONFIG(debug_and_release) {
wince* {
additionalFiles.sources = ../lackey/lackey.exe
additionalFiles.path = lackey
+}
+
+symbian {
+ additionalFiles.sources = lackey.exe
+ additionalFiles.path = \sys\bin
+ DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x",""))
+}
+
+wince*|symbian {
scriptFiles.sources = ../lackey/scripts/*.js
scriptFiles.path = lackey/scripts
DEPLOYMENT = additionalFiles scriptFiles
QT += script # for easy deployment of QtScript
-}
+}
diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
index a41eecdd72..0fe05a8573 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)
@@ -108,6 +115,10 @@ private slots:
void debug();
+#ifdef Q_OS_SYMBIAN
+private:
+ void unlink(QString serverName);
+#endif
};
tst_QLocalSocket::tst_QLocalSocket()
@@ -294,6 +305,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 +358,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 +380,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 +483,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 +503,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 +516,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 +541,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"));
}
@@ -570,7 +597,9 @@ void tst_QLocalSocket::fullPath()
{
LocalServer 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\\";
@@ -584,6 +613,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();
@@ -607,6 +640,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;
@@ -655,7 +691,7 @@ public:
|| socket.error() == QLocalSocket::ConnectionRefusedError)
&& tries < 1000);
if (tries == 0 && socket.state() != QLocalSocket::ConnectedState) {
- QVERIFY(socket.waitForConnected(3000));
+ QVERIFY(socket.waitForConnected(30000));
QVERIFY(socket.state() == QLocalSocket::ConnectedState);
}
@@ -685,7 +721,7 @@ public:
int done = clients;
while (done > 0) {
bool timedOut = true;
- QVERIFY(server.waitForNewConnection(3000, &timedOut));
+ QVERIFY(server.waitForNewConnection(30000, &timedOut));
QVERIFY(!timedOut);
QLocalSocket *serverSocket = server.nextPendingConnection();
QVERIFY(serverSocket);
@@ -720,20 +756,30 @@ 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();
}
server.wait();
while (!clients.isEmpty()) {
- QVERIFY(clients.first()->wait(30000));
+ QVERIFY(clients.first()->wait(300000));
Client *client =clients.takeFirst();
client->terminate();
delete client;
@@ -756,7 +802,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);
@@ -811,6 +857,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;
@@ -862,6 +911,10 @@ void tst_QLocalSocket::removeServer()
void tst_QLocalSocket::recycleServer()
{
+#ifdef Q_OS_SYMBIAN
+ unlink("recycletest1");
+#endif
+
LocalServer server;
QLocalSocket client;
@@ -929,6 +982,29 @@ void tst_QLocalSocket::debug()
qDebug() << QLocalSocket::ConnectionRefusedError << QLocalSocket::UnconnectedState;
}
+#ifdef Q_OS_SYMBIAN
+void tst_QLocalSocket::unlink(QString name)
+{
+ if(name.length() == 0)
+ return;
+
+ 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);
+ }
+
+ int result = ::unlink(fullName.toUtf8().data());
+
+ 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 b1cbd160bd..43d73ae252 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 5b61272953..00b84d133d 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 ec9c7b47ce..3ce7f7f0b6 100644
--- a/tests/auto/qmenu/tst_qmenu.cpp
+++ b/tests/auto/qmenu/tst_qmenu.cpp
@@ -423,8 +423,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);
@@ -638,7 +641,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 51cf21d14d..a0a6420221 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 1245de194c..6e98c2a7ab 100644
--- a/tests/auto/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/qmenubar/tst_qmenubar.cpp
@@ -464,6 +464,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 20ec3b8bf6..a84d238aa4 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 63b5b5a142..177d387160 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 765966eee8..15f0c833bd 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 810c05f7fc..fd42870968 100644
--- a/tests/auto/qmultiscreen/qmultiscreen.pro
+++ b/tests/auto/qmultiscreen/qmultiscreen.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qmultiscreen.cpp
-
-
-
+QT = core
diff --git a/tests/auto/qmutex/qmutex.pro b/tests/auto/qmutex/qmutex.pro
index e52f947f98..bd24dcb35f 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 f9213082df..ff8a3da7eb 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 b7bd61e610..dd584a0900 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()
@@ -153,14 +153,14 @@ void tst_QNativeSocketEngine::simpleConnectToIMAP()
QVERIFY(socketDevice.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol));
QVERIFY(socketDevice.state() == QAbstractSocket::UnconnectedState);
- const bool isConnected = socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143);
+ const bool isConnected = socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143);
if (!isConnected) {
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState);
QVERIFY(socketDevice.waitForWrite());
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState);
}
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState);
- QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP());
+ QVERIFY(socketDevice.peerAddress() == QHostAddress(QtNetworkSettings::serverIP()));
// Wait for the greeting
QVERIFY(socketDevice.waitForRead());
@@ -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
@@ -303,7 +309,7 @@ void tst_QNativeSocketEngine::broadcastTest()
{
#ifdef Q_OS_AIX
QSKIP("Broadcast does not work on darko", SkipAll);
-#endif
+#endif
QNativeSocketEngine broadcastSocket;
// Initialize a regular Udp socket
@@ -395,7 +401,10 @@ 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
}
//---------------------------------------------------------------------------
diff --git a/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp b/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp
index 88062b07e0..cf3d856b79 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;
@@ -138,6 +144,7 @@ void tst_QNetworkInterface::loopbackIPv6()
anyIPv6 = true;
QVERIFY(!anyIPv6 || loopbackfound);
+#endif
}
void tst_QNetworkInterface::localAddress()
diff --git a/tests/auto/qnetworkreply/.gitattributes b/tests/auto/qnetworkreply/.gitattributes
index f0cae990fc..80252cfd34 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 bf791ffc61..74b0bfcab3 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 71f76a2987..593de8b6c0 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,17 @@ 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 cfd3dd09bd..a4c3b80ac8 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()));
- QTestEventLoop::instance().enterLoop(10);
+#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()));
- QTestEventLoop::instance().enterLoop(10);
+#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()));
- QTestEventLoop::instance().enterLoop(10);
+#ifdef Q_OS_SYMBIAN
+ QTestEventLoop::instance().enterLoop(20);
+#else
+ QTestEventLoop::instance().enterLoop(10);
+#endif
QVERIFY(!QTestEventLoop::instance().timeout());
}
@@ -2524,7 +2558,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*)),
@@ -2653,8 +2691,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();
@@ -2669,7 +2712,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);
@@ -2690,18 +2737,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());
@@ -3231,7 +3279,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);
@@ -3358,7 +3405,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()
@@ -3387,11 +3438,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());
@@ -3406,7 +3466,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());
@@ -3423,7 +3487,7 @@ void tst_QNetworkReply::uploadProgress_data()
}
void tst_QNetworkReply::uploadProgress()
-{
+{
QFETCH(QByteArray, data);
QTcpServer server;
QVERIFY(server.listen());
@@ -3541,7 +3605,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");
@@ -3694,7 +3758,13 @@ void tst_QNetworkReply::httpProxyCommands()
// wait for the finished signal
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
- QTestEventLoop::instance().enterLoop(1);
+
+#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 317628477e..162f980f9c 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/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index 3df83d79f6..2627b8dca6 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -1169,7 +1169,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;
@@ -1419,8 +1419,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);
@@ -2427,7 +2437,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 9b2fec1243..b3bda37e12 100644
--- a/tests/auto/qobject/tst_qobject.pro
+++ b/tests/auto/qobject/tst_qobject.pro
@@ -10,3 +10,9 @@ 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 581c63f309..322adff6a0 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 66841253d8..1bd09cdfb2 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,8 +218,24 @@ 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()
{
+#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 };
@@ -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 277039f0c4..1b3659d87e 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 5e5bd399b5..bbfa3e6a63 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 dc9d60f7c0..930a6f28ce 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 f51e657dc3..f379e41a23 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 70be4be6fb..02ed3f2f03 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 b3736ab9e6..52bad411f6 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,94 @@ 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 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 +1052,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 40ad539ee2..299a01e646 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()
{
@@ -903,6 +922,7 @@ void tst_QPlainTextEdit::implicitClear()
QVERIFY(ed->toPlainText().isEmpty());
}
+#ifndef QT_NO_CLIPBOARD
void tst_QPlainTextEdit::copyAvailable_data()
{
QTest::addColumn<pairListType>("keystrokes");
@@ -1020,6 +1040,7 @@ void tst_QPlainTextEdit::copyAvailable()
QVERIFY2(variantSpyCopyAvailable.toBool() == copyAvailable.at(i), QString("Spied singnal: %1").arg(i).toLatin1());
}
}
+#endif
void tst_QPlainTextEdit::undoRedoAfterSetContent()
{
@@ -1085,6 +1106,7 @@ public:
};
+#ifndef QT_NO_CLIPBOARD
void tst_QPlainTextEdit::mimeDataReimplementations()
{
MyTextEdit ed;
@@ -1123,6 +1145,7 @@ void tst_QPlainTextEdit::mimeDataReimplementations()
QCOMPARE(ed.insertCallCount, 1);
#endif
}
+#endif
void tst_QPlainTextEdit::shiftEnterShouldInsertLineSeparator()
{
@@ -1162,6 +1185,7 @@ void tst_QPlainTextEdit::selectWordsFromStringsContainingSeparators()
cursor.clearSelection();
}
+#ifndef QT_NO_CLIPBOARD
void tst_QPlainTextEdit::canPaste()
{
if (!nativeClipboardWorking())
@@ -1174,6 +1198,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 cb2ac34713..d0762fc101 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 818bb0d2f8..aafcb36209 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 21177b80d1..ce66aaf7cb 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 aa5842a35e..0d9d809132 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 7e842f2ef2..96a97325bb 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 50c17ed36d..382d6e4e91 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 d8d87b08c1..44b46b439f 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 5331f09d0c..f848bb1029 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,12 @@ 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 8221325882..5f07c784b6 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);
}
@@ -286,6 +297,56 @@ 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 734fd3cdd4..8b006c2412 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/qpointarray/qpointarray.pro b/tests/auto/qpointarray/qpointarray.pro
index d864337546..9ddbf75995 100644
--- a/tests/auto/qpointarray/qpointarray.pro
+++ b/tests/auto/qpointarray/qpointarray.pro
@@ -1,6 +1,6 @@
load(qttest_p4)
SOURCES += tst_qpointarray.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 ed59f106bd..047828a0c6 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 3741e3c25b..82f91f89d5 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 6792ef4adf..319cfa6ff3 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 960f97020c..f8fa6e4353 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 724015b98f..73fe3dacf9 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 d235dff957..df36590f25 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
@@ -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();
@@ -1226,6 +1323,9 @@ void tst_QProcess::processInAThread()
{
for (int i = 0; i < 3; ++i) {
TestThread thread;
+#if defined(Q_OS_SYMBIAN)
+ thread.setStackSize(0x14000);
+#endif
thread.start();
QVERIFY(thread.wait(10000));
QCOMPARE(thread.code(), 0);
@@ -1235,11 +1335,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(0x14000);
+ thread2.setStackSize(0x14000);
+ thread3.setStackSize(0x14000);
+#endif
thread1.start();
thread2.start();
thread3.start();
@@ -1265,14 +1378,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 +1406,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 +1428,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 +1442,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 +1458,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 +1493,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 +1554,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 +1575,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 +1604,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 +1629,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 +1657,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 +1698,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 +1763,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));
@@ -1722,7 +1887,7 @@ void tst_QProcess::setEnvironment()
//-----------------------------------------------------------------------------
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 +1906,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 +1919,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 +1933,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 +1961,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 +1981,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 +2000,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 +2040,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 +2074,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 +2108,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 +2146,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 +2175,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 +2222,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 +2235,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 +2257,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 +2273,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 +2308,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 f6561d3a09..ed489f9f81 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 8f90fbc4a2..c868ed40fa 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 33b0987a28..5919102170 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 2f75c641e4..4318b18178 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 16dd55086a..75940b3be7 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 5a916363f5..9c99a49ba4 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 d467cda0e1..80b6827101 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 0169904d7b..16ff32f727 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 2ad202d407..71ddcc8fa2 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 8f3ca5ce32..c06a5eb87f 100644
--- a/tests/auto/qresourceengine/qresourceengine.pro
+++ b/tests/auto/qresourceengine/qresourceengine.pro
@@ -9,14 +9,18 @@ load(resources)
SOURCES += tst_resourceengine.cpp
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.path = testqrc
@@ -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_resourceengine.cpp b/tests/auto/qresourceengine/tst_resourceengine.cpp
index e133a72e61..dfdc4549a1 100644
--- a/tests/auto/qresourceengine/tst_resourceengine.cpp
+++ b/tests/auto/qresourceengine/tst_resourceengine.cpp
@@ -43,6 +43,10 @@
#include <QtTest/QtTest>
#include <QtCore>
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR "."
+#endif
+
class tst_ResourceEngine: public QObject
{
Q_OBJECT
diff --git a/tests/auto/qscopedpointer/.gitignore b/tests/auto/qscopedpointer/.gitignore
new file mode 100644
index 0000000000..9f2324cb11
--- /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 0000000000..13d8425070
--- /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 0000000000..0e005c35b0
--- /dev/null
+++ b/tests/auto/qscopedpointer/tst_qscopedpointer.cpp
@@ -0,0 +1,282 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+****************************************************************************/
+
+#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() const;
+ void dataOnDefaultConstructed() const;
+ void useSubClassInConstructor() const;
+ void dataOnValue() const;
+ void dataSignature() const;
+ void reset() const;
+ void dereferenceOperator() const;
+ void dereferenceOperatorSignature() const;
+ void pointerOperator() const;
+ void pointerOperatorSignature() const;
+ void negationOperator() const;
+ void negationOperatorSignature() const;
+ void operatorBool() const;
+ void operatorBoolSignature() const;
+ void isNull() const;
+ void isNullSignature() const;
+ void objectSize() const;
+ // TODO instansiate on const object
+};
+
+void tst_QScopedPointer::defaultConstructor() const
+{
+ /* Check that the members, one, is correctly initialized. */
+ QScopedPointer<int> p;
+ QCOMPARE(p.data(), static_cast<int *>(0));
+}
+
+void tst_QScopedPointer::dataOnDefaultConstructed() const
+{
+ QScopedPointer<int> p;
+
+ QCOMPARE(p.data(), static_cast<int *>(0));
+}
+
+class MyClass
+{
+};
+
+class MySubClass : public MyClass
+{
+};
+
+void tst_QScopedPointer::useSubClassInConstructor() const
+{
+ /* Use a syntax which users typically would do. */
+ QScopedPointer<MyClass> p(new MyClass());
+}
+
+void tst_QScopedPointer::dataOnValue() const
+{
+ int *const rawPointer = new int(5);
+ QScopedPointer<int> p(rawPointer);
+
+ QCOMPARE(p.data(), rawPointer);
+}
+
+void tst_QScopedPointer::dataSignature() const
+{
+ const QScopedPointer<int> p;
+ /* data() should be const. */
+ p.data();
+}
+
+void tst_QScopedPointer::reset() const
+{
+ /* 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() const
+{
+ /* 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() const
+{
+ /* 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() const
+{
+ QScopedPointer<AnyForm> p(new AnyForm());
+ p->value = 5;
+
+ QCOMPARE(p->value, 5);
+}
+
+void tst_QScopedPointer::pointerOperatorSignature() const
+{
+ /* The operator should be const. */
+ const QScopedPointer<AnyForm> p(new AnyForm);
+ p->value = 5;
+
+ QVERIFY(p->value);
+}
+
+void tst_QScopedPointer::negationOperator() const
+{
+ /* 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() const
+{
+ /* The signature should be const. */
+ const QScopedPointer<int> p;
+ !p;
+
+ /* The return value should be bool. */
+ static_cast<bool>(!p);
+}
+
+void tst_QScopedPointer::operatorBool() const
+{
+ /* 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() const
+{
+ /* The signature should be const and return bool. */
+ const QScopedPointer<int> p;
+
+ static_cast<bool>(p);
+}
+
+void tst_QScopedPointer::isNull() const
+{
+ /* 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
+{
+ const QScopedPointer<int> p(new int(69));
+
+ /* The signature should be const and return bool. */
+ static_cast<bool>(p.isNull());
+}
+
+void tst_QScopedPointer::objectSize() const
+{
+ /* The size of QScopedPointer should be the same as one pointer. */
+ QCOMPARE(sizeof(QScopedPointer<int>), sizeof(void *));
+}
+
+QTEST_MAIN(tst_QScopedPointer)
+#include "tst_qscopedpointer.moc"
diff --git a/tests/auto/qscriptengine/qscriptengine.pro b/tests/auto/qscriptengine/qscriptengine.pro
index 7c74b32a04..39484bd5cd 100644
--- a/tests/auto/qscriptengine/qscriptengine.pro
+++ b/tests/auto/qscriptengine/qscriptengine.pro
@@ -3,9 +3,12 @@ QT = core gui script
SOURCES += tst_qscriptengine.cpp
DEFINES += SRCDIR=\\\"$$PWD\\\"
-wince*: {
+wince*|symbian*: {
addFiles.sources = script
addFiles.path = .
DEPLOYMENT += addFiles
}
+symbian: {
+ 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 830cfc7aed..ab4364ec24 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -249,7 +249,7 @@ void tst_QScriptEngine::newFunction()
QCOMPARE(fun.prototype().isValid(), true);
QCOMPARE(fun.prototype().isFunction(), true);
QCOMPARE(fun.prototype().strictlyEquals(eng.evaluate("Function.prototype")), true);
-
+
QCOMPARE(fun.call().isNull(), true);
QCOMPARE(fun.construct().isObject(), true);
}
@@ -2615,7 +2615,7 @@ void tst_QScriptEngine::numberClass()
QCOMPARE(ctor.propertyFlags("MIN_VALUE"), flags);
QVERIFY(ctor.property("NaN").isNumber());
QCOMPARE(ctor.propertyFlags("NaN"), flags);
- QVERIFY(ctor.property("NEGATIVE_INFINITY").isNumber());
+ QVERIFY(ctor.property("NEGATIVE_INFINITY").isNumber());
QCOMPARE(ctor.propertyFlags("NEGATIVE_INFINITY"), flags);
QVERIFY(ctor.property("POSITIVE_INFINITY").isNumber());
QCOMPARE(ctor.propertyFlags("POSITIVE_INFINITY"), flags);
@@ -2838,7 +2838,7 @@ void tst_QScriptEngine::functionExpression()
" else\n"
" function baz() { return 'baz'; }\n"
" return (arg == 'bar') ? bar : baz;\n"
- "}");
+ "}");
QVERIFY(!eng.globalObject().property("bar").isValid());
QVERIFY(!eng.globalObject().property("baz").isValid());
QVERIFY(eng.evaluate("foo").isFunction());
diff --git a/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro
index f6a6aeb8ab..06b861efe6 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 0194730679..c1100769de 100644
--- a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
+++ b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
@@ -901,7 +901,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/qscriptqobject/qscriptqobject.pro b/tests/auto/qscriptqobject/qscriptqobject.pro
index be3a98042e..d28fbef055 100644
--- a/tests/auto/qscriptqobject/qscriptqobject.pro
+++ b/tests/auto/qscriptqobject/qscriptqobject.pro
@@ -2,4 +2,6 @@ load(qttest_p4)
QT = core gui script
SOURCES += tst_qscriptqobject.cpp
-
+symbian: {
+ TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb"
+}
diff --git a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp b/tests/auto/qscriptqobject/tst_qscriptqobject.cpp
index ee914abdce..56216961c2 100644
--- a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp
+++ b/tests/auto/qscriptqobject/tst_qscriptqobject.cpp
@@ -54,6 +54,10 @@
struct CustomType
{
+#if defined (Q_CC_NOKIAX86)
+ // Compiler crash workaround
+ CustomType() {}
+#endif
QString string;
};
Q_DECLARE_METATYPE(CustomType)
@@ -2261,7 +2265,7 @@ void tst_QScriptExtQObject::findChild()
QCOMPARE(result.isNull(), true);
}
- {
+ {
QScriptValue result = m_engine->evaluate("myObject.findChild('myChildObject')");
QCOMPARE(result.isQObject(), true);
QCOMPARE(result.toQObject(), child);
diff --git a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro
index c07ab531f7..58c53e42ba 100644
--- a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro
+++ b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro
@@ -3,10 +3,10 @@ QT = core script
SOURCES += tst_qscriptv8testsuite.cpp
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 50eb19f23c..7215852347 100644
--- a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp
+++ b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp
@@ -254,6 +254,11 @@ 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
+
QVector<uint> *data = qt_meta_data_tst_Suite();
// content:
*data << 1 // revision
diff --git a/tests/auto/qset/qset.pro b/tests/auto/qset/qset.pro
index 2656dafc89..05ad07d5e7 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 0000000000..a4ad8d7644
--- /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 d0f11aaf40..ddf9724396 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 88b2b80905..e02cd8b7bb 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 0259d0a9f6..b40a06d478 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 e17d03cffd..a752ba0260 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 e294a756bf..779a942437 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 bcf7fc9aef..d256e01c7f 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,18 @@ void tst_QSharedMemory::simpleThreadedProducerConsumer()
#endif
Producer p;
+#if defined(Q_OS_SYMBIAN)
+ p.setStackSize(0x14000);
+#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(0x14000);
+#endif
consumers.last()->start();
}
@@ -697,6 +716,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 +732,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 +753,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 aaef779d62..6153c76143 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 1fdcf65147..627af87af0 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 1759323fd4..bbd31d7c7a 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 210f3fae10..98fbeb53e4 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 bfcaab7eea..b1fba732c8 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 172bdadbb6..4bc4a7b751 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 dddfa56974..14786b8b35 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 c1288f6c98..703d721545 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 7f6d9328f0..d4ae159637 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()
@@ -69,9 +70,10 @@ tst_QSocketNotifier::~tst_QSocketNotifier()
class UnexpectedDisconnectTester : public QObject
{
Q_OBJECT
+ int sequence;
+
public:
QNativeSocketEngine *readEnd1, *readEnd2;
- int sequence;
UnexpectedDisconnectTester(QNativeSocketEngine *s1, QNativeSocketEngine *s2)
: readEnd1(s1), readEnd2(s2), sequence(0)
@@ -84,18 +86,25 @@ public:
connect(notifier2, SIGNAL(activated(int)), SLOT(handleActivated()));
}
+ const int getSequence() {
+ return sequence;
+ }
+
+ void incSequence() {
+ ++sequence;
+ }
+
public slots:
void handleActivated()
{
char data1[1], data2[1];
- ++sequence;
- if (sequence == 1) {
+ incSequence();
+ if (getSequence() == 1) {
// read from both ends
(void) readEnd1->read(data1, sizeof(data1));
(void) readEnd2->read(data2, sizeof(data2));
emit finished();
- } else if (sequence == 2) {
- // we should never get here
+ } else if (getSequence() == 2) {
QCOMPARE(readEnd2->read(data2, sizeof(data2)), qint64(-2));
QVERIFY(readEnd2->isValid());
}
@@ -155,9 +164,12 @@ 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.getSequence() <= 0);
QVERIFY(readEnd1.state() == QAbstractSocket::ConnectedState);
QVERIFY(readEnd2.state() == QAbstractSocket::ConnectedState);
@@ -165,7 +177,7 @@ void tst_QSocketNotifier::unexpectedDisconnection()
qWarning("### Windows returns 1 activation, Unix returns 2.");
QCOMPARE(tester.sequence, 1);
#else
- QCOMPARE(tester.sequence, 2);
+ QCOMPARE(tester.getSequence(), 2);
#endif
readEnd1.close();
@@ -175,5 +187,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 d19b732fb9..4a32852092 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 5a8bb38922..2fc80da6d6 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);
@@ -319,11 +319,11 @@ void tst_QSocks5SocketEngine::simpleConnectToIMAP()
socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080));
- QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143));
+ QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143));
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState);
QVERIFY(socketDevice.waitForWrite());
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState);
- QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP());
+ QVERIFY(socketDevice.peerAddress() == QHostAddress(QtNetworkSettings::serverIP()));
// Wait for the greeting
QVERIFY(socketDevice.waitForRead());
@@ -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);
@@ -666,9 +669,10 @@ 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");
+ QVERIFY(!tcpSocketNonBlocking_data.isEmpty());
+ QCOMPARE(tcpSocketNonBlocking_data.at(0).toLatin1().constData(),
+ 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,14 +837,15 @@ void tst_QSocks5SocketEngine::passwordAuth()
socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080, "qsockstest", "password"));
- QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143));
+ // Connect to imap.trolltech.com's IP
+ QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143));
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState);
QVERIFY(socketDevice.waitForWrite());
- if (!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)) {
+ if (!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143)) {
qDebug("%d, %s", socketDevice.error(), socketDevice.errorString().toLatin1().constData());
}
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState);
- QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP());
+ QVERIFY(socketDevice.peerAddress() == QHostAddress(QtNetworkSettings::serverIP()));
// Wait for the greeting
QVERIFY(socketDevice.waitForRead());
@@ -853,10 +857,9 @@ void tst_QSocks5SocketEngine::passwordAuth()
array.resize(available);
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");
-
+ // Check that the greeting is what we expect it to be
+ QCOMPARE(array.constData(), QtNetworkSettings::expectedReplyIMAP().constData());
+
// Write a logout message
QByteArray array2 = "XXXX LOGOUT\r\n";
QVERIFY(socketDevice.write(array2.data(),
@@ -901,16 +904,16 @@ void tst_QSocks5SocketEngine::passwordAuth2()
socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1081));
socketDevice.setReceiver(this);
- QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143));
+ QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143));
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState);
while (socketDevice.state() == QAbstractSocket::ConnectingState) {
QVERIFY(socketDevice.waitForWrite());
- socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143);
+ socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143);
}
if (socketDevice.state() != QAbstractSocket::ConnectedState)
qDebug("%d, %s", socketDevice.error(), socketDevice.errorString().toLatin1().constData());
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState);
- QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP());
+ QVERIFY(socketDevice.peerAddress() == QHostAddress(QtNetworkSettings::serverIP()));
// Wait for the greeting
QVERIFY(socketDevice.waitForRead());
@@ -922,10 +925,9 @@ void tst_QSocks5SocketEngine::passwordAuth2()
array.resize(available);
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");
-
+ // Check that the greeting is what we expect it to be
+ QCOMPARE(array.constData(), QtNetworkSettings::expectedReplyIMAP().constData());
+
// Write a logout message
QByteArray array2 = "XXXX LOGOUT\r\n";
QVERIFY(socketDevice.write(array2.data(),
diff --git a/tests/auto/qsound/qsound.pro b/tests/auto/qsound/qsound.pro
index 20c60980de..75da2e64bb 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 a7ff0a6ad3..8c3e40b3a4 100644
--- a/tests/auto/qsplitter/qsplitter.pro
+++ b/tests/auto/qsplitter/qsplitter.pro
@@ -4,7 +4,7 @@ SOURCES += tst_qsplitter.cpp
contains(QT_CONFIG, qt3support): QT += qt3support
-wince*: {
+wince*|symbian*: {
addFiles.sources = extradata.txt setSizes3.dat
addFiles.path = .
DEPLOYMENT += addFiles
diff --git a/tests/auto/qsql/qsql.pro b/tests/auto/qsql/qsql.pro
index 2c0e337eed..6660f42f1d 100644
--- a/tests/auto/qsql/qsql.pro
+++ b/tests/auto/qsql/qsql.pro
@@ -8,3 +8,11 @@ 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 3bca79a1a8..623523dc7d 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 570c88e145..855e72028a 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 04875fdd71..022d73f211 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 79966374d9..d512f50776 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 6004ab02eb..ede90b0da6 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 819ae59f79..db92c09399 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 a25cb93a88..fe7185a622 100644
--- a/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
+++ b/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
@@ -8,6 +8,12 @@ wince*: {
plugFiles.path = .
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 170862e195..a1a0d359c6 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 9049f4c656..8650e6ce92 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 f3f7adbc3e..b237f2e5e9 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 7fd92d6358..2366414149 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 QDir::currentPath().toAscii()
+#endif
+
class tst_QSslCertificate : public QObject
{
Q_OBJECT
diff --git a/tests/auto/qsslcipher/qsslcipher.pro b/tests/auto/qsslcipher/qsslcipher.pro
index 8a99274592..6eae588155 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 1385d2e4fa..ee5872b98c 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 5cab3d584c..32138f84f9 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 fc0e18e1fc..7a41e5bcee 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 0000000000..36436b6248
--- /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 c29fc68ed2..8f61318e10 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 23eee29259..225f4d179c 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 {
@@ -243,13 +249,13 @@ void tst_QSslSocket::initTestCase_data()
QTest::addColumn<bool>("setProxy");
QTest::addColumn<int>("proxyType");
- QTest::newRow("WithoutProxy") << false << 0;
+ //QTest::newRow("WithoutProxy") << false << 0;
#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy);
- QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic);
+ //QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic);
- QTest::newRow("WithHttpProxy") << true << int(HttpProxy);
- QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic);
+ //QTest::newRow("WithHttpProxy") << true << int(HttpProxy);
+ //QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic);
// uncomment the line below when NTLM works
// QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm);
#endif
@@ -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,10 @@ void tst_QSslSocket::sslErrors()
socket->waitForEncrypted(5000);
SslErrorList output;
- foreach (QSslError error, socket->sslErrors())
+ foreach (QSslError error, socket->sslErrors()) {
+ //printf("error = %s\n", error.errorString().toAscii().data());
output << error.error();
+ }
#ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND
if (output.last() == QSslError::CertificateUntrusted)
@@ -583,16 +592,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();
@@ -683,10 +692,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 +755,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 +948,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()
@@ -1047,7 +1068,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 +1311,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);
@@ -1490,6 +1515,10 @@ void tst_QSslSocket::disconnectFromHostWhenConnecting()
// 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 +1526,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);
- QVERIFY(socket->waitForDisconnected(5000));
+#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 +1573,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 93f64c5d4b..0e26665604 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 fba7b1bd57..794c5e636a 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/qstl/qstl.pro b/tests/auto/qstl/qstl.pro
index 07cc314eed..5c9987496c 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 eb52d907a1..ed758c634b 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 85dbda0e70..c77875a91c 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 b2ad23db4a..aee074bad3 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 0a4081fa7e..eab0bbb193 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 ba0908afa9..8163f26847 100644
--- a/tests/auto/qstyle/qstyle.pro
+++ b/tests/auto/qstyle/qstyle.pro
@@ -1,7 +1,8 @@
load(qttest_p4)
+TARGET.EPOCHEAPSIZE = 0x200000 0x800000
SOURCES += tst_qstyle.cpp
-wince*: {
+wince*|symbian*: {
DEFINES += SRCDIR=\\\".\\\"
addPixmap.sources = task_25863.png
addPixmap.path = .
@@ -9,5 +10,3 @@ wince*: {
} else {
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
-
-
diff --git a/tests/auto/qstyle/tst_qstyle.cpp b/tests/auto/qstyle/tst_qstyle.cpp
index 2cb508080c..5076af6cfe 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 *)
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 f6101f4f04..eada969d96 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 1eb72b3302..450bcd3714 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 1b4115a53e..614d3f8ad6 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 120d9f0ed0..8cfbcceed3 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 1699e72c61..3c2f6831da 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 917c281f29..e822fec7e8 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 62ea054adc..b8d3a4ac8f 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 2fd786fe19..f2f131f527 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 2368a568fb..72099d45c2 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 2b2a01613f..d66d0ac67f 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 f9f8823d94..b0f44cd4fc 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 293c9fd5bd..464cb7553f 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 6df3f83294..f135d266b7 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 3ca854f641..bdeaa92d8a 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 5c82cbb926..e630f73da8 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 6a96889e5a..4bbec23dc2 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 696375d9d9..0f93deffe0 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 6b0a5be08c..44e655053c 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>
@@ -78,11 +81,10 @@
#include <QTimer>
#include <QDebug>
#ifndef TEST_QNETWORK_PROXY
-#define 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>
@@ -247,6 +249,7 @@ int tst_QTcpSocket::loopLevel = 0;
tst_QTcpSocket::tst_QTcpSocket()
{
+ Q_SET_DEFAULT_IAP
tmpSocket = 0;
}
@@ -899,8 +902,12 @@ void tst_QTcpSocket::disconnectWhileConnecting()
socket->disconnectFromHost();
}
- connect(socket, SIGNAL(disconnected()), SLOT(exitLoopSlot()));
+ 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) {
@@ -935,7 +942,7 @@ public:
: server(0), ok(false), quit(false)
{ }
- ~ReceiverThread() { wait(); delete server; }
+ ~ReceiverThread() { /*delete server;*/ terminate(); wait(); }
bool listen()
{
@@ -952,7 +959,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;
@@ -960,7 +971,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;
@@ -1008,7 +1023,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));
@@ -1018,7 +1037,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);
}
@@ -1054,7 +1073,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
@@ -1159,13 +1182,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));
@@ -1203,7 +1226,7 @@ void tst_QTcpSocket::readLineString()
QVERIFY(socket->waitForReadyRead(10000));
QByteArray arr = socket->readLine();
- QCOMPARE(arr, expected);
+ QCOMPARE(arr, QtNetworkSettings::expectedReplyIMAP());
delete socket;
}
@@ -1300,11 +1323,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());
@@ -1431,9 +1462,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());
}
}
@@ -1453,12 +1482,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());
}
}
@@ -1757,7 +1783,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();
@@ -1975,6 +2010,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);
@@ -2193,11 +2230,13 @@ 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)
+ //QSKIP("On Symbian Emulator not clear what to expect + server settings", SkipAll);
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()
@@ -2353,5 +2392,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 bde990ab74..0f2a6ea732 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 66896a834c..16779728e9 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 59ab957ce3..d03993e569 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 4d2ff010df..cba5a74c84 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 eecc5276f9..253e8645bd 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 6da3bfb78e..e159a3cb47 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 08173d14c9..c60b031307 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 9c07e76763..7d4fdb3c47 100644
--- a/tests/auto/qtextcodec/test/test.pro
+++ b/tests/auto/qtextcodec/test/test.pro
@@ -1,7 +1,7 @@
load(qttest_p4)
TARGET = ../tst_qtextcodec
SOURCES += ../tst_qtextcodec.cpp
-wince*: {
+wince*|symbian {
addFiles.sources = ../*.txt
addFiles.path = .
DEPLOYMENT += addFiles
diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp
index 9f51805134..403a75111f 100644
--- a/tests/auto/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp
@@ -45,6 +45,7 @@
#include <qtextcodec.h>
#include <qfile.h>
#include <qtextdocument.h>
+#include <time.h>
#include <qprocess.h>
class tst_QTextCodec : public QObject
@@ -278,7 +279,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 +311,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 +1685,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 142dd47222..02f5dcb9b6 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 d54645c9cf..776c3482a3 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()
{
diff --git a/tests/auto/qtextlayout/qtextlayout.pro b/tests/auto/qtextlayout/qtextlayout.pro
index 2da4d8a784..381f09e5e9 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/qtextodfwriter/qtextodfwriter.pro b/tests/auto/qtextodfwriter/qtextodfwriter.pro
index 3c40d67c9c..2689894dad 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 1971493fb4..d784c99896 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 bae7717aa1..b24708c86f 100644
--- a/tests/auto/qtextstream/test/test.pro
+++ b/tests/auto/qtextstream/test/test.pro
@@ -17,15 +17,20 @@ 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
+}
+
+wince*: {
DEFINES += SRCDIR=\\\"\\\"
-} else {
- DEFINES += SRCDIR=\\\"$$PWD/../\\\"
+}else:symbian {
+ # Symbian can't define SRCDIR meaningfully here
+}else {
+ DEFINES += SRCDIR=\\\"$$PWD/../\\\"
}
diff --git a/tests/auto/qtextstream/tst_qtextstream.cpp b/tests/auto/qtextstream/tst_qtextstream.cpp
index d05dcf8af3..484d7c9395 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
@@ -472,7 +476,7 @@ tst_QTextStream::tst_QTextStream()
}
tst_QTextStream::~tst_QTextStream()
-{
+{
}
void tst_QTextStream::init()
@@ -1247,7 +1251,11 @@ void tst_QTextStream::stillOpenWhenAtEnd()
#endif
QTcpSocket socket;
socket.connectToHost(QtNetworkSettings::serverName(), 143);
+#if defined(Q_OS_SYMBIAN)
+ QVERIFY(socket.waitForReadyRead(30000));
+#else
QVERIFY(socket.waitForReadyRead(5000));
+#endif
QTextStream stream2(&socket);
while (!stream2.readLine().isNull()) {}
@@ -1490,8 +1498,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 +1524,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 +1545,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 +4306,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 c4d4f2a55e..4ea8fe543f 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 3a7d83f5ab..0e0eb6fd42 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 f4f57009ab..376ba654d6 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 93fc74cf97..88277a001f 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 57d67a8373..78204552e5 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 a16035fd19..79ae7dbd0b 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 43b755347c..5d18cf0b84 100644
--- a/tests/auto/qtimer/tst_qtimer.cpp
+++ b/tests/auto/qtimer/tst_qtimer.cpp
@@ -84,6 +84,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
@@ -144,6 +146,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;
@@ -154,11 +163,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);
}
@@ -248,7 +257,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)
@@ -389,29 +398,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));
@@ -480,6 +498,55 @@ 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 7cba3dbb52..298feb2034 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 6914054de3..39e3700591 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 0d67f707ab..30ffc1c25d 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 b21a97355b..65cb27a3c0 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 77c345981f..1e74f494f1 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 ad5e7acc18..b762acb434 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 b1809d6a2a..06a2e3551b 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 2444dac816..2e0a020543 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 68a53a0505..db18eb5b10 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
}
@@ -228,7 +228,7 @@ void tst_QUdpSocket::broadcasting()
for (int j = 0; j < 100; ++j) {
broadcastSocket.writeDatagram(message[i], strlen(message[i]),
- QHostAddress::Broadcast, 5000);
+ QHostAddress::Broadcast, 5000);
QTestEventLoop::instance().enterLoop(15);
if (QTestEventLoop::instance().timeout()) {
#if defined(Q_OS_FREEBSD)
@@ -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);
@@ -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());
@@ -488,15 +507,13 @@ void tst_QUdpSocket::performance()
QUdpSocket client;
client.connectToHost(serverAddress, server.localPort());
-
- QByteArray arr(8192, '@');
-
+
QTime stopWatch;
stopWatch.start();
qint64 nbytes = 0;
while (stopWatch.elapsed() < 5000) {
- for (int i = 0; i < 100; ++i) {
+ for (int i = 0; i < 100; ++i) {
if (client.write(arr.data(), arr.size()) > 0) {
do {
nbytes += server.readDatagram(arr.data(), arr.size());
@@ -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,49 @@ 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)
+
+ //RPRocess me;
+ 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 +601,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 +621,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 +653,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 +711,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 +771,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 f04833c9a1..7438d40fb0 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 c3b1543a92..72c93bc696 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 6f3f9f21a5..f7608fa377 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 747b6c3d93..2c9c8d76b1 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 a9b9afd87a..a846d8fd3d 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();
};
@@ -3050,6 +3051,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 20bf7b7b6b..7a02790578 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 df3ee2d3f4..80311b46c6 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 7178866837..a6d272c421 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=
@@ -283,8 +289,8 @@ void tst_QWaitCondition::wait_QReadWriteLock()
int x;
for (int i = 0; i < iterations; ++i) {
{
- QReadWriteLock readWriteLock;
- QWaitCondition waitCondition;
+ QReadWriteLock readWriteLock;
+ QWaitCondition waitCondition;
readWriteLock.lockForRead();
@@ -297,8 +303,8 @@ void tst_QWaitCondition::wait_QReadWriteLock()
readWriteLock.unlock();
}
- {
- QReadWriteLock readWriteLock;
+ {
+ QReadWriteLock readWriteLock;
QWaitCondition waitCondition;
readWriteLock.lockForWrite();
@@ -320,7 +326,12 @@ void tst_QWaitCondition::wait_QReadWriteLock()
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();
}
@@ -448,7 +459,7 @@ void tst_QWaitCondition::wakeOne()
QMutex mutex;
QWaitCondition cond;
- // QMutex
+ // QMutex
wake_Thread thread[ThreadCount];
bool thread_exited[ThreadCount];
@@ -460,9 +471,9 @@ void tst_QWaitCondition::wakeOne()
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));
+ // 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();
@@ -472,18 +483,18 @@ void tst_QWaitCondition::wakeOne()
for (x = 0; x < ThreadCount; ++x) {
mutex.lock();
cond.wakeOne();
- QVERIFY(!cond.wait(&mutex, 1));
- QVERIFY(!thread[x].dummy.wait(&mutex, 1));
+ 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;
- }
+ if (thread_exited[y])
+ continue;
+ if (thread[y].wait(exited > 0 ? 1 : 1000)) {
+ thread_exited[y] = TRUE;
+ ++exited;
+ }
}
QCOMPARE(exited, 1);
@@ -492,11 +503,11 @@ void tst_QWaitCondition::wakeOne()
QCOMPARE(wake_Thread::count, 0);
- // QReadWriteLock
- QReadWriteLock readWriteLock;
- wake_Thread_2 rwthread[ThreadCount];
+ // QReadWriteLock
+ QReadWriteLock readWriteLock;
+ wake_Thread_2 rwthread[ThreadCount];
- readWriteLock.lockForWrite();
+ readWriteLock.lockForWrite();
for (x = 0; x < ThreadCount; ++x) {
rwthread[x].readWriteLock = &readWriteLock;
rwthread[x].cond = &cond;
@@ -504,9 +515,9 @@ void tst_QWaitCondition::wakeOne()
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));
+ // 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();
@@ -516,18 +527,18 @@ void tst_QWaitCondition::wakeOne()
for (x = 0; x < ThreadCount; ++x) {
readWriteLock.lockForWrite();
cond.wakeOne();
- QVERIFY(!cond.wait(&readWriteLock, 1));
- QVERIFY(!rwthread[x].dummy.wait(&readWriteLock, 1));
+ 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;
- }
+ if (thread_exited[y])
+ continue;
+ if (rwthread[y].wait(exited > 0 ? 1 : 1000)) {
+ thread_exited[y] = TRUE;
+ ++exited;
+ }
}
QCOMPARE(exited, 1);
@@ -554,9 +565,9 @@ void tst_QWaitCondition::wakeOne()
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));
+ // 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();
@@ -567,19 +578,19 @@ void tst_QWaitCondition::wakeOne()
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));
+ 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;
- }
+ if (thread_exited[y])
+ continue;
+ if (thread[y].wait(exited > 0 ? 1 : 1000)) {
+ thread_exited[y] = TRUE;
+ ++exited;
+ }
}
QCOMPARE(exited, 2);
@@ -600,9 +611,9 @@ void tst_QWaitCondition::wakeOne()
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));
+ // 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();
@@ -613,19 +624,19 @@ void tst_QWaitCondition::wakeOne()
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));
+ 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;
- }
+ if (thread_exited[y])
+ continue;
+ if (rwthread[y].wait(exited > 0 ? 1 : 1000)) {
+ thread_exited[y] = TRUE;
+ ++exited;
+ }
}
QCOMPARE(exited, 2);
@@ -643,7 +654,7 @@ void tst_QWaitCondition::wakeAll()
QMutex mutex;
QWaitCondition cond;
- // QMutex
+ // QMutex
wake_Thread thread[ThreadCount];
mutex.lock();
@@ -661,7 +672,7 @@ void tst_QWaitCondition::wakeAll()
// wake up all threads at once
mutex.lock();
cond.wakeAll();
- QVERIFY(!cond.wait(&mutex, 1));
+ QVERIFY(!cond.wait(&mutex, COND_WAIT_TIME));
mutex.unlock();
int exited = 0;
@@ -673,8 +684,8 @@ void tst_QWaitCondition::wakeAll()
QCOMPARE(exited, ThreadCount);
QCOMPARE(wake_Thread::count, 0);
- // QReadWriteLock
- QReadWriteLock readWriteLock;
+ // QReadWriteLock
+ QReadWriteLock readWriteLock;
wake_Thread_2 rwthread[ThreadCount];
readWriteLock.lockForWrite();
@@ -692,10 +703,10 @@ void tst_QWaitCondition::wakeAll()
// wake up all threads at once
readWriteLock.lockForWrite();
cond.wakeAll();
- QVERIFY(!cond.wait(&readWriteLock, 1));
+ QVERIFY(!cond.wait(&readWriteLock, COND_WAIT_TIME));
readWriteLock.unlock();
- exited = 0;
+ exited = 0;
for (x = 0; x < ThreadCount; ++x) {
if (rwthread[x].wait(1000))
++exited;
diff --git a/tests/auto/qwidget/qwidget.pro b/tests/auto/qwidget/qwidget.pro
index d394400e4a..59c1753751 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 0f0a1af91c..0b2da109f5 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
@@ -6106,7 +6177,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
;
@@ -6201,7 +6275,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
;
@@ -6296,7 +6373,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
;
@@ -7350,7 +7430,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;
@@ -7384,7 +7464,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;
@@ -8259,7 +8339,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;
}
@@ -9100,8 +9185,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()
@@ -9119,6 +9204,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;
diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
index ddd193008b..fcec097a6d 100644
--- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
+++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
@@ -152,6 +152,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 d985df6ff1..0c8bd2bd94 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 867ab9c4be..a22e45cf19 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 d2ecd496c3..58ea706158 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 42cdd4593f..acae4efb28 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 3ee12a3dc5..bd3c32c981 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 9721acce57..69cce78704 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 827608186b..49466eecbb 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 6c767cb81b..304fc54c92 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 e3d16f6589..4c00d73871 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 e8ab641ab2..386df05e28 100644
--- a/tests/auto/qxmlquery/qxmlquery.pro
+++ b/tests/auto/qxmlquery/qxmlquery.pro
@@ -12,7 +12,7 @@ QT += network
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 5c14329358..ebf992db22 100644
--- a/tests/auto/qxmlquery/tst_qxmlquery.cpp
+++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp
@@ -88,6 +88,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 e7e80072d4..bfdec58bc5 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 bf88092d84..e0c183c74e 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;
@@ -575,12 +575,16 @@ void tst_QXmlSimpleReader::inputFromSocket_data()
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 46eed566ce..ac03d421d1 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 17b95436dd..632c743f1a 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 76cf954d30..0e248babae 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 0000000000..d240fa1a48
--- /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 0000000000..9d57ae1c96
--- /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: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <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 0000000000..7533dd4e49
--- /dev/null
+++ b/tests/auto/symbian/qmainexceptions/qmainexceptions.pro
@@ -0,0 +1,5 @@
+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 0000000000..adad544c3d
--- /dev/null
+++ b/tests/auto/symbian/qmainexceptions/tst_qmainexceptions.cpp
@@ -0,0 +1,318 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <e32base.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);
+
+ 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();
+};
+
+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_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(ThrowBadAlloc());
+}
+
+void tst_qmainexceptions::testTranslateBadAlloc()
+{
+ // bad_alloc should give KErrNoMemory in an AO
+ TestSchedulerCatchesError(&TranslateThrowBadAllocL, KErrNoMemory);
+}
+
+void BigAlloc()
+{
+ int *x = new int[100000000];
+ delete [] x;
+}
+
+void TranslateBigAllocL()
+{
+ QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(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_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(
+ trapped,
+ QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(
+ User::LeaveIfError(leave)));
+ QCOMPARE(trap, trapped);
+}
+
+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);
+}
+
+void tst_qmainexceptions::testTrap()
+{
+ // testing qt_translateExceptionToSymbianErrorL
+ TRAPD(err, qt_translateExceptionToSymbianErrorL(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&) {}
+}
+
+
+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 0000000000..648335ee81
--- /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/xmlpatterns/tst_xmlpatterns.cpp b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp
index 2069d031f2..796f635dc0 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());
}
diff --git a/tests/benchmarks/qfile/main.cpp b/tests/benchmarks/qfile/main.cpp
index 5360eb5d93..f1c1e26163 100644
--- a/tests/benchmarks/qfile/main.cpp
+++ b/tests/benchmarks/qfile/main.cpp
@@ -1,5 +1,10 @@
/****************************************************************************
**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+****************************************************************************/
+
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/tests/benchmarks/qgraphicsview/benchapps/scrolltest/main.cpp b/tests/benchmarks/qgraphicsview/benchapps/scrolltest/main.cpp
index 841b027623..0e7d899341 100644
--- a/tests/benchmarks/qgraphicsview/benchapps/scrolltest/main.cpp
+++ b/tests/benchmarks/qgraphicsview/benchapps/scrolltest/main.cpp
@@ -133,7 +133,7 @@ int main(int argc, char *argv[])
#if 0
ItemMover mover(scrollItem);
#endif
-
+
CountView view;
view.setScene(&scene);
view.setSceneRect(-25, -25, 150, 150);
diff --git a/tests/benchmarks/qiodevice/main.cpp b/tests/benchmarks/qiodevice/main.cpp
index 5a8c9c7112..098608323e 100644
--- a/tests/benchmarks/qiodevice/main.cpp
+++ b/tests/benchmarks/qiodevice/main.cpp
@@ -66,8 +66,10 @@ void tst_qiodevice::read_data()
QTest::newRow("100k") << qint64(100 * 1024);
QTest::newRow("1000k") << qint64(1000 * 1024);
QTest::newRow("10000k") << qint64(10000 * 1024);
+#ifndef Q_OS_SYMBIAN // Symbian devices don't (yet) have enough available RAM to run these
QTest::newRow("100000k") << qint64(100000 * 1024);
QTest::newRow("1000000k") << qint64(1000000 * 1024);
+#endif
}
void tst_qiodevice::read_old()
diff --git a/tests/benchmarks/qiodevice/qiodevice.pro b/tests/benchmarks/qiodevice/qiodevice.pro
index 59b63022dc..749a4d68d3 100755
--- a/tests/benchmarks/qiodevice/qiodevice.pro
+++ b/tests/benchmarks/qiodevice/qiodevice.pro
@@ -1,6 +1,7 @@
load(qttest_p4)
TEMPLATE = app
TARGET = tst_qiodevice
+TARGET.EPOCHEAPSIZE = 0x100000 0x2000000
DEPENDPATH += .
INCLUDEPATH += .