From 862a8197627a0128a126d4a5d929523bb2a1bf2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Mon, 16 May 2011 16:59:05 +0200 Subject: Compile auto tests. Reviewed-by: mstormo --- tests/auto/platformsocketengine/platformsocketengine.pro | 2 +- tests/auto/qauthenticator/qauthenticator.pro | 2 +- tests/auto/qcolumnview/qcolumnview.pro | 1 + tests/auto/qcombobox/qcombobox.pro | 1 + tests/auto/qcssparser/qcssparser.pro | 2 +- tests/auto/qdbusmarshall/test/test.pro | 2 +- tests/auto/qfiledialog/qfiledialog.pro | 1 + tests/auto/qfileinfo/qfileinfo.pro | 2 +- tests/auto/qfilesystemmodel/qfilesystemmodel.pro | 2 +- tests/auto/qgl/qgl.pro | 2 +- tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro | 1 + tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro | 1 + tests/auto/qgraphicsitem/qgraphicsitem.pro | 1 + tests/auto/qgraphicsscene/qgraphicsscene.pro | 1 + tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro | 1 + tests/auto/qhostinfo/qhostinfo.pro | 2 +- tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro | 2 +- tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro | 2 +- tests/auto/qhttpsocketengine/qhttpsocketengine.pro | 2 +- tests/auto/qlistwidget/qlistwidget.pro | 1 + tests/auto/qmainwindow/qmainwindow.pro | 2 +- tests/auto/qnetworkreply/test/test.pro | 2 +- tests/auto/qobject/tst_qobject.pro | 3 ++- tests/auto/qpathclipper/qpathclipper.pro | 1 + tests/auto/qpixmapcache/qpixmapcache.pro | 1 + tests/auto/qsidebar/qsidebar.pro | 1 + tests/auto/qsocketnotifier/qsocketnotifier.pro | 2 +- tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp | 4 ++-- tests/auto/qsocks5socketengine/qsocks5socketengine.pro | 2 +- tests/auto/qsslsocket/qsslsocket.pro | 2 +- .../qsslsocket_onDemandCertificates_member.pro | 2 +- .../qsslsocket_onDemandCertificates_static.pro | 2 +- tests/auto/qstylesheetstyle/qstylesheetstyle.pro | 2 +- tests/auto/qtcpsocket/test/test.pro | 1 + tests/auto/qtextedit/qtextedit.pro | 1 + tests/auto/qtextlayout/qtextlayout.pro | 1 + tests/auto/qtextpiecetable/qtextpiecetable.pro | 1 + tests/auto/qtipc/qsharedmemory/qsystemlock/qsystemlock.pro | 2 +- tests/auto/qtipc/qsharedmemory/src/src.pri | 1 + tests/auto/qtoolbar/qtoolbar.pro | 1 + 40 files changed, 42 insertions(+), 23 deletions(-) (limited to 'tests') diff --git a/tests/auto/platformsocketengine/platformsocketengine.pro b/tests/auto/platformsocketengine/platformsocketengine.pro index faf745c679..99ae358a93 100644 --- a/tests/auto/platformsocketengine/platformsocketengine.pro +++ b/tests/auto/platformsocketengine/platformsocketengine.pro @@ -7,7 +7,7 @@ requires(contains(QT_CONFIG,private_tests)) MOC_DIR=tmp -QT = core network +QT = core-private network-private symbian { TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qauthenticator/qauthenticator.pro b/tests/auto/qauthenticator/qauthenticator.pro index 05f83bc166..8ddb13b0df 100644 --- a/tests/auto/qauthenticator/qauthenticator.pro +++ b/tests/auto/qauthenticator/qauthenticator.pro @@ -1,5 +1,5 @@ load(qttest_p4) requires(contains(QT_CONFIG,private_tests)) -QT = core network +QT = core network-private SOURCES += tst_qauthenticator.cpp DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/qcolumnview/qcolumnview.pro b/tests/auto/qcolumnview/qcolumnview.pro index 754f06fd49..e36df030c2 100644 --- a/tests/auto/qcolumnview/qcolumnview.pro +++ b/tests/auto/qcolumnview/qcolumnview.pro @@ -1,4 +1,5 @@ CONFIG += qttest_p4 +QT += gui-private core-private SOURCES += tst_qcolumnview.cpp TARGET = tst_qcolumnview diff --git a/tests/auto/qcombobox/qcombobox.pro b/tests/auto/qcombobox/qcombobox.pro index 2ac5c7c53b..a8f0e6ad23 100644 --- a/tests/auto/qcombobox/qcombobox.pro +++ b/tests/auto/qcombobox/qcombobox.pro @@ -1,3 +1,4 @@ load(qttest_p4) +QT += gui-private core-private SOURCES += tst_qcombobox.cpp diff --git a/tests/auto/qcssparser/qcssparser.pro b/tests/auto/qcssparser/qcssparser.pro index f696f195de..16fa265231 100644 --- a/tests/auto/qcssparser/qcssparser.pro +++ b/tests/auto/qcssparser/qcssparser.pro @@ -1,6 +1,6 @@ load(qttest_p4) SOURCES += tst_qcssparser.cpp -QT += xml +QT += xml gui-private requires(contains(QT_CONFIG,private_tests)) !symbian: { diff --git a/tests/auto/qdbusmarshall/test/test.pro b/tests/auto/qdbusmarshall/test/test.pro index 71fc6563c1..ba4d99b57d 100644 --- a/tests/auto/qdbusmarshall/test/test.pro +++ b/tests/auto/qdbusmarshall/test/test.pro @@ -3,7 +3,7 @@ SOURCES += ../tst_qdbusmarshall.cpp TARGET = ../tst_qdbusmarshall QT = core -QT += dbus +QT += core-private dbus-private LIBS += $$QT_LIBS_DBUS QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS diff --git a/tests/auto/qfiledialog/qfiledialog.pro b/tests/auto/qfiledialog/qfiledialog.pro index 68f2e3c146..57828b1bd4 100644 --- a/tests/auto/qfiledialog/qfiledialog.pro +++ b/tests/auto/qfiledialog/qfiledialog.pro @@ -4,6 +4,7 @@ load(qttest_p4) +QT += core-private gui-private SOURCES += tst_qfiledialog.cpp wince*|symbian { diff --git a/tests/auto/qfileinfo/qfileinfo.pro b/tests/auto/qfileinfo/qfileinfo.pro index 6f01f6705f..2fd626a57e 100644 --- a/tests/auto/qfileinfo/qfileinfo.pro +++ b/tests/auto/qfileinfo/qfileinfo.pro @@ -1,7 +1,7 @@ load(qttest_p4) SOURCES += tst_qfileinfo.cpp -QT = core +QT = core-private RESOURCES += qfileinfo.qrc diff --git a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro index 04cea4805c..ab121306e3 100644 --- a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro +++ b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro @@ -1,6 +1,6 @@ CONFIG += qttest_p4 -QT = core gui +QT = core-private gui SOURCES += tst_qfilesystemmodel.cpp TARGET = tst_qfilesystemmodel diff --git a/tests/auto/qgl/qgl.pro b/tests/auto/qgl/qgl.pro index 20f8018f4c..74d9803d2f 100644 --- a/tests/auto/qgl/qgl.pro +++ b/tests/auto/qgl/qgl.pro @@ -4,7 +4,7 @@ load(qttest_p4) requires(contains(QT_CONFIG,opengl)) -QT += opengl +QT += opengl-private gui-private core-private contains(QT_CONFIG,egl):DEFINES += QGL_EGL win32:!wince*: DEFINES += QT_NO_EGL diff --git a/tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro b/tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro index 87684258ed..e1829b0b6b 100644 --- a/tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro +++ b/tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro @@ -1,3 +1,4 @@ load(qttest_p4) +QT += core-private gui-private SOURCES += tst_qgraphicsanchorlayout.cpp CONFIG += parallel_test diff --git a/tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro b/tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro index 90b78783d9..535de0c07e 100644 --- a/tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro +++ b/tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro @@ -1,3 +1,4 @@ load(qttest_p4) +QT += core-private gui-private SOURCES += tst_qgraphicsanchorlayout1.cpp CONFIG += parallel_test diff --git a/tests/auto/qgraphicsitem/qgraphicsitem.pro b/tests/auto/qgraphicsitem/qgraphicsitem.pro index 20acf35b33..ed30cae759 100644 --- a/tests/auto/qgraphicsitem/qgraphicsitem.pro +++ b/tests/auto/qgraphicsitem/qgraphicsitem.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += core-private gui-private SOURCES += tst_qgraphicsitem.cpp DEFINES += QT_NO_CAST_TO_ASCII diff --git a/tests/auto/qgraphicsscene/qgraphicsscene.pro b/tests/auto/qgraphicsscene/qgraphicsscene.pro index 82fa423e66..635fb9b4e6 100644 --- a/tests/auto/qgraphicsscene/qgraphicsscene.pro +++ b/tests/auto/qgraphicsscene/qgraphicsscene.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += core-private gui-private SOURCES += tst_qgraphicsscene.cpp RESOURCES += images.qrc win32:!wince*: LIBS += -lUser32 diff --git a/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro b/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro index 1fdd176b3b..0d0fd0db1a 100644 --- a/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro +++ b/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro @@ -1,4 +1,5 @@ load(qttest_p4) requires(contains(QT_CONFIG,private_tests)) +QT += core-private gui-private SOURCES += tst_qgraphicssceneindex.cpp CONFIG += parallel_test diff --git a/tests/auto/qhostinfo/qhostinfo.pro b/tests/auto/qhostinfo/qhostinfo.pro index 97197a9b95..77ce1867d1 100644 --- a/tests/auto/qhostinfo/qhostinfo.pro +++ b/tests/auto/qhostinfo/qhostinfo.pro @@ -2,7 +2,7 @@ load(qttest_p4) SOURCES += tst_qhostinfo.cpp -QT = core network +QT = core-private network-private wince*: { LIBS += ws2.lib diff --git a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro index 223c4e1c96..98511ac86e 100644 --- a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro +++ b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro @@ -3,7 +3,7 @@ SOURCES += tst_qhttpnetworkconnection.cpp INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/zlib requires(contains(QT_CONFIG,private_tests)) -QT = core network +QT = core-private network-private symbian: TARGET.CAPABILITY = NetworkServices symbian: { diff --git a/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro b/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro index 36d56c6f20..8ce9f6f760 100644 --- a/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro +++ b/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro @@ -3,5 +3,5 @@ SOURCES += tst_qhttpnetworkreply.cpp INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/zlib requires(contains(QT_CONFIG,private_tests)) -QT = core network +QT = core-private network-private symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qhttpsocketengine/qhttpsocketengine.pro b/tests/auto/qhttpsocketengine/qhttpsocketengine.pro index 6df619200b..f26abbe8d9 100644 --- a/tests/auto/qhttpsocketengine/qhttpsocketengine.pro +++ b/tests/auto/qhttpsocketengine/qhttpsocketengine.pro @@ -6,7 +6,7 @@ include(../platformsocketengine/platformsocketengine.pri) MOC_DIR=tmp -QT = core network +QT = core-private network-private symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qlistwidget/qlistwidget.pro b/tests/auto/qlistwidget/qlistwidget.pro index faf970d027..eb4c335b5b 100644 --- a/tests/auto/qlistwidget/qlistwidget.pro +++ b/tests/auto/qlistwidget/qlistwidget.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += core-private gui-private SOURCES += tst_qlistwidget.cpp diff --git a/tests/auto/qmainwindow/qmainwindow.pro b/tests/auto/qmainwindow/qmainwindow.pro index e015f95ec1..0f6d71c6ec 100644 --- a/tests/auto/qmainwindow/qmainwindow.pro +++ b/tests/auto/qmainwindow/qmainwindow.pro @@ -1,6 +1,6 @@ load(qttest_p4) SOURCES += tst_qmainwindow.cpp - +QT += gui-private # Symbian toolchain does not support correct include semantics symbian:INCPATH+=..\\..\\..\\include\\QtGui\\private diff --git a/tests/auto/qnetworkreply/test/test.pro b/tests/auto/qnetworkreply/test/test.pro index d1f6707f6f..d415e04451 100644 --- a/tests/auto/qnetworkreply/test/test.pro +++ b/tests/auto/qnetworkreply/test/test.pro @@ -13,7 +13,7 @@ win32 { !symbian:DEFINES += SRCDIR=\\\"$$PWD/..\\\" -QT = core network +QT = core-private network-private RESOURCES += ../qnetworkreply.qrc symbian|wince*:{ diff --git a/tests/auto/qobject/tst_qobject.pro b/tests/auto/qobject/tst_qobject.pro index e31fed5d10..29de071328 100644 --- a/tests/auto/qobject/tst_qobject.pro +++ b/tests/auto/qobject/tst_qobject.pro @@ -7,7 +7,8 @@ SOURCES += moc_oldnormalizeobject.cpp QT = core \ network \ - gui + gui \ + core-private wince*: { addFiles.files = signalbug.exe addFiles.path = . diff --git a/tests/auto/qpathclipper/qpathclipper.pro b/tests/auto/qpathclipper/qpathclipper.pro index 590fba0e2d..2becd7dd03 100644 --- a/tests/auto/qpathclipper/qpathclipper.pro +++ b/tests/auto/qpathclipper/qpathclipper.pro @@ -2,6 +2,7 @@ load(qttest_p4) INCLUDEPATH += . HEADERS += paths.h SOURCES += tst_qpathclipper.cpp paths.cpp +QT += gui-private requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/qpixmapcache/qpixmapcache.pro b/tests/auto/qpixmapcache/qpixmapcache.pro index c31f039548..1ffafd6c25 100644 --- a/tests/auto/qpixmapcache/qpixmapcache.pro +++ b/tests/auto/qpixmapcache/qpixmapcache.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += gui-private SOURCES += tst_qpixmapcache.cpp diff --git a/tests/auto/qsidebar/qsidebar.pro b/tests/auto/qsidebar/qsidebar.pro index 91a2137f2c..3ace4fe8a5 100644 --- a/tests/auto/qsidebar/qsidebar.pro +++ b/tests/auto/qsidebar/qsidebar.pro @@ -1,5 +1,6 @@ CONFIG += qttest_p4 +QT += core-private SOURCES += tst_qsidebar.cpp TARGET = tst_qsidebar diff --git a/tests/auto/qsocketnotifier/qsocketnotifier.pro b/tests/auto/qsocketnotifier/qsocketnotifier.pro index 27484c89f7..c0fdc6a9b3 100644 --- a/tests/auto/qsocketnotifier/qsocketnotifier.pro +++ b/tests/auto/qsocketnotifier/qsocketnotifier.pro @@ -1,6 +1,6 @@ load(qttest_p4) SOURCES += tst_qsocketnotifier.cpp -QT = core network +QT = core-private network-private requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp index f966e7fec0..2537a6cc26 100644 --- a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp +++ b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp @@ -57,7 +57,7 @@ #include #endif #include -#include +#include class tst_QSocketNotifier : public QObject { @@ -180,7 +180,7 @@ void tst_QSocketNotifier::unexpectedDisconnection() // we have to wait until sequence value changes // as any event can make us jump out processing QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents); - QVERIFY(timer.isActive); //escape if test would hang + QVERIFY(timer.isActive()); //escape if test would hang } while(tester.sequence <= 0); QVERIFY(readEnd1.state() == QAbstractSocket::ConnectedState); diff --git a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro b/tests/auto/qsocks5socketengine/qsocks5socketengine.pro index c82c62d3e8..3a144aeacf 100644 --- a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro +++ b/tests/auto/qsocks5socketengine/qsocks5socketengine.pro @@ -7,7 +7,7 @@ include(../platformsocketengine/platformsocketengine.pri) MOC_DIR=tmp -QT = core network +QT = core-private network-private # Symbian toolchain does not support correct include semantics symbian:INCLUDEPATH+=..\\..\\..\\include\\QtNetwork\\private diff --git a/tests/auto/qsslsocket/qsslsocket.pro b/tests/auto/qsslsocket/qsslsocket.pro index 77517e05bc..76d73b7cb3 100644 --- a/tests/auto/qsslsocket/qsslsocket.pro +++ b/tests/auto/qsslsocket/qsslsocket.pro @@ -2,7 +2,7 @@ load(qttest_p4) SOURCES += tst_qsslsocket.cpp !wince*:win32:LIBS += -lws2_32 -QT += network +QT += core-private network-private QT -= gui TARGET = tst_qsslsocket diff --git a/tests/auto/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro b/tests/auto/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro index 53020eb892..42373b0324 100644 --- a/tests/auto/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro +++ b/tests/auto/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro @@ -2,7 +2,7 @@ load(qttest_p4) SOURCES += tst_qsslsocket_onDemandCertificates_member.cpp !wince*:win32:LIBS += -lws2_32 -QT += network +QT += core-private network-private QT -= gui TARGET = tst_qsslsocket_onDemandCertificates_member diff --git a/tests/auto/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro b/tests/auto/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro index 3452a92fe2..3a06ec190c 100644 --- a/tests/auto/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro +++ b/tests/auto/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro @@ -2,7 +2,7 @@ load(qttest_p4) SOURCES += tst_qsslsocket_onDemandCertificates_static.cpp !wince*:win32:LIBS += -lws2_32 -QT += network +QT += core-private network-private QT -= gui TARGET = tst_qsslsocket_onDemandCertificates_static diff --git a/tests/auto/qstylesheetstyle/qstylesheetstyle.pro b/tests/auto/qstylesheetstyle/qstylesheetstyle.pro index eada969d96..1575616b19 100644 --- a/tests/auto/qstylesheetstyle/qstylesheetstyle.pro +++ b/tests/auto/qstylesheetstyle/qstylesheetstyle.pro @@ -1,5 +1,5 @@ load(qttest_p4) - +QT += gui-private # Input SOURCES += tst_qstylesheetstyle.cpp RESOURCES += resources.qrc diff --git a/tests/auto/qtcpsocket/test/test.pro b/tests/auto/qtcpsocket/test/test.pro index 7bf5ba0074..e282de1a2e 100644 --- a/tests/auto/qtcpsocket/test/test.pro +++ b/tests/auto/qtcpsocket/test/test.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += core-private network-private SOURCES += ../tst_qtcpsocket.cpp win32: { wince*: { diff --git a/tests/auto/qtextedit/qtextedit.pro b/tests/auto/qtextedit/qtextedit.pro index cef2b300d7..5851763310 100644 --- a/tests/auto/qtextedit/qtextedit.pro +++ b/tests/auto/qtextedit/qtextedit.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += gui-private INCLUDEPATH += ../ HEADERS += diff --git a/tests/auto/qtextlayout/qtextlayout.pro b/tests/auto/qtextlayout/qtextlayout.pro index 381f09e5e9..2a180d7937 100644 --- a/tests/auto/qtextlayout/qtextlayout.pro +++ b/tests/auto/qtextlayout/qtextlayout.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += core-private gui-private HEADERS += SOURCES += tst_qtextlayout.cpp INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/harfbuzz/src diff --git a/tests/auto/qtextpiecetable/qtextpiecetable.pro b/tests/auto/qtextpiecetable/qtextpiecetable.pro index 0926b83ccc..edcb0a091c 100644 --- a/tests/auto/qtextpiecetable/qtextpiecetable.pro +++ b/tests/auto/qtextpiecetable/qtextpiecetable.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += core-private gui-private SOURCES += tst_qtextpiecetable.cpp HEADERS += ../qtextdocument/common.h diff --git a/tests/auto/qtipc/qsharedmemory/qsystemlock/qsystemlock.pro b/tests/auto/qtipc/qsharedmemory/qsystemlock/qsystemlock.pro index e232443a35..e3d99bb85c 100644 --- a/tests/auto/qtipc/qsharedmemory/qsystemlock/qsystemlock.pro +++ b/tests/auto/qtipc/qsharedmemory/qsystemlock/qsystemlock.pro @@ -1,5 +1,5 @@ CONFIG += qttest_p4 -#QT = core +QT += gui-private include(../src/src.pri) win32: CONFIG += console diff --git a/tests/auto/qtipc/qsharedmemory/src/src.pri b/tests/auto/qtipc/qsharedmemory/src/src.pri index 5bc9de62db..8aaf528447 100644 --- a/tests/auto/qtipc/qsharedmemory/src/src.pri +++ b/tests/auto/qtipc/qsharedmemory/src/src.pri @@ -1,5 +1,6 @@ INCLUDEPATH += $$PWD DEPENDPATH += $$PWD +QT += core-private SOURCES += $$PWD/qsystemlock.cpp diff --git a/tests/auto/qtoolbar/qtoolbar.pro b/tests/auto/qtoolbar/qtoolbar.pro index 4f2c8f1e1f..2c1176fe00 100644 --- a/tests/auto/qtoolbar/qtoolbar.pro +++ b/tests/auto/qtoolbar/qtoolbar.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += gui-private SOURCES += tst_qtoolbar.cpp -- cgit v1.2.3 From fc52cbbc137e576deb7a85bc0cfa0054eebc807c Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 15 Apr 2011 17:35:13 +1000 Subject: Make tst_exceptionsafety_objects part of the test set. Re-enable this test, with the two test functions that fail on Linux disabled until the failures can be diagnosed. Change-Id: I915e1a0d675cb71a80086e89f9799a4f9f6b600c Reviewed-by: Rohan McGovern (cherry picked from commit ee55dec1efe9c67518bf3e27f81b0696075f7153) --- tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp | 2 ++ tests/auto/other.pro | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp index e7e516eddd..3e4ccf53fa 100644 --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp @@ -352,6 +352,7 @@ void tst_ExceptionSafetyObjects::cleanupTestCase() void tst_ExceptionSafetyObjects::objects() { + QSKIP("This test currently crashes", SkipAll); QFETCH(AbstractTester *, objectCreator); doOOMTest(*objectCreator, 0); @@ -457,6 +458,7 @@ void tst_ExceptionSafetyObjects::widgets_data() void tst_ExceptionSafetyObjects::widgets() { + QSKIP("This test currently crashes", SkipAll); QFETCH(AbstractTester *, widgetCreator); doOOMTest(*widgetCreator, 0, 00000); diff --git a/tests/auto/other.pro b/tests/auto/other.pro index a84ab05104..2a24cb5e70 100644 --- a/tests/auto/other.pro +++ b/tests/auto/other.pro @@ -3,7 +3,7 @@ TEMPLATE=subdirs SUBDIRS=\ -# exceptionsafety_objects \ shouldn't enable it + exceptionsafety_objects \ # baselineexample \ Just an example demonstrating qbaselinetest usage lancelot \ qaccessibility \ -- cgit v1.2.3 From 11b8382d416120dfe430a3a6015a0940a6ba2a3d Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 18 Apr 2011 11:11:47 +1000 Subject: Rename test class. Fixes warning from tst_maketestselftest about test class name not matching TARGET. Change-Id: I7a81d87bb64d2902e842d097248e33eacb388746 Reviewed-by: Rohan McGovern (cherry picked from commit 069e4441f2e14a82b4ae39601734acb71c909bd9) --- .../tst_exceptionsafety_objects.cpp | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'tests') diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp index 3e4ccf53fa..c78782eabe 100644 --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp @@ -60,7 +60,7 @@ QT_USE_NAMESPACE #include "3rdparty/memcheck.h" #endif -class tst_ExceptionSafetyObjects: public QObject +class tst_ExceptionSafety_Objects: public QObject { Q_OBJECT @@ -156,7 +156,7 @@ struct DirCreator : public AbstractTester } }; -void tst_ExceptionSafetyObjects::objects_data() +void tst_ExceptionSafety_Objects::objects_data() { QTest::addColumn("objectCreator"); @@ -274,9 +274,9 @@ public: } }; -QtMsgHandler tst_ExceptionSafetyObjects::testMessageHandler; +QtMsgHandler tst_ExceptionSafety_Objects::testMessageHandler; -void tst_ExceptionSafetyObjects::safeMessageHandler(QtMsgType type, const char *msg) +void tst_ExceptionSafety_Objects::safeMessageHandler(QtMsgType type, const char *msg) { // this temporarily suspends OOM testing while handling a message int currentIndex = mallocFailIndex; @@ -301,7 +301,7 @@ void debugUnexpected() (*defaultUnexpected)(); } -void tst_ExceptionSafetyObjects::initTestCase() +void tst_ExceptionSafety_Objects::initTestCase() { // set handlers for bad exception cases, you might want to step in and breakpoint the default handlers too defaultTerminate = std::set_terminate(&debugTerminate); @@ -345,12 +345,12 @@ void tst_ExceptionSafetyObjects::initTestCase() QCOMPARE(malloc2Failed, 1); } -void tst_ExceptionSafetyObjects::cleanupTestCase() +void tst_ExceptionSafety_Objects::cleanupTestCase() { qInstallMsgHandler(testMessageHandler); } -void tst_ExceptionSafetyObjects::objects() +void tst_ExceptionSafety_Objects::objects() { QSKIP("This test currently crashes", SkipAll); QFETCH(AbstractTester *, objectCreator); @@ -389,7 +389,7 @@ template <> struct WidgetCreator : public AbstractTester QScopedPointer ptr(new QDesktopWidget()); } }; -void tst_ExceptionSafetyObjects::widgets_data() +void tst_ExceptionSafety_Objects::widgets_data() { #ifdef Q_OS_SYMBIAN // Initialise the S60 rasteriser, which crashes if started while out of memory @@ -456,7 +456,7 @@ void tst_ExceptionSafetyObjects::widgets_data() NEWROW(QTreeWidget); } -void tst_ExceptionSafetyObjects::widgets() +void tst_ExceptionSafety_Objects::widgets() { QSKIP("This test currently crashes", SkipAll); QFETCH(AbstractTester *, widgetCreator); @@ -722,12 +722,12 @@ static void containerData() QTest::newRow("erase moveable") << static_cast(containerEraseTest); } -void tst_ExceptionSafetyObjects::vector_data() +void tst_ExceptionSafety_Objects::vector_data() { containerData(); } -void tst_ExceptionSafetyObjects::vector() +void tst_ExceptionSafety_Objects::vector() { QFETCH(TestFunction, testFunction); @@ -738,30 +738,30 @@ void tst_ExceptionSafetyObjects::vector() doOOMTest(testFunction, 0); } -void tst_ExceptionSafetyObjects::list_data() +void tst_ExceptionSafety_Objects::list_data() { containerData(); } -void tst_ExceptionSafetyObjects::list() +void tst_ExceptionSafety_Objects::list() { QFETCH(TestFunction, testFunction); doOOMTest(testFunction, 0); } -void tst_ExceptionSafetyObjects::linkedList_data() +void tst_ExceptionSafety_Objects::linkedList_data() { containerData(); } -void tst_ExceptionSafetyObjects::linkedList() +void tst_ExceptionSafety_Objects::linkedList() { QFETCH(TestFunction, testFunction); doOOMTest(testFunction, 0); } -QTEST_MAIN(tst_ExceptionSafetyObjects) +QTEST_MAIN(tst_ExceptionSafety_Objects) #include "tst_exceptionsafety_objects.moc" #endif // QT_NO_EXCEPTIONS -- cgit v1.2.3 From 3b98db1606b0f9bd24821c526d8f1eb6152e6cea Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 18 Apr 2011 14:27:44 +1000 Subject: Make test compile in namespaced build. Change-Id: I824864b8db755a8dc731e3c9de39e3dd7b16224a Reviewed-by: Rohan McGovern (cherry picked from commit ced0a98b5274be6a62ae7e4a0f9fc3161d0e40cb) --- tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp index c78782eabe..ab589edee1 100644 --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp @@ -549,7 +549,9 @@ struct IntegerMoveable }; int IntegerMoveable::instanceCount = 0; +QT_BEGIN_NAMESPACE Q_DECLARE_TYPEINFO(IntegerMoveable, Q_MOVABLE_TYPE); +QT_END_NAMESPACE template class Container> void containerInsertTest(QObject*) -- cgit v1.2.3 From 667a40fe36c989d20a880f7d10512a46db8b9c9a Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 18 Apr 2011 15:38:38 +1000 Subject: Partially re-enable exception safety test Re-enabling for object types that don't crash the test. Change-Id: I8c2f0d02171c973bf1ede227d4139b52cac5939f Reviewed-by: Rohan McGovern (cherry picked from commit 3788a90338e9328710b9d3335a63fb85ab7d97fc) --- .../tst_exceptionsafety_objects.cpp | 46 +++++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp index ab589edee1..cb37049f8d 100644 --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp @@ -352,7 +352,14 @@ void tst_ExceptionSafety_Objects::cleanupTestCase() void tst_ExceptionSafety_Objects::objects() { - QSKIP("This test currently crashes", SkipAll); + QLatin1String tag = QLatin1String(QTest::currentDataTag()); + if (tag == QLatin1String("QFile") + || tag == QLatin1String("QProcess") + || tag == QLatin1String("QSettings") + || tag == QLatin1String("QThread") + || tag == QLatin1String("QThreadPool")) + QSKIP("This type of object is not currently strongly exception safe", SkipSingle); + QFETCH(AbstractTester *, objectCreator); doOOMTest(*objectCreator, 0); @@ -458,7 +465,42 @@ void tst_ExceptionSafety_Objects::widgets_data() void tst_ExceptionSafety_Objects::widgets() { - QSKIP("This test currently crashes", SkipAll); + QLatin1String tag = QLatin1String(QTest::currentDataTag()); + if (tag == QLatin1String("QColumnView") + || tag == QLatin1String("QComboBox") + || tag == QLatin1String("QCommandLinkButton") + || tag == QLatin1String("QDateEdit") + || tag == QLatin1String("QDateTimeEdit") + || tag == QLatin1String("QDesktopWidget") + || tag == QLatin1String("QDoubleSpinBox") + || tag == QLatin1String("QFontComboBox") + || tag == QLatin1String("QGroupBox") + || tag == QLatin1String("QLineEdit") + || tag == QLatin1String("QListView") + || tag == QLatin1String("QListWidget") + || tag == QLatin1String("QMainWindow") + || tag == QLatin1String("QMenu") + || tag == QLatin1String("QMenuBar") + || tag == QLatin1String("QPlainTextEdit") + || tag == QLatin1String("QProgressBar") + || tag == QLatin1String("QPushButton") + || tag == QLatin1String("QScrollArea") + || tag == QLatin1String("QSpinBox") + || tag == QLatin1String("QStackedWidget") + || tag == QLatin1String("QStatusBar") + || tag == QLatin1String("QTableView") + || tag == QLatin1String("QTableWidget") + || tag == QLatin1String("QTabWidget") + || tag == QLatin1String("QTextBrowser") + || tag == QLatin1String("QTextEdit") + || tag == QLatin1String("QTimeEdit") + || tag == QLatin1String("QToolBar") + || tag == QLatin1String("QToolBox") + || tag == QLatin1String("QTreeView") + || tag == QLatin1String("QTreeWidget") + || tag == QLatin1String("QWorkspace")) + QSKIP("This type of widget is not currently strongly exception safe", SkipSingle); + QFETCH(AbstractTester *, widgetCreator); doOOMTest(*widgetCreator, 0, 00000); -- cgit v1.2.3 From 22d6cd5cdd7c1f64de60b1761521fbaa3c05ff1b Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 18 Apr 2011 17:21:03 +1000 Subject: Don't try to run exceptionsafety_objects test by default on windows. This test relies on some API specific to MSVC's debug runtime, which is not always guaranteed to be available. Change-Id: Ib0ae4694ad51f59198dadfce802f0dfdf0522002 Reviewed-by: Rohan McGovern (cherry picked from commit 01dfb9ca25bfaec5784f404dcd4bf41bbc2b6fcb) --- tests/auto/other.pro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/other.pro b/tests/auto/other.pro index 2a24cb5e70..0b49d29cc4 100644 --- a/tests/auto/other.pro +++ b/tests/auto/other.pro @@ -3,7 +3,6 @@ TEMPLATE=subdirs SUBDIRS=\ - exceptionsafety_objects \ # baselineexample \ Just an example demonstrating qbaselinetest usage lancelot \ qaccessibility \ @@ -56,6 +55,8 @@ symbian { qs60mainapplication } +!win32-msvc*:!wince*:SUBDIRS += exceptionsafety_objects + # Following tests depends on private API !contains(QT_CONFIG, private_tests): SUBDIRS -= \ qcombobox \ -- cgit v1.2.3 From 084b7ababd33be9f2671efd1aa2faf9ac8d74cb6 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 18 Apr 2011 18:21:03 +1000 Subject: Cosmetic changes to exceptionsafety_objects test Sort test data alphabetically and remove excess whitespace. Change-Id: I0e244efca9e9adbe747a375a28a63f70992ef4f8 Reviewed-by: Trust Me (cherry picked from commit 10f3f270c8a319205590ae13bdeab063d5216441) --- .../tst_exceptionsafety_objects.cpp | 33 ++++++++++------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'tests') diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp index cb37049f8d..2f094f31e0 100644 --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp @@ -164,12 +164,12 @@ void tst_ExceptionSafety_Objects::objects_data() NEWROW(QObject); NEWROW(QBuffer); NEWROW(QFile); + NEWROW(QFSFileEngine); NEWROW(QProcess); NEWROW(QSettings); NEWROW(QThread); NEWROW(QThreadPool); NEWROW(QTranslator); - NEWROW(QFSFileEngine); #define NEWROW2(T, CREATOR) QTest::newRow(#T) << static_cast(new CREATOR) NEWROW2(QBitArray, BitArrayCreator); @@ -177,7 +177,6 @@ void tst_ExceptionSafety_Objects::objects_data() NEWROW2(QCryptographicHash, CryptographicHashCreator); NEWROW2(QDataStream, DataStreamCreator); NEWROW2(QDir, DirCreator); - } // create and destructs an object, and lets each and every allocation @@ -363,7 +362,7 @@ void tst_ExceptionSafety_Objects::objects() QFETCH(AbstractTester *, objectCreator); doOOMTest(*objectCreator, 0); - + delete objectCreator; } @@ -400,9 +399,9 @@ void tst_ExceptionSafety_Objects::widgets_data() { #ifdef Q_OS_SYMBIAN // Initialise the S60 rasteriser, which crashes if started while out of memory - QImage image(20, 20, QImage::Format_RGB32); - QPainter p(&image); - p.drawText(0, 15, "foo"); + QImage image(20, 20, QImage::Format_RGB32); + QPainter p(&image); + p.drawText(0, 15, "foo"); #endif QTest::addColumn("widgetCreator"); @@ -413,23 +412,27 @@ void tst_ExceptionSafety_Objects::widgets_data() NEWROW(QWidget); NEWROW(QButtonGroup); - NEWROW(QDesktopWidget); NEWROW(QCheckBox); + NEWROW(QColumnView); NEWROW(QComboBox); NEWROW(QCommandLinkButton); NEWROW(QDateEdit); NEWROW(QDateTimeEdit); + NEWROW(QDesktopWidget); NEWROW(QDial); NEWROW(QDoubleSpinBox); NEWROW(QFocusFrame); NEWROW(QFontComboBox); NEWROW(QFrame); NEWROW(QGroupBox); - NEWROW(QLCDNumber); NEWROW(QLabel); NEWROW(QLCDNumber); NEWROW(QLineEdit); + NEWROW(QListView); + NEWROW(QListWidget); + NEWROW(QMainWindow); NEWROW(QMenu); + NEWROW(QMenuBar); NEWROW(QPlainTextEdit); NEWROW(QProgressBar); NEWROW(QPushButton); @@ -443,24 +446,18 @@ void tst_ExceptionSafety_Objects::widgets_data() NEWROW(QStackedWidget); NEWROW(QStatusBar); NEWROW(QTabBar); + NEWROW(QTableView); + NEWROW(QTableWidget); NEWROW(QTabWidget); NEWROW(QTextBrowser); NEWROW(QTextEdit); NEWROW(QTimeEdit); + NEWROW(QToolBar); NEWROW(QToolBox); NEWROW(QToolButton); - NEWROW(QStatusBar); - NEWROW(QToolBar); - NEWROW(QMenuBar); - NEWROW(QMainWindow); - NEWROW(QWorkspace); - NEWROW(QColumnView); - NEWROW(QListView); - NEWROW(QListWidget); - NEWROW(QTableView); - NEWROW(QTableWidget); NEWROW(QTreeView); NEWROW(QTreeWidget); + NEWROW(QWorkspace); } void tst_ExceptionSafety_Objects::widgets() -- cgit v1.2.3 From 4044d3c8f5f9baff81816193433537fd033bf782 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 19 Apr 2011 12:05:59 +1000 Subject: Remove Q_ASSERT calls from gestures autotest Make the test report a useful warning, rather than terminating with an unintelligible assertion failure, if the GestureState enum is ever extended. Change-Id: Ib876a5f2986cbea4e181678a83a72e0d1444f1ee Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit ed5dd84582881bc30a5ce85902b37aae9c243978) --- tests/auto/gestures/tst_gestures.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 7327a49169..bff8a04d95 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -280,7 +280,7 @@ protected: eventsPtr->canceled << g->gestureType(); break; default: - Q_ASSERT(false); + qWarning() << "Unknown GestureState enum value:" << static_cast(g->state()); } } } else if (event->type() == CustomEvent::EventType) { @@ -823,7 +823,7 @@ public: emit gestureCanceled(e->type(), g); break; default: - Q_ASSERT(false); + qWarning() << "Unknown GestureState enum value:" << static_cast(g->state()); } } } else if (event->type() == CustomEvent::EventType) { -- cgit v1.2.3 From 29851474c70c5e2a5e3d521c0db3abf0837d8df0 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 19 Apr 2011 13:39:35 +1000 Subject: Remove unused functions. Change-Id: I8cae0550c58238bd99bc759c21b022c54fe2de8b Reviewed-by: Trust Me (cherry picked from commit 1191dc0c278ddd22556d6c8e5ea5a898fa7b35f6) --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'tests') diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 7ff1a0867c..6e580cbba3 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -377,18 +377,6 @@ QAccessible::State state(QWidget * const widget) return state; } -void printState(QWidget * const widget) -{ - qDebug() << "State for" << widget->metaObject()->className() << stateNames(state(widget)); -} - -void printState(QAccessibleInterface * const iface, const int child = 0) -{ - qDebug() << "State for" << iface->object()->metaObject()->className() << "child" << child - << iface->text(QAccessible::Name, child) << stateNames(iface->state(child)); -} - - class QtTestAccessibleWidget: public QWidget { Q_OBJECT -- cgit v1.2.3 From 6bc4d8b58fb3bc152c00ac75f67eb6a460ae639a Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 19 Apr 2011 13:55:05 +1000 Subject: Remove Q_ASSERT from accessibility autotest Instead of crashing when we can't get a QAccessibleInterface for a widget, output a useful warning and return a value that makes the test fail gracefully. Change-Id: I0b292cdd8f5a59e26bdc9b0b67cea2b58591df7d Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit d8dc5bfdff25d72e8276c6e80080d72315abe7e0) --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 6e580cbba3..5841e95165 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -371,8 +371,9 @@ static QString stateNames(int state) QAccessible::State state(QWidget * const widget) { QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget); - Q_ASSERT(iface); - QAccessible::State state = iface->state(0); + if (!iface) + qWarning() << "Cannot get QAccessibleInterface for widget"; + QAccessible::State state = (iface ? iface->state(0) : static_cast(0)); delete iface; return state; } -- cgit v1.2.3 From 7ef434c3a067168a0f370f836a0d6f6b28ad7d50 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 19 Apr 2011 14:09:44 +1000 Subject: Remove unused function. Change-Id: I197ca88e04a68dca0ea819d6e335a02607e597aa Reviewed-by: Trust Me (cherry picked from commit 1a98c473fbcbb6a9edf1b7e42babbad7d901edb4) --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 42 ------------------------ 1 file changed, 42 deletions(-) (limited to 'tests') diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 5841e95165..d59c5c8393 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -326,48 +326,6 @@ QString eventName(const int ev) } } -static QString stateNames(int state) -{ - QString stateString; - if (state == 0x00000000) stateString += " Normal"; - if (state & 0x00000001) stateString += " Unavailable"; - if (state & 0x00000002) stateString += " Selected"; - if (state & 0x00000004) stateString += " Focused"; - if (state & 0x00000008) stateString += " Pressed"; - if (state & 0x00000010) stateString += " Checked"; - if (state & 0x00000020) stateString += " Mixed"; - if (state & 0x00000040) stateString += " ReadOnly"; - if (state & 0x00000080) stateString += " HotTracked"; - if (state & 0x00000100) stateString += " DefaultButton"; - if (state & 0x00000200) stateString += " Expanded"; - if (state & 0x00000400) stateString += " Collapsed"; - if (state & 0x00000800) stateString += " Busy"; - if (state & 0x00001000) stateString += " Floating"; - if (state & 0x00002000) stateString += " Marqueed"; - if (state & 0x00004000) stateString += " Animated"; - if (state & 0x00008000) stateString += " Invisible"; - if (state & 0x00010000) stateString += " Offscreen"; - if (state & 0x00020000) stateString += " Sizeable"; - if (state & 0x00040000) stateString += " Moveable"; - if (state & 0x00080000) stateString += " SelfVoicing"; - if (state & 0x00100000) stateString += " Focusable"; - if (state & 0x00200000) stateString += " Selectable"; - if (state & 0x00400000) stateString += " Linked"; - if (state & 0x00800000) stateString += " Traversed"; - if (state & 0x01000000) stateString += " MultiSelectable"; - if (state & 0x02000000) stateString += " ExtSelectable"; - if (state & 0x04000000) stateString += " AlertLow"; - if (state & 0x08000000) stateString += " AlertMedium"; - if (state & 0x10000000) stateString += " AlertHigh"; - if (state & 0x20000000) stateString += " Protected"; - if (state & 0x3fffffff) stateString += " Valid"; - - if (stateString.isEmpty()) - stateString = "Unknown state " + QString::number(state); - - return stateString; -} - QAccessible::State state(QWidget * const widget) { QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget); -- cgit v1.2.3 From 089ad377510515a9499f390ef2e994d781dbe509 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 18 May 2011 09:58:16 +1000 Subject: If accessibility isn't built, don't try to test it Only build the autotest when the feature to be tested is in the Qt build. This is better than building and running an empty test. Change-Id: I67721f5f48296afcca64f761d12325f8e040f2d8 Reviewed-by: Rohan McGovern (cherry picked from commit cf911bc0d297ed30e615fd115b0d3ae574cb2412) Conflicts: tests/auto/qaccessibility/tst_qaccessibility.cpp --- tests/auto/other.pro | 3 +- tests/auto/qaccessibility/qaccessibility.pro | 1 + tests/auto/qaccessibility/tst_qaccessibility.cpp | 221 +---------------------- 3 files changed, 7 insertions(+), 218 deletions(-) (limited to 'tests') diff --git a/tests/auto/other.pro b/tests/auto/other.pro index 0b49d29cc4..b3715b3993 100644 --- a/tests/auto/other.pro +++ b/tests/auto/other.pro @@ -5,7 +5,6 @@ TEMPLATE=subdirs SUBDIRS=\ # baselineexample \ Just an example demonstrating qbaselinetest usage lancelot \ - qaccessibility \ qalgorithms \ qcombobox \ qcssparser \ @@ -36,6 +35,8 @@ SUBDIRS=\ windowsmobile \ nativeimagehandleprovider +contains(QT_CONFIG, accessibility):SUBDIRS += qaccessibility + contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter mac: { SUBDIRS += macgui \ diff --git a/tests/auto/qaccessibility/qaccessibility.pro b/tests/auto/qaccessibility/qaccessibility.pro index 21e286baea..75fd1e9793 100644 --- a/tests/auto/qaccessibility/qaccessibility.pro +++ b/tests/auto/qaccessibility/qaccessibility.pro @@ -1,4 +1,5 @@ load(qttest_p4) +requires(contains(QT_CONFIG,accessibility)) SOURCES += tst_qaccessibility.cpp unix:!mac:LIBS+=-lm diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index d59c5c8393..6398c8e2ac 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -350,7 +350,6 @@ public: } }; -#ifdef QTEST_ACCESSIBILITY class QtTestAccessibleWidgetIface: public QAccessibleWidget { public: @@ -368,7 +367,6 @@ public: return 0; } }; -#endif tst_QAccessibility::tst_QAccessibility() { @@ -380,17 +378,13 @@ tst_QAccessibility::~tst_QAccessibility() void tst_QAccessibility::initTestCase() { -#ifdef QTEST_ACCESSIBILITY QTestAccessibility::initialize(); QAccessible::installFactory(QtTestAccessibleWidgetIface::ifaceFactory); -#endif } void tst_QAccessibility::cleanupTestCase() { -#ifdef QTEST_ACCESSIBILITY QTestAccessibility::cleanup(); -#endif } void tst_QAccessibility::init() @@ -400,7 +394,6 @@ void tst_QAccessibility::init() void tst_QAccessibility::cleanup() { -#ifdef QTEST_ACCESSIBILITY const EventList list = QTestAccessibility::events(); if (!list.isEmpty()) { qWarning("%d accessibility event(s) were not handled in testfunction '%s':", list.count(), @@ -410,14 +403,10 @@ void tst_QAccessibility::cleanup() eventName(list.at(i).event).toAscii().constData(), list.at(i).event, list.at(i).child); } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::eventTest() { -#ifdef QTEST_ACCESSIBILITY QPushButton* button = new QPushButton(0); button->setObjectName(QString("Olaf")); @@ -438,14 +427,10 @@ void tst_QAccessibility::eventTest() QVERIFY_EVENT(button, 0, QAccessible::ObjectHide); delete button; -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::customWidget() { -#ifdef QTEST_ACCESSIBILITY QtTestAccessibleWidget* widget = new QtTestAccessibleWidget(0, "Heinz"); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget); @@ -457,14 +442,10 @@ void tst_QAccessibility::customWidget() delete iface; delete widget; -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::deletedWidget() { -#ifdef QTEST_ACCESSIBILITY QtTestAccessibleWidget *widget = new QtTestAccessibleWidget(0, "Ralf"); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget); QVERIFY(iface != 0); @@ -475,9 +456,6 @@ void tst_QAccessibility::deletedWidget() widget = 0; QVERIFY(!iface->isValid()); delete iface; -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } QWidget *tst_QAccessibility::createGUI() @@ -486,7 +464,6 @@ QWidget *tst_QAccessibility::createGUI() qWarning( "Should never get here without Qt3Support"); return 0; #else -# ifdef QTEST_ACCESSIBILITY QWidget *toplevel = new QWidget(0, Qt::X11BypassWindowManagerHint); QGridLayout *grid = new QGridLayout(toplevel, 2, 2); @@ -558,10 +535,6 @@ QWidget *tst_QAccessibility::createGUI() radioAM->setFocus(); QTestAccessibility::clearEvents(); return toplevel; -# else - Q_ASSERT(0); // this function cannot be called without accessibility support - return 0; -# endif #endif // !QT3_SUPPORT } @@ -570,7 +543,6 @@ void tst_QAccessibility::childAt() #if !defined(QT3_SUPPORT) QSKIP("This test needs Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY QWidget *toplevel = createGUI(); QAccessibleInterface *acc_toplevel = QAccessible::queryAccessibleInterface(toplevel); QVERIFY(acc_toplevel); @@ -602,9 +574,6 @@ void tst_QAccessibility::childAt() delete acc_toplevel; delete toplevel; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif // !QT3_SUPPORT } @@ -613,7 +582,6 @@ void tst_QAccessibility::childCount() #if !defined(QT3_SUPPORT) QSKIP("This test needs Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY QWidget *toplevel = createGUI(); QObject *topLeft = toplevel->child("topLeft"); QObject *topRight = toplevel->child("topRight"); @@ -646,9 +614,6 @@ void tst_QAccessibility::childCount() delete acc_bottomRight; delete toplevel; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif // !QT3_SUPPORT } @@ -657,7 +622,6 @@ void tst_QAccessibility::relationTo() #if !defined(QT3_SUPPORT) QSKIP("This test needs Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY QWidget *toplevel = createGUI(); toplevel->resize(400,300); QObject *topLeft = toplevel->child("topLeft"); @@ -863,15 +827,11 @@ void tst_QAccessibility::relationTo() delete toplevel; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif // !QT3_SUPPORT } void tst_QAccessibility::navigateGeometric() { -#ifdef QTEST_ACCESSIBILITY { static const int skip = 20; //speed the test up significantly static const double step = Q_PI / 180; @@ -967,14 +927,10 @@ void tst_QAccessibility::navigateGeometric() delete w; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::navigateSlider() { -#ifdef QTEST_ACCESSIBILITY { QSlider *slider = new QSlider(0); slider->setObjectName(QString("Slidy")); @@ -1001,14 +957,10 @@ void tst_QAccessibility::navigateSlider() delete slider; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::navigateCovered() { -#ifdef QTEST_ACCESSIBILITY { QWidget *w = new QWidget(0); w->setObjectName(QString("Harry")); @@ -1111,14 +1063,10 @@ void tst_QAccessibility::navigateCovered() delete w; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::navigateHierarchy() { -#ifdef QTEST_ACCESSIBILITY { QWidget *w = new QWidget(0); w->setObjectName(QString("Hans")); @@ -1214,9 +1162,6 @@ void tst_QAccessibility::navigateHierarchy() delete w; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } #define QSETCOMPARE(thetypename, elements, otherelements) \ @@ -1227,7 +1172,6 @@ void tst_QAccessibility::navigateControllers() #if !defined(QT3_SUPPORT) QSKIP("This test needs Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY { Q3VBox vbox; QSlider slider(&vbox); @@ -1310,9 +1254,6 @@ void tst_QAccessibility::navigateControllers() delete acc_slider; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif // !QT3_SUPPORT } @@ -1321,7 +1262,6 @@ void tst_QAccessibility::navigateLabels() #if !defined(QT3_SUPPORT) QSKIP("This test needs Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY { Q3VBox vbox; Q3HBox hbox(&vbox); @@ -1443,9 +1383,6 @@ void tst_QAccessibility::navigateLabels() delete acc_lineedit3; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif // !QT3_SUPPORT } @@ -1497,7 +1434,6 @@ static QWidget *createWidgets() void tst_QAccessibility::accessibleName() { -#ifdef QTEST_ACCESSIBILITY QWidget *toplevel = createWidgets(); toplevel->show(); #if defined(Q_WS_X11) @@ -1522,9 +1458,6 @@ void tst_QAccessibility::accessibleName() delete toplevel; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::text() @@ -1532,7 +1465,6 @@ void tst_QAccessibility::text() #if !defined(QT3_SUPPORT) QSKIP("This test needs Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY QWidget *toplevel = createGUI(); toplevel->show(); #if defined(Q_WS_X11) @@ -1628,10 +1560,6 @@ void tst_QAccessibility::text() delete toplevel; QTestAccessibility::clearEvents(); - -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif // !QT3_SUPPORT } @@ -1640,7 +1568,6 @@ void tst_QAccessibility::setText() #if !defined(QT3_SUPPORT) QSKIP("This test needs Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY QWidget *toplevel = createGUI(); toplevel->show(); QObject *bottomLeft = toplevel->findChild("bottomLeft"); @@ -1664,16 +1591,11 @@ void tst_QAccessibility::setText() delete acc_lineedit; delete toplevel; QTestAccessibility::clearEvents(); - -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif //QT3_SUPPORT } void tst_QAccessibility::hideShowTest() { -#ifdef QTEST_ACCESSIBILITY QWidget * const window = new QWidget(); QWidget * const child = new QWidget(window); @@ -1700,14 +1622,10 @@ void tst_QAccessibility::hideShowTest() delete window; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::userActionCount() { -#ifdef QTEST_ACCESSIBILITY QWidget widget; QAccessibleInterface *test = QAccessible::queryAccessibleInterface(&widget); @@ -1737,14 +1655,10 @@ void tst_QAccessibility::userActionCount() QCOMPARE(test->userActionCount(1), 0); QCOMPARE(test->userActionCount(-1), 0); delete test; test = 0; -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::actionText() { -#ifdef QTEST_ACCESSIBILITY QWidget widget; widget.show(); @@ -1761,19 +1675,11 @@ void tst_QAccessibility::actionText() QCOMPARE(test->actionText(QAccessible::SetFocus, QAccessible::Name, 0), QString("SetFocus")); delete test; test = 0; - -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::doAction() { -#ifdef QTEST_ACCESSIBILITY QSKIP("TODO: Implement me", SkipAll); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::applicationTest() @@ -1828,7 +1734,6 @@ public Q_SLOTS: void tst_QAccessibility::buttonTest() { -#ifdef QTEST_ACCESSIBILITY QWidget window; window.setLayout(new QVBoxLayout); @@ -2017,10 +1922,6 @@ void tst_QAccessibility::buttonTest() // test->release(); QTestAccessibility::clearEvents(); - -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::sliderTest() @@ -2028,7 +1929,6 @@ void tst_QAccessibility::sliderTest() #if !defined(QT3_SUPPORT) QSKIP("This test needs Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY QAccessibleInterface *test = 0; Q3VBox vbox; QLabel labelHorizontal("Horizontal", &vbox); @@ -2057,7 +1957,7 @@ void tst_QAccessibility::sliderTest() QCOMPARE(test->text(QAccessible::Value, 1), QString()); QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderHorizontal.value())); QCOMPARE(test->text(QAccessible::Value, 3), QString()); -// Skip acton tests. +// Skip action tests. #if 0 QCOMPARE(test->defaultAction(0), QAccessible::SetFocus); QCOMPARE(test->defaultAction(1), QAccessible::Press); @@ -2104,7 +2004,7 @@ void tst_QAccessibility::sliderTest() QCOMPARE(test->text(QAccessible::Value, 1), QString()); QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderVertical.value())); QCOMPARE(test->text(QAccessible::Value, 3), QString()); -// Skip acton tests. +// Skip action tests. #if 0 QCOMPARE(test->defaultAction(0), QAccessible::SetFocus); QCOMPARE(test->defaultAction(1), QAccessible::Press); @@ -2215,17 +2115,12 @@ void tst_QAccessibility::sliderTest() delete sliderInterface; } - QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif //!QT3_SUPPORT } void tst_QAccessibility::scrollBarTest() { -#ifdef QTEST_ACCESSIBILITY // Test that when we hide() a slider, the PageLeft, Indicator, and PageRight also gets the // Invisible state bit set. enum SubControls { LineUp = 1, @@ -2233,7 +2128,7 @@ void tst_QAccessibility::scrollBarTest() Position = 3, PageDown = 4, LineDown = 5 - }; + }; QScrollBar *scrollBar = new QScrollBar(); QAccessibleInterface * const scrollBarInterface = QAccessible::queryAccessibleInterface(scrollBar); @@ -2315,15 +2210,10 @@ void tst_QAccessibility::scrollBarTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif - } void tst_QAccessibility::tabTest() { -#ifdef QTEST_ACCESSIBILITY QTabBar *tabBar = new QTabBar(); tabBar->show(); @@ -2359,9 +2249,6 @@ void tst_QAccessibility::tabTest() delete tabBar; delete interface; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::tabWidgetTest() @@ -2459,7 +2346,6 @@ void tst_QAccessibility::tabWidgetTest() void tst_QAccessibility::menuTest() { -#ifdef QTEST_ACCESSIBILITY { QMainWindow mw; mw.resize(300, 200); @@ -2705,14 +2591,10 @@ void tst_QAccessibility::menuTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); -#endif } void tst_QAccessibility::spinBoxTest() { -#ifdef QTEST_ACCESSIBILITY QSpinBox * const spinBox = new QSpinBox(); spinBox->show(); @@ -2739,14 +2621,10 @@ void tst_QAccessibility::spinBoxTest() QVERIFY(events.contains(expectedEvent)); delete spinBox; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::doubleSpinBoxTest() { -#ifdef QTEST_ACCESSIBILITY QDoubleSpinBox *doubleSpinBox = new QDoubleSpinBox; doubleSpinBox->show(); @@ -2766,14 +2644,10 @@ void tst_QAccessibility::doubleSpinBoxTest() delete doubleSpinBox; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::textEditTest() { -#ifdef QTEST_ACCESSIBILITY { QTextEdit edit; QString text = "hello world\nhow are you today?\n"; @@ -2793,14 +2667,10 @@ void tst_QAccessibility::textEditTest() QCOMPARE(iface->textInterface()->characterRect(6, QAccessible2::RelativeToParent).size(), QSize(fm.width("w"), fm.height())); } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::textBrowserTest() { -#ifdef QTEST_ACCESSIBILITY { QTextBrowser textBrowser; QString text = QLatin1String("Hello world\nhow are you today?\n"); @@ -2817,14 +2687,10 @@ void tst_QAccessibility::textBrowserTest() QCOMPARE(interface->text(QAccessible::Value, 6), QString()); } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::listViewTest() { -#if 1 //def QTEST_ACCESSIBILITY { QListView listView; QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&listView); @@ -2890,15 +2756,11 @@ void tst_QAccessibility::listViewTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::mdiAreaTest() { -#ifdef QTEST_ACCESSIBILITY { QMdiArea mdiArea; mdiArea.resize(400,300); @@ -2947,14 +2809,10 @@ void tst_QAccessibility::mdiAreaTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::mdiSubWindowTest() { -#ifdef QTEST_ACCESSIBILITY { QMdiArea mdiArea; mdiArea.show(); @@ -3077,14 +2935,10 @@ void tst_QAccessibility::mdiSubWindowTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::lineEditTest() { -#ifdef QTEST_ACCESSIBILITY QLineEdit *le = new QLineEdit; QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(le); QVERIFY(iface); @@ -3142,14 +2996,10 @@ void tst_QAccessibility::lineEditTest() delete le2; delete toplevel; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::workspaceTest() { -#ifdef QTEST_ACCESSIBILITY { QWorkspace workspace; workspace.resize(400,300); @@ -3203,14 +3053,10 @@ void tst_QAccessibility::workspaceTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::dialogButtonBoxTest() { -#ifdef QTEST_ACCESSIBILITY { QDialogButtonBox box(QDialogButtonBox::Reset | QDialogButtonBox::Help | @@ -3323,14 +3169,10 @@ void tst_QAccessibility::dialogButtonBoxTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::dialTest() { -#ifdef QTEST_ACCESSIBILITY { QDial dial; dial.setValue(20); @@ -3372,28 +3214,20 @@ void tst_QAccessibility::dialTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::rubberBandTest() { -#ifdef QTEST_ACCESSIBILITY QRubberBand rubberBand(QRubberBand::Rectangle); QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&rubberBand); QVERIFY(interface); QCOMPARE(interface->role(0), QAccessible::Border); delete interface; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::abstractScrollAreaTest() { -#ifdef QTEST_ACCESSIBILITY { QAbstractScrollArea abstractScrollArea; @@ -3551,14 +3385,10 @@ void tst_QAccessibility::abstractScrollAreaTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::scrollAreaTest() { -#ifdef QTEST_ACCESSIBILITY { QScrollArea scrollArea; scrollArea.show(); @@ -3572,14 +3402,10 @@ void tst_QAccessibility::scrollAreaTest() delete interface; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::tableWidgetTest() { -#ifdef QTEST_ACCESSIBILITY { QWidget *topLevel = new QWidget; QTableWidget *w = new QTableWidget(8,4,topLevel); @@ -3619,10 +3445,6 @@ void tst_QAccessibility::tableWidgetTest() delete topLevel; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif - } class QtTestTableModel: public QAbstractTableModel @@ -3705,7 +3527,6 @@ public: void tst_QAccessibility::tableViewTest() { -#ifdef QTEST_ACCESSIBILITY { QtTestTableModel *model = new QtTestTableModel(3, 4); QTableView *w = new QTableView(); @@ -3785,15 +3606,11 @@ void tst_QAccessibility::tableViewTest() delete model; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::calendarWidgetTest() { #ifndef QT_NO_CALENDARWIDGET -#ifdef QTEST_ACCESSIBILITY { QCalendarWidget calendarWidget; @@ -3886,17 +3703,12 @@ void tst_QAccessibility::calendarWidgetTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif // QT_NO_CALENDARWIDGET } void tst_QAccessibility::dockWidgetTest() { #ifndef QT_NO_DOCKWIDGET - -#ifdef QTEST_ACCESSIBILITY // Set up a proper main window with two dock widgets QMainWindow *mw = new QMainWindow(); QFrame *central = new QFrame(mw); @@ -3964,19 +3776,14 @@ void tst_QAccessibility::dockWidgetTest() delete dock2; delete mw; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif // QT_NO_DOCKWIDGET } void tst_QAccessibility::pushButtonTest() { #if !defined(QT3_SUPPORT) - qWarning( "Should never get here without Qt3Support"); - return ; + QSKIP( "Should never get here without Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY // Set up a proper main window with two dock widgets QWidget *toplevel = createGUI(); QObject *topRight = toplevel->findChild("topRight"); @@ -4010,15 +3817,11 @@ void tst_QAccessibility::pushButtonTest() delete accToplevel; delete toplevel; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif //QT3_SUPPORT } void tst_QAccessibility::comboBoxTest() { -#ifdef QTEST_ACCESSIBILITY #if defined(Q_OS_WINCE) if (!IsValidCEPlatform()) { QSKIP("Test skipped on Windows Mobile test hardware", SkipAll); @@ -4056,15 +3859,10 @@ void tst_QAccessibility::comboBoxTest() delete w; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif - } void tst_QAccessibility::treeWidgetTest() { -#ifdef QTEST_ACCESSIBILITY QWidget *w = new QWidget; QTreeWidget *tree = new QTreeWidget(w); QHBoxLayout *l = new QHBoxLayout(w); @@ -4122,14 +3920,10 @@ void tst_QAccessibility::treeWidgetTest() delete w; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::labelTest() { -#ifdef QTEST_ACCESSIBILITY QString text = "Hello World"; QLabel *label = new QLabel(text); label->show(); @@ -4168,14 +3962,10 @@ void tst_QAccessibility::labelTest() delete acc_label; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::accelerators() { -#ifdef QTEST_ACCESSIBILITY QWidget *window = new QWidget; QHBoxLayout *lay = new QHBoxLayout(window); QLabel *label = new QLabel(tr("&Line edit"), window); @@ -4208,9 +3998,6 @@ void tst_QAccessibility::accelerators() QTest::qWait(100); delete window; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); -#endif } -- cgit v1.2.3 From 782cd3241d14a190a092e2d0e23ae5fae5e99a2c Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 19 Apr 2011 16:15:57 +1000 Subject: Ignore expected warning in accessibility autotest Change-Id: I4b614766d2451dde51ab1207267301a2fe7dd0f6 Reviewed-by: Rohan McGovern (cherry picked from commit 3ca51d87296bcb3098d7de14294fef9294fd5ed4) --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 6398c8e2ac..9195d6f3f8 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -3989,6 +3989,8 @@ void tst_QAccessibility::accelerators() QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + QLatin1String("A")); label->setText(tr("Q &&A")); QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString()); + + QTest::ignoreMessage(QtWarningMsg, "QKeySequence::mnemonic: \"Q &A&B\" contains multiple occurrences of '&'"); label->setText(tr("Q &A&B")); QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + QLatin1String("A")); -- cgit v1.2.3 From 3ac241a1d531a666d5a0f2e255ed85a6e7875675 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 19 Apr 2011 17:15:24 +1000 Subject: Fix remaining warnings in accessibility autotest Prevent warnings about unhandled accessibility events by managing object lifetimes appropriately. Change-Id: If72a2a6a76527ff746b99634c2d0895354570724 Reviewed-by: Rohan McGovern (cherry picked from commit bf1d860143ff40330c6e8f3e2872f2ae812adaa7) --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 72 +++++++++++++----------- 1 file changed, 40 insertions(+), 32 deletions(-) (limited to 'tests') diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 9195d6f3f8..ec27874927 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -1659,10 +1659,10 @@ void tst_QAccessibility::userActionCount() void tst_QAccessibility::actionText() { - QWidget widget; - widget.show(); + QWidget *widget = new QWidget; + widget->show(); - QAccessibleInterface *test = QAccessible::queryAccessibleInterface(&widget); + QAccessibleInterface *test = QAccessible::queryAccessibleInterface(widget); QVERIFY(test); QVERIFY(test->isValid()); @@ -1674,7 +1674,10 @@ void tst_QAccessibility::actionText() QCOMPARE(test->actionText(QAccessible::DefaultAction, QAccessible::Name, 0), QString("SetFocus")); QCOMPARE(test->actionText(QAccessible::SetFocus, QAccessible::Name, 0), QString("SetFocus")); - delete test; test = 0; + delete test; + delete widget; + + QTestAccessibility::clearEvents(); } void tst_QAccessibility::doAction() @@ -1930,18 +1933,18 @@ void tst_QAccessibility::sliderTest() QSKIP("This test needs Qt3Support", SkipAll); #else QAccessibleInterface *test = 0; - Q3VBox vbox; - QLabel labelHorizontal("Horizontal", &vbox); - QSlider sliderHorizontal(Qt::Horizontal, &vbox); - labelHorizontal.setBuddy(&sliderHorizontal); + Q3VBox *vbox = new Q3VBox; + QLabel *labelHorizontal = new QLabel("Horizontal", vbox); + QSlider *sliderHorizontal = new QSlider(Qt::Horizontal, vbox); + labelHorizontal->setBuddy(sliderHorizontal); - QLabel labelVertical("Vertical", &vbox); - QSlider sliderVertical(Qt::Vertical, &vbox); - labelVertical.setBuddy(&sliderVertical); - vbox.show(); + QLabel *labelVertical = new QLabel("Vertical", vbox); + QSlider *sliderVertical = new QSlider(Qt::Vertical, vbox); + labelVertical->setBuddy(sliderVertical); + vbox->show(); // test horizontal slider - test = QAccessible::queryAccessibleInterface(&sliderHorizontal); + test = QAccessible::queryAccessibleInterface(sliderHorizontal); QVERIFY(test); QCOMPARE(test->childCount(), 3); QCOMPARE(test->role(0), QAccessible::Slider); @@ -1949,13 +1952,13 @@ void tst_QAccessibility::sliderTest() QCOMPARE(test->role(2), QAccessible::Indicator); QCOMPARE(test->role(3), QAccessible::PushButton); - QCOMPARE(test->text(QAccessible::Name, 0), labelHorizontal.text()); + QCOMPARE(test->text(QAccessible::Name, 0), labelHorizontal->text()); QCOMPARE(test->text(QAccessible::Name, 1), QSlider::tr("Page left")); QCOMPARE(test->text(QAccessible::Name, 2), QSlider::tr("Position")); QCOMPARE(test->text(QAccessible::Name, 3), QSlider::tr("Page right")); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal.value())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal->value())); QCOMPARE(test->text(QAccessible::Value, 1), QString()); - QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderHorizontal.value())); + QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderHorizontal->value())); QCOMPARE(test->text(QAccessible::Value, 3), QString()); // Skip action tests. #if 0 @@ -1969,26 +1972,26 @@ void tst_QAccessibility::sliderTest() QCOMPARE(test->actionText(QAccessible::Decrease, QAccessible::Name, 2), QSlider::tr("Decrease")); QCOMPARE(test->actionText(QAccessible::Press, QAccessible::Name, 3), QSlider::tr("Press")); QVERIFY(test->doAction(QAccessible::Press, 3)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal.pageStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal->pageStep())); QVERIFY(test->doAction(QAccessible::Press, 3)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderHorizontal.pageStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderHorizontal->pageStep())); QVERIFY(test->doAction(QAccessible::Press, 1)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal.pageStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal->pageStep())); QVERIFY(test->doAction(QAccessible::Press, 1)); QCOMPARE(test->text(QAccessible::Value, 0), QString::number(0)); QVERIFY(test->doAction(QAccessible::Increase, 2)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal.lineStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal->lineStep())); QVERIFY(test->doAction(QAccessible::Increase, 2)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderHorizontal.lineStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderHorizontal->lineStep())); QVERIFY(test->doAction(QAccessible::Decrease, 2)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal.lineStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal->lineStep())); QVERIFY(test->doAction(QAccessible::Decrease, 2)); QCOMPARE(test->text(QAccessible::Value, 0), QString::number(0)); #endif delete test; // test vertical slider - test = QAccessible::queryAccessibleInterface(&sliderVertical); + test = QAccessible::queryAccessibleInterface(sliderVertical); QVERIFY(test); QCOMPARE(test->childCount(), 3); QCOMPARE(test->role(0), QAccessible::Slider); @@ -1996,13 +1999,13 @@ void tst_QAccessibility::sliderTest() QCOMPARE(test->role(2), QAccessible::Indicator); QCOMPARE(test->role(3), QAccessible::PushButton); - QCOMPARE(test->text(QAccessible::Name, 0), labelVertical.text()); + QCOMPARE(test->text(QAccessible::Name, 0), labelVertical->text()); QCOMPARE(test->text(QAccessible::Name, 1), QSlider::tr("Page up")); QCOMPARE(test->text(QAccessible::Name, 2), QSlider::tr("Position")); QCOMPARE(test->text(QAccessible::Name, 3), QSlider::tr("Page down")); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical.value())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical->value())); QCOMPARE(test->text(QAccessible::Value, 1), QString()); - QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderVertical.value())); + QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderVertical->value())); QCOMPARE(test->text(QAccessible::Value, 3), QString()); // Skip action tests. #if 0 @@ -2016,23 +2019,28 @@ void tst_QAccessibility::sliderTest() QCOMPARE(test->actionText(QAccessible::Decrease, QAccessible::Name, 2), QSlider::tr("Decrease")); QCOMPARE(test->actionText(QAccessible::Press, QAccessible::Name, 3), QSlider::tr("Press")); QVERIFY(test->doAction(QAccessible::Press, 3)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical.pageStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical->pageStep())); QVERIFY(test->doAction(QAccessible::Press, 3)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderVertical.pageStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderVertical->pageStep())); QVERIFY(test->doAction(QAccessible::Press, 1)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical.pageStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical->pageStep())); QVERIFY(test->doAction(QAccessible::Press, 1)); QCOMPARE(test->text(QAccessible::Value, 0), QString::number(0)); QVERIFY(test->doAction(QAccessible::Increase, 2)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical.lineStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical->lineStep())); QVERIFY(test->doAction(QAccessible::Increase, 2)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderVertical.lineStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderVertical->lineStep())); QVERIFY(test->doAction(QAccessible::Decrease, 2)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical.lineStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical->lineStep())); QVERIFY(test->doAction(QAccessible::Decrease, 2)); QCOMPARE(test->text(QAccessible::Value, 0), QString::number(0)); #endif delete test; + delete sliderHorizontal; + delete sliderVertical; + delete labelHorizontal; + delete labelVertical; + delete vbox; // Test that when we hide() a slider, the PageLeft, Indicator, and PageRight also gets the // Invisible state bit set. -- cgit v1.2.3 From 94a7d439f28f7c171274b801f2a329aa57189589 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 19 Apr 2011 18:02:33 +1000 Subject: Remove Q_ASSERT from qatomicint/pointer autotests Some code in these tests is not intended to be executed, but rather to detect compiler warnings. Instead of having an obscure fatal error if this code is run in a debug build, it now has a clear fatal error if run in any build. Change-Id: I1c9d27bb14ebf3313865b68e3e57668ba1d14e25 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 70f42ced8e01ddf0098b143e5804c22d55ebf16f) --- tests/auto/qatomicint/tst_qatomicint.cpp | 3 +-- tests/auto/qatomicpointer/tst_qatomicpointer.cpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/auto/qatomicint/tst_qatomicint.cpp b/tests/auto/qatomicint/tst_qatomicint.cpp index 717187a2a6..5ccb997290 100644 --- a/tests/auto/qatomicint/tst_qatomicint.cpp +++ b/tests/auto/qatomicint/tst_qatomicint.cpp @@ -116,8 +116,7 @@ tst_QAtomicInt::~tst_QAtomicInt() void tst_QAtomicInt::warningFreeHelper() { - Q_ASSERT(false); - // The code below is bogus, and shouldn't be run. We're looking for warnings, only. + qFatal("This code is bogus, and shouldn't be run. We're looking for compiler warnings only."); QBasicAtomicInt i = Q_BASIC_ATOMIC_INITIALIZER(0); diff --git a/tests/auto/qatomicpointer/tst_qatomicpointer.cpp b/tests/auto/qatomicpointer/tst_qatomicpointer.cpp index af8fabc962..05f8294148 100644 --- a/tests/auto/qatomicpointer/tst_qatomicpointer.cpp +++ b/tests/auto/qatomicpointer/tst_qatomicpointer.cpp @@ -98,8 +98,7 @@ struct WFHC void tst_QAtomicPointer::warningFreeHelper() { - Q_ASSERT(false); - // The code below is bogus, and shouldn't be run. We're looking for warnings, only. + qFatal("This code is bogus, and shouldn't be run. We're looking for compiler warnings only."); QBasicAtomicPointer p = Q_BASIC_ATOMIC_INITIALIZER(0); -- cgit v1.2.3 From 8ccb06a718a50e65288422d7a79da8317e372d67 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 Apr 2011 11:05:55 +1000 Subject: Remove Q_ASSERT from qcompleter autotest. Replace obscure failure on bad test data in debug builds with an informative warning in all builds. Change-Id: I9001820f34de2f78bf296a2f0e095ce73d9ac4bd Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 34c077faae538adc12d4aa28113640570dfc8728) --- tests/auto/qcompleter/tst_qcompleter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index 932c19ea54..1bb21eb788 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -277,7 +277,9 @@ retry: case 'L': row = completer->completionCount() - 1; break; case 'F': row = 0; break; default: - Q_ASSERT(false); + QFAIL(qPrintable(QString( + "Problem with 'step' value in test data: %1 (only P, N, L and F are allowed)." + ).arg(step[i]))); } completer->setCurrentRow(row); } -- cgit v1.2.3 From 50fd0092db7b3de82fc017f1885cb0d4fdfed205 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 Apr 2011 11:39:14 +1000 Subject: Only ignore warning when it can actually be produced. Fix regression introduced in 3ca51d87296bcb3098d7de14294fef9294fd5ed4. The warning is only generated in builds where QT_NO_DEBUG is not defined. Change-Id: I9aa3db369094f4046062b5dc1dc694342208ee45 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 67bc4990f7541cca089882a8c3be1b2b8d98cd4c) --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index ec27874927..fc919966a8 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -3998,7 +3998,9 @@ void tst_QAccessibility::accelerators() label->setText(tr("Q &&A")); QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString()); +#ifndef QT_NO_DEBUG QTest::ignoreMessage(QtWarningMsg, "QKeySequence::mnemonic: \"Q &A&B\" contains multiple occurrences of '&'"); +#endif label->setText(tr("Q &A&B")); QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + QLatin1String("A")); -- cgit v1.2.3 From e1f221118841f80072f3d2223906a6dc21038148 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 Apr 2011 12:16:58 +1000 Subject: Remove Q_ASSERT from QCompleter autotest If a combobox had no completer, this test would assert in a debug build and crash in a release build. This commit makes the test report a test failure and avoid terminating in all builds. Change-Id: Ib2924412e3d55f10875675cb65079259cd4ef552 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit a5bd4abed834ce3670b2f28d4f932d612a033b36) --- tests/auto/qcompleter/tst_qcompleter.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index 1bb21eb788..1a052d59b7 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -1280,10 +1280,11 @@ public: { setEditable(true); setInsertPolicy(NoInsert); - Q_ASSERT(completer()); - completer()->setCompletionMode(QCompleter::PopupCompletion); - completer()->setCompletionRole(Qt::DisplayRole); - connect(lineEdit(), SIGNAL(editingFinished()), SLOT(setCompletionPrefix())); + if (completer()) { + completer()->setCompletionMode(QCompleter::PopupCompletion); + completer()->setCompletionRole(Qt::DisplayRole); + connect(lineEdit(), SIGNAL(editingFinished()), SLOT(setCompletionPrefix())); + } } private slots: void setCompletionPrefix() { completer()->setCompletionPrefix(lineEdit()->text()); } @@ -1292,6 +1293,7 @@ private slots: void tst_QCompleter::task246056_setCompletionPrefix() { task246056_ComboBox *comboBox = new task246056_ComboBox; + QVERIFY(comboBox->completer()); comboBox->addItem(""); comboBox->addItem("a1"); comboBox->addItem("a2"); -- cgit v1.2.3 From 847ee0195344d3c33d727e6ce97caee1ee95c43e Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 Apr 2011 15:11:23 +1000 Subject: Remove Q_ASSERT from qcopchannel autotest This code would assert in a debug build and potentially crash in a release build. (The behaviour of QStringList::at() with an out-of-bounds index is undefined.) This commit makes the program exit with a useful error message in all builds. Change-Id: Ia57a2e5693eb25d3eb0b9ba701ed485dfbc1e846 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 5a530f6171a9569d1a35cd8cd1015ec796b048cc) --- tests/auto/qcopchannel/testSend/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qcopchannel/testSend/main.cpp b/tests/auto/qcopchannel/testSend/main.cpp index 91628e501f..a56883be99 100644 --- a/tests/auto/qcopchannel/testSend/main.cpp +++ b/tests/auto/qcopchannel/testSend/main.cpp @@ -49,7 +49,11 @@ int main(int argc, char** argv) #ifdef Q_WS_QWS QApplication app(argc, argv); QStringList args = app.arguments(); - Q_ASSERT(args.count() == 3 || args.count() == 4); + if (args.count() != 3 && args.count() != 4) { + fprintf(stdout,qPrintable(QString("Usage: %1 channel message [data]").arg(args.at(0)))); + fflush(stdout); + return 1; + } QString channelName = args.at(1); QString msg = args.at(2); QByteArray data; -- cgit v1.2.3 From 20d16d3f8bec7557490a1c12d5e2a946cf5bf42e Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 Apr 2011 16:03:42 +1000 Subject: Remove Q_ASSERT from datetimeedit autotest The assert and the last four parameters of makeList() are not needed. The function is always used to make lists of three integers and the data are all >= 0. Change-Id: I93ae5a5f541cde2ff61bd9dd21164ed4a9b57403 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit e754832eff8e1a35fc2681ae69b6e3b1ad666ddb) --- tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp index 9d0c5f7d22..07158d181c 100644 --- a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp @@ -2701,17 +2701,10 @@ void tst_QDateTimeEdit::task98554() QCOMPARE(testWidget->time(), QTime(0, 0, 10, 0)); } -static QList makeList(int val1, int val2 = -1, int val3 = -1, int val4 = -1, int val5 = -1, int val6 = -1, int val7 = -1) +static QList makeList(int val1, int val2, int val3) { QList ret; - Q_ASSERT(val1 >= 0); - ret << val1; - if (val2 < 0) {return ret;} else {ret << val2;} - if (val3 < 0) {return ret;} else {ret << val3;} - if (val4 < 0) {return ret;} else {ret << val4;} - if (val5 < 0) {return ret;} else {ret << val5;} - if (val6 < 0) {return ret;} else {ret << val6;} - if (val7 >= 0) {ret << val2;} + ret << val1 << val2 << val3; return ret; } -- cgit v1.2.3 From 2d471a2bef76237e6796e011d06a96b34c4ca96e Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 Apr 2011 16:27:07 +1000 Subject: Remove Q_ASSERT from QDom autotest The Q_ASSERT here should really be a QVERIFY. Expanded the trivial helper function to make it more obvious what the test does. Change-Id: Ia6017fe820a83b4d6101e5edcfcb68993eef233a Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 6181805f9ea66b37ee164bd67bdac2ac9d53fb65) --- tests/auto/qdom/tst_qdom.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp index 18aa84a844..f3b3e00263 100644 --- a/tests/auto/qdom/tst_qdom.cpp +++ b/tests/auto/qdom/tst_qdom.cpp @@ -137,7 +137,6 @@ private slots: private: static QDomDocument generateRequest(); - static QDomDocument doc(const QString &title, const QByteArray &ba); static int hasAttributesHelper( const QDomNode& node ); static bool compareDocuments( const QDomDocument &doc1, const QDomDocument &doc2 ); static bool compareNodes( const QDomNode &node1, const QDomNode &node2, bool deep ); @@ -1591,14 +1590,6 @@ void tst_QDom::reportDuplicateAttributes() const QVERIFY2(!isSuccess, "Duplicate attributes are well-formedness errors, and should be reported as such."); } -QDomDocument tst_QDom::doc(const QString &title, const QByteArray &ba) -{ - QDomDocument doc(title); - const bool ret = doc.setContent(ba, true); - Q_ASSERT(ret); - return doc; -} - void tst_QDom::namespacedAttributes() const { static const char *const xml = @@ -1611,8 +1602,13 @@ void tst_QDom::namespacedAttributes() const " >>> SIMPLE BASIC OP - SEND - DUT AS SINK\n" "\n"; - QDomDocument one = doc("document", xml); - QDomDocument two = doc("document2", one.toByteArray(2)); + QDomDocument one("document"); + QString error; + bool docParsed = one.setContent(QByteArray(xml), true, &error); + QVERIFY2(docParsed, qPrintable(error)); + QDomDocument two("document2"); + docParsed = two.setContent(one.toByteArray(2), true, &error); + QVERIFY2(docParsed, qPrintable(error)); QVERIFY(isDeepEqual(one, two)); } -- cgit v1.2.3 From 9e0049f656c7ec073ec042552ec7be1fb3946755 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 21 Apr 2011 11:15:35 +1000 Subject: Fix logic error in large file autotest The function generating data blocks was filling the block to 16 bytes short of the blockSize, then appending three 8 byte values, causing the block to grow 8 bytes beyond blockSize and then truncating it back to blockSize. This commit makes the code fill the block to 24 bytes short of the blockSize, so that the block will always end up at the correct size and truncation is not needed. Change-Id: I9fe6e6d6cf7bc445513b53e0a910d205c4c8002f Reviewed-by: Rohan McGovern (cherry picked from commit b1eb564830ff1b754de14919ce5c1547e9758f7c) --- tests/auto/qfile/largefile/tst_largefile.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/auto/qfile/largefile/tst_largefile.cpp b/tests/auto/qfile/largefile/tst_largefile.cpp index a9ad017e14..47f2e734b7 100644 --- a/tests/auto/qfile/largefile/tst_largefile.cpp +++ b/tests/auto/qfile/largefile/tst_largefile.cpp @@ -206,14 +206,13 @@ static inline QByteArray generateDataBlock(int blockSize, QString text, qint64 u QByteArray filler("0123456789"); block.append(filler.right(10 - block.size() % 10)); - topUpWith(block, filler, blockSize - 2 * sizeof(qint64)); + topUpWith(block, filler, blockSize - 3 * sizeof(qint64)); appendRaw(block, counter); appendRaw(block, userBits); appendRaw(block, randomBits); - Q_ASSERT( block.size() >= blockSize ); - block.resize(blockSize); + Q_ASSERT( block.size() == blockSize ); ++counter; return block; -- cgit v1.2.3 From 0ea9ffef432d2df60b59bec146200a6acf0984be Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 21 Apr 2011 13:00:06 +1000 Subject: Use meaningful variable names Make the meaning of the code more obvious and avoid a compiler warning about the variable "w" being overridden. Change-Id: Ib76d3aa1cae46e263b2ab61b675d9ef74032aacc Reviewed-by: Rohan McGovern (cherry picked from commit 59634e825f1efa6f32befc8767cafedfeb9b7d59) --- .../tst_qgraphicsanchorlayout.cpp | 42 +++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'tests') diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 447385a7d8..a0360a33c1 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -132,33 +132,33 @@ static void setAnchor(QGraphicsAnchorLayout *l, anchor->setSpacing(spacing); } -static bool checkReverseDirection(QGraphicsWidget *w) +static bool checkReverseDirection(QGraphicsWidget *widget) { - QGraphicsLayout *l = w->layout(); - Q_ASSERT(l); + QGraphicsLayout *layout = widget->layout(); + Q_ASSERT(layout); qreal left, top, right, bottom; - l->getContentsMargins(&left, &top, &right, &bottom); - w->setLayoutDirection(Qt::LeftToRight); + layout->getContentsMargins(&left, &top, &right, &bottom); + widget->setLayoutDirection(Qt::LeftToRight); QApplication::processEvents(); - const QRectF lg = l->geometry(); + const QRectF layoutGeometry = layout->geometry(); QMap geometries; - for (int i = 0; i < l->count(); ++i) { - QGraphicsLayoutItem *w = l->itemAt(i); - geometries.insert(w, w->geometry()); + for (int i = 0; i < layout->count(); ++i) { + QGraphicsLayoutItem *item = layout->itemAt(i); + geometries.insert(item, item->geometry()); } - w->setLayoutDirection(Qt::RightToLeft); + widget->setLayoutDirection(Qt::RightToLeft); QApplication::processEvents(); - lg.adjusted(+right, +top, -left, -bottom); - for (int i = 0; i < l->count(); ++i) { - QGraphicsLayoutItem *w = l->itemAt(i); - const QRectF rtlGeom = w->geometry(); - const QRectF ltrGeom = geometries.value(w); - QRectF expectedGeom = ltrGeom; - expectedGeom.moveRight(lg.right() - (0 + ltrGeom.left())); - if (expectedGeom != rtlGeom) { - qDebug() << "layout->geometry():" << lg - << "expected:" << expectedGeom - << "actual:" << rtlGeom; + layoutGeometry.adjusted(+right, +top, -left, -bottom); + for (int i = 0; i < layout->count(); ++i) { + QGraphicsLayoutItem *item = layout->itemAt(i); + const QRectF rightToLeftGeometry = item->geometry(); + const QRectF leftToRightGeometry = geometries.value(item); + QRectF expectedGeometry = leftToRightGeometry; + expectedGeometry.moveRight(layoutGeometry.right() - leftToRightGeometry.left()); + if (expectedGeometry != rightToLeftGeometry) { + qDebug() << "layout->geometry():" << layoutGeometry + << "expected:" << expectedGeometry + << "actual:" << rightToLeftGeometry; return false; } } -- cgit v1.2.3 From 46412f71280bfec0686133f599c377da9ea0c6a3 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 21 Apr 2011 14:49:41 +1000 Subject: Only ignore warning when it can actually be produced. Fix regression introduced in 3ca51d87296bcb3098d7de14294fef9294fd5ed4. The warning is only generated in builds where QT_NO_DEBUG is not defined *and* the target is not Mac OS X. Change-Id: I7245f2eab8ea47ab7495fef874b2f8a29186b659 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 60e5ed805af1e11aaec426b823df209b4c895c29) --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index fc919966a8..dcd6286b07 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -3998,7 +3998,7 @@ void tst_QAccessibility::accelerators() label->setText(tr("Q &&A")); QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString()); -#ifndef QT_NO_DEBUG +#if !defined(QT_NO_DEBUG) && !defined(Q_WS_MAC) QTest::ignoreMessage(QtWarningMsg, "QKeySequence::mnemonic: \"Q &A&B\" contains multiple occurrences of '&'"); #endif label->setText(tr("Q &A&B")); -- cgit v1.2.3 From 5bdf574941475d834451142506b5cdb452027f7d Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 21 Apr 2011 15:33:01 +1000 Subject: Remove Q_ASSERTs from qgraphicsanchorlayout1 test Sanity-check the test data when using it rather than when creating it. Change-Id: Ie5d5e1ff3fc439d196096f17cb6f97680927a90c Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 2c64404e2edd3b792b8a1d04c773860d40c04c4c) --- .../tst_qgraphicsanchorlayout1.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'tests') diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index a03f7bca6d..ee25291160 100644 --- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -2585,15 +2585,11 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution_data() sizeHints1.insert( Qt::MinimumSize, 30 ); sizeHints1.insert( Qt::PreferredSize, 35 ); sizeHints1.insert( Qt::MaximumSize, 40 ); - Q_ASSERT( sizeHints1.value( Qt::MinimumSize ) <= sizeHints1.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints1.value( Qt::PreferredSize ) <= sizeHints1.value( Qt::MaximumSize ) ); SizeHintArray sizeHints2; sizeHints2.insert( Qt::MinimumSize, 5 ); sizeHints2.insert( Qt::PreferredSize, 35 ); sizeHints2.insert( Qt::MaximumSize, 300 ); - Q_ASSERT( sizeHints2.value( Qt::MinimumSize ) <= sizeHints2.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints2.value( Qt::PreferredSize ) <= sizeHints2.value( Qt::MaximumSize ) ); const qreal width1 = 35; const qreal width2 = 100-10-10-10-width1; @@ -2605,15 +2601,11 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution_data() sizeHints1.insert( Qt::MinimumSize, 0 ); sizeHints1.insert( Qt::PreferredSize, 20 ); sizeHints1.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints1.value( Qt::MinimumSize ) <= sizeHints1.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints1.value( Qt::PreferredSize ) <= sizeHints1.value( Qt::MaximumSize ) ); SizeHintArray sizeHints2; sizeHints2.insert( Qt::MinimumSize, 0 ); sizeHints2.insert( Qt::PreferredSize, 50 ); sizeHints2.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints2.value( Qt::MinimumSize ) <= sizeHints2.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints2.value( Qt::PreferredSize ) <= sizeHints2.value( Qt::MaximumSize ) ); const qreal width1 = 20; const qreal width2 = 100-10-10-10-width1; @@ -2625,15 +2617,11 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution_data() sizeHints1.insert( Qt::MinimumSize, 0 ); sizeHints1.insert( Qt::PreferredSize, 40 ); sizeHints1.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints1.value( Qt::MinimumSize ) <= sizeHints1.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints1.value( Qt::PreferredSize ) <= sizeHints1.value( Qt::MaximumSize ) ); SizeHintArray sizeHints2; sizeHints2.insert( Qt::MinimumSize, 0 ); sizeHints2.insert( Qt::PreferredSize, 60 ); sizeHints2.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints2.value( Qt::MinimumSize ) <= sizeHints2.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints2.value( Qt::PreferredSize ) <= sizeHints2.value( Qt::MaximumSize ) ); const qreal width1 = 28; // got from manual calculation const qreal width2 = 100-10-10-10-width1; @@ -2645,15 +2633,11 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution_data() sizeHints1.insert( Qt::MinimumSize, 0 ); sizeHints1.insert( Qt::PreferredSize, 10 ); sizeHints1.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints1.value( Qt::MinimumSize ) <= sizeHints1.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints1.value( Qt::PreferredSize ) <= sizeHints1.value( Qt::MaximumSize ) ); SizeHintArray sizeHints2; sizeHints2.insert( Qt::MinimumSize, 0 ); sizeHints2.insert( Qt::PreferredSize, 40 ); sizeHints2.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints2.value( Qt::MinimumSize ) <= sizeHints2.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints2.value( Qt::PreferredSize ) <= sizeHints2.value( Qt::MaximumSize ) ); const qreal width1 = 22; // got from manual calculation const qreal width2 = 100-10-10-10-width1; @@ -2669,6 +2653,12 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution() QFETCH(qreal, width1); QFETCH(qreal, width2); + // sanity-check the test data - MinimumSize <= PreferredSize <= MaximumSize + QVERIFY( sizeHints1.value( Qt::MinimumSize ) <= sizeHints1.value( Qt::PreferredSize ) ); + QVERIFY( sizeHints1.value( Qt::PreferredSize ) <= sizeHints1.value( Qt::MaximumSize ) ); + QVERIFY( sizeHints2.value( Qt::MinimumSize ) <= sizeHints2.value( Qt::PreferredSize ) ); + QVERIFY( sizeHints2.value( Qt::PreferredSize ) <= sizeHints2.value( Qt::MaximumSize ) ); + // create objects QGraphicsWidget widget; TheAnchorLayout *layout = new TheAnchorLayout; -- cgit v1.2.3 From 319197880eb8a5d92d2afa4bb22cbdf5193c88de Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 10:38:03 +1000 Subject: Remove Q_ASSERT from qgraphicsanchorlayout test Q_ASSERT will only catch a violation of the precondition of the checkReverseDirection function in a debug build. This commit replaces the Q_ASSERT with QVERIFY'ing the precondition (that the widget has a layout) before calling the function. Change-Id: Ibaa2b52b7d67fa20784e0df022e8c8169da0e50e Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit d1011fc9328fa335bc69a065b29e77ce60608c55) --- tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index a0360a33c1..55d6fc97cd 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -135,7 +135,6 @@ static void setAnchor(QGraphicsAnchorLayout *l, static bool checkReverseDirection(QGraphicsWidget *widget) { QGraphicsLayout *layout = widget->layout(); - Q_ASSERT(layout); qreal left, top, right, bottom; layout->getContentsMargins(&left, &top, &right, &bottom); widget->setLayoutDirection(Qt::LeftToRight); @@ -345,6 +344,7 @@ void tst_QGraphicsAnchorLayout::layoutDirection() p->show(); view->show(); + QVERIFY(p->layout()); QCOMPARE(checkReverseDirection(p), true); if (hasSimplification) { @@ -445,6 +445,7 @@ void tst_QGraphicsAnchorLayout::diagonal() QVERIFY(!usedSimplex(l, Qt::Vertical)); } + QVERIFY(p.layout()); QCOMPARE(checkReverseDirection(&p), true); c->setMinimumWidth(300); @@ -735,6 +736,7 @@ void tst_QGraphicsAnchorLayout::snakeOppositeDirections() QCOMPARE(c->geometry(), QRectF(90.0, 200.0, 100.0, 100.0)); QCOMPARE(p.size(), layoutMaximumSize); + QVERIFY(p.layout()); QCOMPARE(checkReverseDirection(&p), true); } -- cgit v1.2.3 From 98f9513b6badfd79bbcd13b668982c9bc18ed224 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 10:44:51 +1000 Subject: Remove dead code from qgraphicsgridlayout autotest Change-Id: I230d1ec9dfd5df2a0fac161a03090308b7f07a1e Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 012b2d8198b8cfe39a66025334ed9ae2a045a68c) --- .../tst_qgraphicsgridlayout.cpp | 33 ---------------------- 1 file changed, 33 deletions(-) (limited to 'tests') diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 837df783a3..78010e6071 100644 --- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -3018,39 +3018,6 @@ static QSizeF wfh(Qt::SizeHint /*which*/, const QSizeF &constraint) return result; } -static qreal growthFactorBelowPreferredSize(qreal desired, qreal sumAvailable, qreal sumDesired) -{ - Q_ASSERT(sumDesired != 0.0); - return desired * qPow(sumAvailable / sumDesired, desired / sumDesired); -} - -static void expectedWidth(qreal minSize1, qreal prefSize1, - qreal minSize2, qreal prefSize2, - qreal targetSize, qreal *width1, qreal *width2) -{ - qreal sumAvail,factor1,factor2; - // stretch behaviour is different below and above preferred size... - if (targetSize < prefSize1 + prefSize2) { - sumAvail = targetSize - minSize1 - minSize2; - const qreal desired1 = prefSize1 - minSize1; - const qreal desired2 = prefSize2 - minSize2; - const qreal sumDesired = desired1 + desired2; - factor1 = growthFactorBelowPreferredSize(desired1, sumAvail, sumDesired); - factor2 = growthFactorBelowPreferredSize(desired2, sumAvail, sumDesired); - const qreal sumFactors = factor1 + factor2; - *width1 = sumAvail*factor1/sumFactors + minSize1; - *width2 = sumAvail*factor2/sumFactors + minSize2; - } else { - sumAvail = targetSize - prefSize1 - prefSize2; - factor1 = prefSize1; - factor2 = prefSize2; - const qreal sumFactors = factor1 + factor2; - *width1 = sumAvail*factor1/sumFactors + prefSize1; - *width2 = sumAvail*factor2/sumFactors + prefSize2; - } -} - - bool qFuzzyCompare(const QSizeF &a, const QSizeF &b) { return qFuzzyCompare(a.width(), b.width()) && qFuzzyCompare(a.height(), b.height()); -- cgit v1.2.3 From 35b01c17330608559e8b5e62cbc7277a2e419f2e Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 10:48:14 +1000 Subject: Remove mention of Q_ASSERT from qheaderview autotest Change-Id: I3a97411c0b53345bffbadb60a3e7caabfb0441d2 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit a388e104febb131cd35438bbb1397eeab41d3ab8) --- tests/auto/qheaderview/tst_qheaderview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qheaderview/tst_qheaderview.cpp b/tests/auto/qheaderview/tst_qheaderview.cpp index 9a25fb6bbc..d877d2f16e 100644 --- a/tests/auto/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/qheaderview/tst_qheaderview.cpp @@ -1106,7 +1106,7 @@ void tst_QHeaderView::moveAndInsertSection() void tst_QHeaderView::resizeMode() { - // Q_ASSERT's when resizeMode is called with an invalid index + // resizeMode must not be called with an invalid index int last = view->count() - 1; view->setResizeMode(QHeaderView::Interactive); QCOMPARE(view->resizeMode(last), QHeaderView::Interactive); -- cgit v1.2.3 From 7c8c84d92beba1ca62cfebf9f05d925be43bf563 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 10:52:52 +1000 Subject: Remove Q_ASSERT from qitemmodel autotest Allow createModel() to return a null model on failure (which it already did in release mode builds), but fail the test gracefully instead of crashing when a null model is returned. Change-Id: Iaa0ec31183e0c90fcea512223d01e07ed188a380 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 0d773d839e39f4f4bfd0bf9d652e4f2650adfcb0) --- tests/auto/qitemmodel/modelstotest.cpp | 1 - tests/auto/qitemmodel/tst_qitemmodel.cpp | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qitemmodel/modelstotest.cpp b/tests/auto/qitemmodel/modelstotest.cpp index c4c2cbb521..cec170334f 100644 --- a/tests/auto/qitemmodel/modelstotest.cpp +++ b/tests/auto/qitemmodel/modelstotest.cpp @@ -227,7 +227,6 @@ QAbstractItemModel *ModelsToTest::createModel(const QString &modelType) return widget->model(); } - Q_ASSERT(false); return 0; } diff --git a/tests/auto/qitemmodel/tst_qitemmodel.cpp b/tests/auto/qitemmodel/tst_qitemmodel.cpp index 7e177bae9b..948285386f 100644 --- a/tests/auto/qitemmodel/tst_qitemmodel.cpp +++ b/tests/auto/qitemmodel/tst_qitemmodel.cpp @@ -199,6 +199,7 @@ void tst_QItemModel::nonDestructiveBasicTest() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); QCOMPARE(currentModel->buddy(QModelIndex()), QModelIndex()); currentModel->canFetchMore(QModelIndex()); @@ -244,6 +245,7 @@ void tst_QItemModel::rowCount() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); QFETCH(bool, isEmpty); if (isEmpty) { @@ -291,6 +293,7 @@ void tst_QItemModel::columnCount() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); QFETCH(bool, isEmpty); if (isEmpty) { @@ -325,6 +328,7 @@ void tst_QItemModel::hasIndex() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); // Make sure that invalid values returns an invalid index QCOMPARE(currentModel->hasIndex(-2, -2), false); @@ -359,6 +363,7 @@ void tst_QItemModel::index() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); // Make sure that invalid values returns an invalid index QCOMPARE(currentModel->index(-2, -2), QModelIndex()); @@ -489,6 +494,7 @@ void tst_QItemModel::parent() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); // Make sure the model wont crash and will return an invalid QModelIndex // when asked for the parent of an invalid index. @@ -538,6 +544,7 @@ void tst_QItemModel::data() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); // Invalid index should return an invalid qvariant QVERIFY(!currentModel->data(QModelIndex()).isValid()); @@ -618,6 +625,7 @@ void tst_QItemModel::setData() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); qRegisterMetaType("QModelIndex"); QSignalSpy spy(currentModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &))); QCOMPARE(currentModel->setData(QModelIndex(), QVariant()), false); @@ -660,6 +668,7 @@ void tst_QItemModel::setHeaderData() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); QCOMPARE(currentModel->setHeaderData(-1, Qt::Horizontal, QVariant()), false); QCOMPARE(currentModel->setHeaderData(-1, Qt::Vertical, QVariant()), false); @@ -708,6 +717,7 @@ void tst_QItemModel::sort() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); QFETCH(bool, isEmpty); if (isEmpty) @@ -819,6 +829,7 @@ void tst_QItemModel::remove() QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); QFETCH(bool, readOnly); if (readOnly) @@ -1160,6 +1171,7 @@ void tst_QItemModel::insert() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); QFETCH(bool, readOnly); if (readOnly) -- cgit v1.2.3 From b0da4334369536d81752a652913cef26f8b93dd3 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 11:25:17 +1000 Subject: Remove Q_ASSERT from qitemview autotest Allow createView() to return a null view on failure (which it already did in release mode builds), but fail the test gracefully instead of crashing when a null view is returned. Also reordered the code slightly to put all the QFETCH's together. Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern Change-Id: I3a41c738cb0e4e860db2342b30817a804b20f30d (cherry picked from commit 51b1d8dc20a2557d2002550b03e5b9f37f425fb4) --- tests/auto/qitemview/tst_qitemview.cpp | 25 +++++++++++++++++++------ tests/auto/qitemview/viewstotest.cpp | 1 - 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/auto/qitemview/tst_qitemview.cpp b/tests/auto/qitemview/tst_qitemview.cpp index 220a174c9a..c987c8f267 100644 --- a/tests/auto/qitemview/tst_qitemview.cpp +++ b/tests/auto/qitemview/tst_qitemview.cpp @@ -297,9 +297,11 @@ void tst_QItemView::nonDestructiveBasicTest() #endif QFETCH(QString, viewType); - view = testViews->createView(viewType); QFETCH(int, vscroll); QFETCH(int, hscroll); + + view = testViews->createView(viewType); + QVERIFY(view); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); @@ -454,9 +456,11 @@ void tst_QItemView::spider() QSKIP("This test takes too long to execute on IRIX", SkipAll); #endif QFETCH(QString, viewType); - view = testViews->createView(viewType); QFETCH(int, vscroll); QFETCH(int, hscroll); + + view = testViews->createView(viewType); + QVERIFY(view); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); view->setModel(treeModel); @@ -489,9 +493,11 @@ void tst_QItemView::resize() // This test needs to be re-thought out, it takes too long and // doesn't really catch theproblem. QFETCH(QString, viewType); - view = testViews->createView(viewType); QFETCH(int, vscroll); QFETCH(int, hscroll); + + view = testViews->createView(viewType); + QVERIFY(view); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); view->setModel(treeModel); @@ -517,9 +523,11 @@ void tst_QItemView::visualRect() QSKIP("This test takes too long to execute on IRIX", SkipAll); #endif QFETCH(QString, viewType); - view = testViews->createView(viewType); QFETCH(int, vscroll); QFETCH(int, hscroll); + + view = testViews->createView(viewType); + QVERIFY(view); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); QCOMPARE(view->visualRect(QModelIndex()), QRect()); @@ -651,9 +659,11 @@ void tst_QItemView::indexAt() QSKIP("This test takes too long to execute on IRIX", SkipAll); #endif QFETCH(QString, viewType); - view = testViews->createView(viewType); QFETCH(int, vscroll); QFETCH(int, hscroll); + + view = testViews->createView(viewType); + QVERIFY(view); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); view->show(); @@ -685,9 +695,11 @@ void tst_QItemView::scrollTo() QSKIP("This test takes too long to execute on IRIX", SkipAll); #endif QFETCH(QString, viewType); - view = testViews->createView(viewType); QFETCH(int, vscroll); QFETCH(int, hscroll); + + view = testViews->createView(viewType); + QVERIFY(view); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); view->setModel(treeModel); @@ -735,6 +747,7 @@ void tst_QItemView::moveCursor() #endif QFETCH(QString, viewType); view = testViews->createView(viewType); + QVERIFY(view); if (view->objectName() == "QHeaderView") return; diff --git a/tests/auto/qitemview/viewstotest.cpp b/tests/auto/qitemview/viewstotest.cpp index 3aa355d3a1..5e21daffeb 100644 --- a/tests/auto/qitemview/viewstotest.cpp +++ b/tests/auto/qitemview/viewstotest.cpp @@ -141,7 +141,6 @@ QAbstractItemView *ViewsToTest::createView(const QString &viewType) view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); view->setSelectionBehavior(QAbstractItemView::SelectItems); } - Q_ASSERT(view); return view; } -- cgit v1.2.3 From e415182a1428bd265f13547058e07d1694955ae9 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 11:35:25 +1000 Subject: Change Q_ASSERT to QVERIFY in QMenu test. Change-Id: Ifc08d4eabd8565cfd242ec2e70cf597e92f28fe3 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 291f04a4a7be4a975c6b8eaeeed4e0c196e23128) --- tests/auto/qmenu/tst_qmenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 1367e1f37d..c31361d60a 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -789,7 +789,7 @@ void tst_QMenu::task250673_activeMultiColumnSubMenuPosition() while (main.columnCount() < 2) { main.addAction(QString("Item %1").arg(i)); ++i; - Q_ASSERT(i<1000); + QVERIFY(i<1000); } main.setActiveAction(menuAction); sub.setActiveAction(subAction); -- cgit v1.2.3 From 4bf7ac3968ea6d3aa3f438fe0bd2a53ac7e357b7 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 11:44:16 +1000 Subject: Remove Q_ASSERT from QMetaObject autotest. Issue a helpful warning rather than ignoring the error in release mode builds. Change-Id: Iea7bf4d63f8227abaf7dcf1700c5fef62763afad Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 6f082a3fdd368cd7a969b7f324354583d081da82) --- tests/auto/qmetaobject/tst_qmetaobject.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp index 13e3bcd588..f1a909a941 100644 --- a/tests/auto/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp @@ -244,7 +244,12 @@ public: QObject *child; public slots: - void on_child1_destroyed(QObject *obj = 0) { ++invokeCount1; Q_ASSERT(obj && obj == child); } + void on_child1_destroyed(QObject *obj = 0) + { + ++invokeCount1; + if (!obj || obj != child) + qWarning() << "on_child1_destroyed invoked with wrong child object"; + } void on_child2_destroyed() { ++invokeCount2; } }; @@ -268,7 +273,12 @@ public: } private slots: - void on_child1_destroyed(QObject *obj) { ++invokeCount1; Q_ASSERT(obj && obj == child); } + void on_child1_destroyed(QObject *obj) + { + ++invokeCount1; + if (!obj || obj != child) + qWarning() << "on_child1_destroyed invoked with wrong child object"; + } void on_child1_destroyed() { ++invokeCount2; } }; -- cgit v1.2.3 From d0d393d86f3cc0300fe6329733b409e713263cb3 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 11:48:40 +1000 Subject: Remove Q_ASSERT's from QMetaType autotest. Instead of asserting in debug mode and doing nothing in release mode, put specific warnings in the test output and fail the test gracefully. Change-Id: I453a0ab7ddef5b2acf55f77f71a59a940d93ae54 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit a3b2fa3f1beffa7709c11522d4e2db9ec8f952e0) --- tests/auto/qmetatype/tst_qmetatype.cpp | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/auto/qmetatype/tst_qmetatype.cpp b/tests/auto/qmetatype/tst_qmetatype.cpp index 67bbac217a..fcb949fbeb 100644 --- a/tests/auto/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/qmetatype/tst_qmetatype.cpp @@ -113,17 +113,35 @@ protected: #ifdef Q_OS_LINUX pthread_yield(); #endif - Q_ASSERT(QMetaType::isRegistered(tp)); - Q_ASSERT(QMetaType::type(nm) == tp); - Q_ASSERT(QMetaType::typeName(tp) == name); + if (!QMetaType::isRegistered(tp)) { + ++failureCount; + qWarning() << name << "is not a registered metatype"; + } + if (QMetaType::type(nm) != tp) { + ++failureCount; + qWarning() << "Wrong metatype returned for" << name; + } + if (QMetaType::typeName(tp) != name) { + ++failureCount; + qWarning() << "Wrong typeName returned for" << tp; + } void *buf = QMetaType::construct(tp, 0); void *buf2 = QMetaType::construct(tp, buf); - Q_ASSERT(buf); - Q_ASSERT(buf2); + if (!buf) { + ++failureCount; + qWarning() << "Null buffer returned by QMetaType::construct(tp, 0)"; + } + if (!buf2) { + ++failureCount; + qWarning() << "Null buffer returned by QMetaType::construct(tp, buf)"; + } QMetaType::destroy(tp, buf); QMetaType::destroy(tp, buf2); } } +public: + MetaTypeTorturer() : failureCount(0) { } + int failureCount; }; void tst_QMetaType::threadSafety() @@ -139,6 +157,10 @@ void tst_QMetaType::threadSafety() QVERIFY(t1.wait()); QVERIFY(t2.wait()); QVERIFY(t3.wait()); + + QCOMPARE(t1.failureCount, 0); + QCOMPARE(t2.failureCount, 0); + QCOMPARE(t3.failureCount, 0); } namespace TestSpace -- cgit v1.2.3 From 982405f2d0f233872d83579893f07699810050bf Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 11:59:05 +1000 Subject: Remove Q_ASSERT's from QObject autotest. The Receiver class has two slots that aren't meant to get called during the test (they're there to catch broken parsing of slot names). Rather than asserting when one of them gets called, which does nothing in a release mode build, this commit makes the slots record the number of times they were called (as for the other slots in the test) and fails the test gracefully if either of those slots was called. Change-Id: Ia0393026cb96ffdc6190b5e7bd951f75d231b11e Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 7bd6ca895e5fa4de197d9d7bf2e7b578c01c3c2a) --- tests/auto/qobject/tst_qobject.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index 4b926e450e..b0835617b0 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -403,6 +403,8 @@ public: } void reset() { + called_slot10 = 0; + called_slot9 = 0; called_slot8 = 0; called_slot7 = 0; called_slot6 = 0; @@ -421,6 +423,8 @@ public: int called_slot6; int called_slot7; int called_slot8; + int called_slot9; + int called_slot10; bool called(int slot) { switch (slot) { @@ -432,6 +436,8 @@ public: case 6: return called_slot6; case 7: return called_slot7; case 8: return called_slot8; + case 9: return called_slot9; + case 10: return called_slot10; default: return false; } } @@ -449,8 +455,8 @@ public slots: void slotLoopBack() { ++called_slot8; } protected slots: - void o() { Q_ASSERT(0); } - void on() { Q_ASSERT(0); } + void o() { ++called_slot9; } + void on() { ++called_slot10; } signals: void on_Sender_signalLoopBack(); @@ -473,6 +479,8 @@ void tst_QObject::connectByName() QCOMPARE(receiver.called(6), false); QCOMPARE(receiver.called(7), false); QCOMPARE(receiver.called(8), false); + QCOMPARE(receiver.called(9), false); + QCOMPARE(receiver.called(10), false); receiver.reset(); sender.emitSignalWithParams(0); @@ -484,6 +492,8 @@ void tst_QObject::connectByName() QCOMPARE(receiver.called(6), false); QCOMPARE(receiver.called(7), false); QCOMPARE(receiver.called(8), false); + QCOMPARE(receiver.called(9), false); + QCOMPARE(receiver.called(10), false); receiver.reset(); sender.emitSignalWithParams(0, "string"); @@ -495,6 +505,8 @@ void tst_QObject::connectByName() QCOMPARE(receiver.called(6), false); QCOMPARE(receiver.called(7), false); QCOMPARE(receiver.called(8), false); + QCOMPARE(receiver.called(9), false); + QCOMPARE(receiver.called(10), false); receiver.reset(); sender.emitSignalManyParams(1, 2, 3, "string", true); @@ -506,6 +518,8 @@ void tst_QObject::connectByName() QCOMPARE(receiver.called(6), false); QCOMPARE(receiver.called(7), false); QCOMPARE(receiver.called(8), false); + QCOMPARE(receiver.called(9), false); + QCOMPARE(receiver.called(10), false); receiver.reset(); sender.emitSignalManyParams2(1, 2, 3, "string", true); @@ -517,6 +531,8 @@ void tst_QObject::connectByName() QCOMPARE(receiver.called(6), false); QCOMPARE(receiver.called(7), true); QCOMPARE(receiver.called(8), false); + QCOMPARE(receiver.called(9), false); + QCOMPARE(receiver.called(10), false); receiver.reset(); sender.emitSignalLoopBack(); @@ -528,6 +544,8 @@ void tst_QObject::connectByName() QCOMPARE(receiver.called(6), false); QCOMPARE(receiver.called(7), false); QCOMPARE(receiver.called(8), true); + QCOMPARE(receiver.called(9), false); + QCOMPARE(receiver.called(10), false); receiver.reset(); } -- cgit v1.2.3 From 44bb3c62cbe785e7fc9c2455de308717894e6a6b Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 12:56:16 +1000 Subject: Remove Q_ASSERT's from qsharedpointer autotest Report a meaningful warning message into the test output rather than aborting in debug mode and doing nothing in release mode. Change-Id: I6883fccbce0139c763f36f6839bb3452d8f69c1c Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 5b86c4abc676b36d60e6625e89535e7f4907d2b3) --- tests/auto/qsharedpointer/externaltests.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/auto/qsharedpointer/externaltests.cpp b/tests/auto/qsharedpointer/externaltests.cpp index 1ba03dced6..b0490c9e59 100644 --- a/tests/auto/qsharedpointer/externaltests.cpp +++ b/tests/auto/qsharedpointer/externaltests.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #ifdef Q_OS_SYMBIAN #define DEFAULT_MAKESPEC "X:/STLsupport/mkspecs/symbian-abld/" @@ -342,7 +343,8 @@ namespace QTest { void QExternalTestPrivate::removeTemporaryDirectory() { - Q_ASSERT(!temporaryDir.isEmpty()); + if (temporaryDir.isEmpty()) + qWarning() << "Temporary directory is expected to be non-empty"; removeRecursive(temporaryDir); temporaryDir.clear(); } @@ -487,7 +489,8 @@ namespace QTest { bool QExternalTestPrivate::createProjectFile() { - Q_ASSERT(!temporaryDir.isEmpty()); + if (temporaryDir.isEmpty()) + qWarning() << "Temporary directory is expected to be non-empty"; QFile projectFile(temporaryDir + QLatin1String("/project.pro")); if (!projectFile.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) { @@ -599,7 +602,9 @@ namespace QTest { bool QExternalTestPrivate::runQmake() { - Q_ASSERT(!temporaryDir.isEmpty()); + if (temporaryDir.isEmpty()) + qWarning() << "Temporary directory is expected to be non-empty"; + if (!createProjectFile()) return false; @@ -633,7 +638,8 @@ namespace QTest { bool QExternalTestPrivate::runMake(Target target) { - Q_ASSERT(!temporaryDir.isEmpty()); + if (temporaryDir.isEmpty()) + qWarning() << "Temporary directory is expected to be non-empty"; QExternalProcess make; make.setWorkingDirectory(temporaryDir); -- cgit v1.2.3 From d7e10b2a71f1fa196472544309dc59488229ebeb Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 18 May 2011 10:26:00 +1000 Subject: Remove Q_ASSERT from qsslsocket autotest. Make the server thread exit early if the socket is invalid. This will make the test fail gracefully instead of crashing. Change-Id: Ia9564c94dd32d65e6e9bdb4a2410f1512409546c Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit b9b3ced2eafe13e491d5af5ad7432733941bfd8d) Conflicts: tests/auto/qsslsocket/tst_qsslsocket.cpp --- tests/auto/qsslsocket/tst_qsslsocket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index b508d4795b..507af5ebd5 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -1565,8 +1565,8 @@ protected: // delayed start of encryption QTest::qSleep(100); QSslSocket *socket = server.socket; - QVERIFY(socket); - QVERIFY(socket->isValid()); + if (!socket || !socket->isValid()) + return; // error socket->ignoreSslErrors(); socket->startServerEncryption(); if (!socket->waitForEncrypted(2000)) -- cgit v1.2.3 From c0372871f8f8493ac1b59b800caed4b55d1c9b6f Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 14:56:05 +1000 Subject: Remove Q_ASSERT from qtesselator autotest If the test data is incorrect, print a meaningful warning into the test output instead of deferencing an iterator beyond the last element in the list. Change-Id: I7be4f282639453de6d8240a2f17253025b415337 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit f01e2a5024db69913aed016e2854b2589ca85080) --- tests/auto/qtessellator/dataparser.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/qtessellator/dataparser.cpp b/tests/auto/qtessellator/dataparser.cpp index bd17ee2835..d6566cb2f9 100644 --- a/tests/auto/qtessellator/dataparser.cpp +++ b/tests/auto/qtessellator/dataparser.cpp @@ -98,8 +98,12 @@ static QList parsePoints(const QByteArray &line) QList nums = parseNumbersList(it); QList::const_iterator nitr; for (nitr = nums.begin(); nitr != nums.end(); ++nitr) { - qreal x = *nitr; ++nitr; - Q_ASSERT(nitr != nums.end()); + qreal x = *nitr; + ++nitr; + if (nitr == nums.end()) { + qWarning() << "parsePoints: Even number of co-ordinates required, odd number found: skipping last point"; + break; + } qreal y = *nitr; res.append(QPointF(x, y)); } -- cgit v1.2.3 From fd714ec5aa3418b55c7c8bf7d77cbdb2a6798135 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 15:47:55 +1000 Subject: Remove Q_ASSERT from QTextOdfWriter autotest If the tag can't be found in the data, return an empty string rather than asserting, so that the test fails gracefully. Change-Id: I536f08c9c3e942817680849d96d035999d4994db Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit a88dd1c5f62b5ded8ea0d76d185127ef28549c72) --- tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp index 997cd683c5..ffce9a21eb 100644 --- a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp +++ b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp @@ -114,11 +114,14 @@ QString tst_QTextOdfWriter::getContentFromXml() xmlWriter->writeEndDocument(); buffer->close(); QString stringContent = QString::fromUtf8(buffer->data()); + QString ret; int index = stringContent.indexOf("', index); - stringContent = stringContent.mid(index+1, stringContent.length() - index - 10); - return stringContent; + if (index > 0) { + index = stringContent.indexOf('>', index); + if (index > 0) + ret = stringContent.mid(index+1, stringContent.length() - index - 10); + } + return ret; } void tst_QTextOdfWriter::testWriteParagraph_data() -- cgit v1.2.3 From dffae678ddfb124ade608b2fb0f062b72abfe1b7 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 15:58:24 +1000 Subject: Remove Q_ASSERT's from QVariant autotest. Print a meaningful warning message instead of aborting in debug mode builds and failing silently in release mode builds. Change-Id: I44143c5fbe6b6af87bdf5bd231cfaf9a3c9c33f8 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit a8dc321b6669dd263a25a0cb5766e5b7150c6e20) --- tests/auto/qvariant/tst_qvariant.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp index 3e65d7e728..69855a1597 100644 --- a/tests/auto/qvariant/tst_qvariant.cpp +++ b/tests/auto/qvariant/tst_qvariant.cpp @@ -3239,18 +3239,21 @@ struct MyData { void *ptr; MyData() : ptr(this) {} - ~MyData() { Q_ASSERT(ptr == this); } + ~MyData() + { + if (ptr != this) qWarning("MyData::~MyData(): object has moved"); + } MyData(const MyData& o) : ptr(this) { Q_ASSERT(o.ptr == &o); } MyData &operator=(const MyData &o) { - Q_ASSERT(ptr == this); - Q_ASSERT(o.ptr == &o); + if (ptr != this) qWarning("MyData::operator=(): object has moved"); + if (o.ptr != &o) qWarning("MyData::operator=(): other object has moved"); return *this; } bool operator==(const MyData &o) const { - Q_ASSERT(ptr == this); - Q_ASSERT(o.ptr == &o); + if (ptr != this) qWarning("MyData::operator==(): object has moved"); + if (o.ptr != &o) qWarning("MyData::operator==(): other object has moved"); return true; } }; -- cgit v1.2.3 From 079dde144fd372ba76a5639fe69fca4e13c91ad7 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 16:04:31 +1000 Subject: Remove mention of Q_ASSERT in comments This will make it easier to check for stray Q_ASSERT's in the future. Change-Id: I5ddafe1bf26819566460920deae8ff448008c93f Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit b2db13f245f09f1d14af64d2199284c78cbb5b6e) --- tests/auto/qwidget/tst_qwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index f282b5d7d3..9ce0849c4d 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -10422,7 +10422,7 @@ void tst_QWidget::taskQTBUG_7532_tabOrderWithFocusProxy() w.setFocusProxy(fp); QWidget::setTabOrder(&w, fp); - // No Q_ASSERT, then it's allright. + // In debug mode, no assertion failure means it's alright. } void tst_QWidget::movedAndResizedAttributes() -- cgit v1.2.3 From affdd6283c32e144b6c9d5f58b492eebf56e966e Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 16:08:25 +1000 Subject: Remove Q_ASSERT's from QWizard autotest Combine the two checking functions (check and checkInvariant) and have the resulting check function return a bool instead of asserting so that the test function can QVERIFY and fail gracefully. Change-Id: Ib069b5424483ba6ffb9caf75036c4f325e9dba51 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit a54900d2227bfb2021c5d1255817824aff11cf32) --- tests/auto/qwizard/tst_qwizard.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/auto/qwizard/tst_qwizard.cpp b/tests/auto/qwizard/tst_qwizard.cpp index 5667d4047a..00b59a923b 100644 --- a/tests/auto/qwizard/tst_qwizard.cpp +++ b/tests/auto/qwizard/tst_qwizard.cpp @@ -854,25 +854,26 @@ struct MyPage2 : public QWizardPage public: MyPage2() : init(0), cleanup(0), validate(0) {} - void initializePage() { ++init; QWizardPage::initializePage(); checkInvariant(); } - void cleanupPage() { ++cleanup; QWizardPage::cleanupPage(); checkInvariant(); } + void initializePage() { ++init; QWizardPage::initializePage(); } + void cleanupPage() { ++cleanup; QWizardPage::cleanupPage(); } bool validatePage() { ++validate; return QWizardPage::validatePage(); } - void check(int init, int cleanup) - { Q_ASSERT(init == this->init && cleanup == this->cleanup); Q_UNUSED(init); Q_UNUSED(cleanup); } + bool check(int init, int cleanup) + { + return init == this->init + && cleanup == this->cleanup + && (this->init == this->cleanup || this->init - 1 == this->cleanup); + } int init; int cleanup; int validate; - -private: - void checkInvariant() { Q_ASSERT(init == cleanup || init - 1 == cleanup); } }; #define CHECK_PAGE_INIT(i0, c0, i1, c1, i2, c2) \ - page0->check((i0), (c0)); \ - page1->check((i1), (c1)); \ - page2->check((i2), (c2)); + QVERIFY(page0->check((i0), (c0))); \ + QVERIFY(page1->check((i1), (c1))); \ + QVERIFY(page2->check((i2), (c2))); void tst_QWizard::setOption_IndependentPages() { -- cgit v1.2.3 From ab6c90367d01d1961b4969c8eb45399db17f8cec Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 16:12:05 +1000 Subject: Remove Q_ASSERT from QThread autotest Report a meaningful fatal error instead of aborting in debug mode builds and failing silently in release mode builds. Change-Id: If9a6c0655e021b3bb6b7d894aefd9bbcc58e4605 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit fed42f25e129af1f4f2c03a075530ad7111d2fdd) --- tests/auto/qthread/tst_qthread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp index 6ad0678745..054a9957be 100644 --- a/tests/auto/qthread/tst_qthread.cpp +++ b/tests/auto/qthread/tst_qthread.cpp @@ -209,7 +209,7 @@ public: cond.wait(&mutex, five_minutes); } setTerminationEnabled(true); - Q_ASSERT_X(false, "tst_QThread", "test case hung"); + qFatal("tst_QThread: test case hung"); } }; -- cgit v1.2.3 From 42d6820c7c1f43b7fd633579c1ba494212d0176f Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 16:14:03 +1000 Subject: Remove Q_ASSERT from QSharedPointer autotest Report a meaningful fatal error instead of aborting in debug mode builds and failing silently in release mode builds. Change-Id: I0f939dc40810f072a3e24aeba085191793c49ef3 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit b988b2f9f04ac0ebce7a779cd9bd5d394bfa1c95) --- tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index bb04621b67..96d087384b 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -139,7 +139,8 @@ public: virtual ~Data() { - Q_ASSERT_X(generation > 0, "tst_QSharedPointer", "Double deletion!"); + if (generation <= 0) + qFatal("tst_qsharedpointer: Double deletion!"); generation = 0; ++destructorCounter; } -- cgit v1.2.3 From f5662adb0368c74e1b0cf634d9792ceee35ed4b8 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 16:17:43 +1000 Subject: Remove Q_ASSERT from QLibrary autotest Report a regular test failure rather than aborting when an unknown operation is requested. Change-Id: I3678f42f9e9f895d8d0d49a768d4c8b575d1863f Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 22aa68ecec96da4d14a4c9fe2f6e4a337b13b4a3) --- tests/auto/qlibrary/tst_qlibrary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qlibrary/tst_qlibrary.cpp b/tests/auto/qlibrary/tst_qlibrary.cpp index c79332d276..a8c60c93c2 100644 --- a/tests/auto/qlibrary/tst_qlibrary.cpp +++ b/tests/auto/qlibrary/tst_qlibrary.cpp @@ -468,7 +468,7 @@ void tst_QLibrary::errorString() } break;} default: - Q_ASSERT(0); + QFAIL(qPrintable(QString("Unknown operation: %1").arg(operation))); break; } QRegExp re(errorString); -- cgit v1.2.3 From 803f6117caf1b4896f3ae1493e96f1cd2affd02e Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 16:39:50 +1000 Subject: Remove Q_ASSERT from QXmlInputSource autotest Report a fatal error in all builds rather than aborting in debug mode builds only. Change-Id: I53b348f077c6533433e32bbebd159066a2bc2c37 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 4f818b8bcf51cf9c654edbf319d90f6c77a09b3e) --- tests/auto/qxmlinputsource/tst_qxmlinputsource.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/auto/qxmlinputsource/tst_qxmlinputsource.cpp b/tests/auto/qxmlinputsource/tst_qxmlinputsource.cpp index c0029f59bd..a2c84cfa50 100644 --- a/tests/auto/qxmlinputsource/tst_qxmlinputsource.cpp +++ b/tests/auto/qxmlinputsource/tst_qxmlinputsource.cpp @@ -181,9 +181,7 @@ private slots: { if(bodyLength == -1) { - Q_ASSERT_X(false, Q_FUNC_INFO, - "No length was specified in the header."); - return; + qFatal("No length was specified in the header."); } QDomDocument domDoc; -- cgit v1.2.3 From 8c191084a8a65262c3a2de52082b986c8db17f02 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 17:16:52 +1000 Subject: Remove Q_ASSERT from qxmlsimplereader autotest Verify the success of setting the document content in the test function rather than using Q_ASSERT. Change-Id: I25e017e7f92803867a998b4f09ad9f717212a9bc Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit d7453aef14b80a5972909ed99f1b4c765b7436a5) --- .../auto/qxmlsimplereader/tst_qxmlsimplereader.cpp | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp index 565df30961..0e4930454a 100644 --- a/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp +++ b/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp @@ -165,7 +165,7 @@ class tst_QXmlSimpleReader : public QObject void roundtripWithNamespaces() const; private: - static QDomDocument fromByteArray(const QString &title, const QByteArray &ba); + static QDomDocument fromByteArray(const QString &title, const QByteArray &ba, bool *ok); XmlServer *server; }; @@ -730,25 +730,27 @@ void tst_QXmlSimpleReader::reportNamespace_data() const << QString("http://example.com/"); } -QDomDocument tst_QXmlSimpleReader::fromByteArray(const QString &title, const QByteArray &ba) +QDomDocument tst_QXmlSimpleReader::fromByteArray(const QString &title, const QByteArray &ba, bool *ok) { QDomDocument doc(title); - const bool ret = doc.setContent(ba, true); - Q_ASSERT(ret); + *ok = doc.setContent(ba, true); return doc; } void tst_QXmlSimpleReader::roundtripWithNamespaces() const { - QEXPECT_FAIL("", "Known problem, see 154573. The fix happens to break uic.", Abort); - const char *const expected = "\n"; + bool ok; { const char *const xml = ""; - const QDomDocument one(fromByteArray("document", xml)); - const QDomDocument two(fromByteArray("document2", one.toByteArray(2))); + const QDomDocument one(fromByteArray("document", xml, &ok)); + QVERIFY(ok); + const QDomDocument two(fromByteArray("document2", one.toByteArray(2), &ok)); + QVERIFY(ok); + + QEXPECT_FAIL("", "Known problem, see 154573. The fix happens to break uic.", Abort); QCOMPARE(expected, one.toByteArray().constData()); QCOMPARE(one.toByteArray(2).constData(), two.toByteArray(2).constData()); @@ -758,8 +760,10 @@ void tst_QXmlSimpleReader::roundtripWithNamespaces() const { const char *const xml = ""; - const QDomDocument one(fromByteArray("document", xml)); - const QDomDocument two(fromByteArray("document2", one.toByteArray(2))); + const QDomDocument one(fromByteArray("document", xml, &ok)); + QVERIFY(ok); + const QDomDocument two(fromByteArray("document2", one.toByteArray(2), &ok)); + QVERIFY(ok); QCOMPARE(expected, one.toByteArray().constData()); QCOMPARE(one.toByteArray(2).constData(), two.toByteArray(2).constData()); -- cgit v1.2.3 From 48ab5a8d25ff5d5c706763f65024d5b05ba7fcd0 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 17:30:43 +1000 Subject: Remove unused code from QXmlStream autotest Change-Id: I719e502ef14848a22d41de71245fe6b6758c8d6b Reviewed-by: Rohan McGovern (cherry picked from commit 614474fb3d440eabd3ba7e381d246064ce39f4fa) --- tests/auto/qxmlstream/qc14n.h | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'tests') diff --git a/tests/auto/qxmlstream/qc14n.h b/tests/auto/qxmlstream/qc14n.h index bf8090888d..99432f3b35 100644 --- a/tests/auto/qxmlstream/qc14n.h +++ b/tests/auto/qxmlstream/qc14n.h @@ -47,17 +47,9 @@ QT_FORWARD_DECLARE_CLASS(QString) class QC14N { public: - enum Option - { - IgnoreProcessingInstruction, - IgnoreComments - }; - typedef QFlags