diff options
Diffstat (limited to 'tests')
21 files changed, 314 insertions, 8 deletions
diff --git a/tests/auto/concurrent/concurrent.pro b/tests/auto/concurrent/concurrent.pro index 20bad24fc1..e67c51aae3 100644 --- a/tests/auto/concurrent/concurrent.pro +++ b/tests/auto/concurrent/concurrent.pro @@ -3,6 +3,7 @@ SUBDIRS=\ qtconcurrentfilter \ qtconcurrentiteratekernel \ qtconcurrentmap \ + qtconcurrentmedian \ qtconcurrentrun \ qtconcurrentthreadengine diff --git a/tests/auto/concurrent/qtconcurrentmedian/qtconcurrentmedian.pro b/tests/auto/concurrent/qtconcurrentmedian/qtconcurrentmedian.pro new file mode 100644 index 0000000000..1eb27d825a --- /dev/null +++ b/tests/auto/concurrent/qtconcurrentmedian/qtconcurrentmedian.pro @@ -0,0 +1,5 @@ +CONFIG += testcase parallel_test +TARGET = tst_qtconcurrentmedian +QT = core testlib concurrent +SOURCES = tst_qtconcurrentmedian.cpp +DEFINES += QT_STRICT_ITERATORS diff --git a/tests/auto/concurrent/qtconcurrentmedian/tst_qtconcurrentmedian.cpp b/tests/auto/concurrent/qtconcurrentmedian/tst_qtconcurrentmedian.cpp new file mode 100644 index 0000000000..c9fbc790bd --- /dev/null +++ b/tests/auto/concurrent/qtconcurrentmedian/tst_qtconcurrentmedian.cpp @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include <qtconcurrentmedian.h> + +#include <QtTest/QtTest> + +class tst_QtConcurrentMedian: public QObject +{ + Q_OBJECT +private slots: + void median_data(); + void median(); +}; + +void tst_QtConcurrentMedian::median_data() +{ + QTest::addColumn<QList<int> >("values"); + QTest::addColumn<int>("expectedMedian"); + + QTest::newRow("size=1") + << (QList<int>() << 1) + << 1; + + QTest::newRow("size=2") + << (QList<int>() << 3 << 2) + << 3; + + QTest::newRow("size=3") + << (QList<int>() << 3 << 1 << 2) + << 2; + + QTest::newRow("gcc bug 58800 (nth_element)") + << (QList<int>() << 207089 << 202585 << 180067 << 157549 << 211592 << 216096 << 207089) + << 207089; +} + +void tst_QtConcurrentMedian::median() +{ + QFETCH(QList<int> , values); + QFETCH(int, expectedMedian); + + QtConcurrent::Median<int> m(values.size()); + foreach (int value, values) + m.addValue(value); + QCOMPARE(m.median(), expectedMedian); +} + +QTEST_MAIN(tst_QtConcurrentMedian) +#include "tst_qtconcurrentmedian.moc" diff --git a/tests/auto/corelib/io/qprocess/qprocess.pro b/tests/auto/corelib/io/qprocess/qprocess.pro index 4155e3f73d..6ba54b1e92 100644 --- a/tests/auto/corelib/io/qprocess/qprocess.pro +++ b/tests/auto/corelib/io/qprocess/qprocess.pro @@ -8,7 +8,11 @@ SUBDIRS += testProcessSpacesArgs/nospace.pro \ testProcessSpacesArgs/twospaces.pro \ testSpaceInName -win32:!wince*:SUBDIRS+=testProcessEchoGui +win32:!wince* { + SUBDIRS += \ + testProcessEchoGui \ + testSetNamedPipeHandleState +} test.depends += $$SUBDIRS SUBDIRS += test diff --git a/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/main.cpp b/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/main.cpp new file mode 100644 index 0000000000..b2cc793b51 --- /dev/null +++ b/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <windows.h> + +int main() +{ + DWORD mode = PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT; + if (SetNamedPipeHandleState(GetStdHandle(STD_INPUT_HANDLE), &mode, NULL, NULL)) + return 0; + return GetLastError(); +} diff --git a/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/testSetNamedPipeHandleState.pro b/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/testSetNamedPipeHandleState.pro new file mode 100644 index 0000000000..e236e05c7d --- /dev/null +++ b/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/testSetNamedPipeHandleState.pro @@ -0,0 +1,4 @@ +SOURCES = main.cpp +CONFIG -= qt app_bundle +CONFIG += console +DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index d248f022ed..37f224ff28 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -93,6 +93,7 @@ private slots: void echoTest2(); #ifdef Q_OS_WIN void echoTestGui(); + void testSetNamedPipeHandleState(); void batFiles_data(); void batFiles(); #endif @@ -538,7 +539,6 @@ void tst_QProcess::echoTest2() #endif #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) -//Batch files are not supported on Winfows CE // Reading and writing to a process is not supported on Qt/CE //----------------------------------------------------------------------------- void tst_QProcess::echoTestGui() @@ -556,11 +556,22 @@ void tst_QProcess::echoTestGui() QCOMPARE(process.readAllStandardOutput(), QByteArray("Hello")); QCOMPARE(process.readAllStandardError(), QByteArray("Hello")); } + +void tst_QProcess::testSetNamedPipeHandleState() +{ + QProcess process; + process.setProcessChannelMode(QProcess::SeparateChannels); + process.start("testSetNamedPipeHandleState/testSetNamedPipeHandleState"); + QVERIFY2(process.waitForStarted(5000), qPrintable(process.errorString())); + QVERIFY(process.waitForFinished(5000)); + QCOMPARE(process.exitCode(), 0); + QCOMPARE(process.exitStatus(), QProcess::NormalExit); +} #endif // !Q_OS_WINCE && Q_OS_WIN //----------------------------------------------------------------------------- #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) -//Batch files are not supported on Winfows CE +// Batch files are not supported on Windows CE void tst_QProcess::batFiles_data() { QTest::addColumn<QString>("batFile"); diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp index 0570985e46..0e7005799e 100644 --- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp +++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp @@ -75,6 +75,8 @@ private slots: void usage_connect(); void usage_templateConnect(); + void classNameFirstInStringData(); + private: static bool checkForSideEffects (const QMetaObjectBuilder& builder, @@ -1694,6 +1696,20 @@ void tst_QMetaObjectBuilder::usage_templateConnect() QVERIFY(!con); } +void tst_QMetaObjectBuilder::classNameFirstInStringData() +{ + QMetaObjectBuilder builder; + builder.addMetaObject(&SomethingOfEverything::staticMetaObject); + builder.setClassName(QByteArrayLiteral("TestClass")); + QMetaObject *mo = builder.toMetaObject(); + + QByteArrayDataPtr header; + header.ptr = const_cast<QByteArrayData*>(mo->d.stringdata); + QCOMPARE(QByteArray(header), QByteArrayLiteral("TestClass")); + + free(mo); +} + QTEST_MAIN(tst_QMetaObjectBuilder) #include "tst_qmetaobjectbuilder.moc" diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp index d5b3323506..cbbb30a598 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp @@ -69,6 +69,7 @@ private slots: void testUnknownOptionErrorHandling(); void testDoubleDash_data(); void testDoubleDash(); + void testDefaultValue(); void testProcessNotCalled(); void testEmptyArgsList(); void testMissingOptionValue(); @@ -322,6 +323,17 @@ void tst_QCommandLineParser::testDoubleDash() QCOMPARE(parser.unknownOptionNames(), QStringList()); } +void tst_QCommandLineParser::testDefaultValue() +{ + QCommandLineOption opt(QStringLiteral("name"), QStringLiteral("desc"), + QStringLiteral("valueName"), QStringLiteral("default")); + QCOMPARE(opt.defaultValues(), QStringList(QStringLiteral("default"))); + opt.setDefaultValue(QStringLiteral("")); + QCOMPARE(opt.defaultValues(), QStringList()); + opt.setDefaultValue(QStringLiteral("default")); + QCOMPARE(opt.defaultValues(), QStringList(QStringLiteral("default"))); +} + void tst_QCommandLineParser::testProcessNotCalled() { QCoreApplication app(empty_argc, empty_argv); diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp index 0a63ffeeaf..d81bfc33fb 100644 --- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp @@ -56,6 +56,7 @@ private slots: void createTest(); void nullTest(); void dataStreamTest(); + void isTimeZoneIdAvailable(); void availableTimeZoneIds(); void stressTest(); void windowsId(); @@ -347,6 +348,36 @@ void tst_QTimeZone::dataStreamTest() QCOMPARE(tz2.id(), tz1.id()); } +void tst_QTimeZone::isTimeZoneIdAvailable() +{ + QList<QByteArray> available = QTimeZone::availableTimeZoneIds(); + foreach (const QByteArray &id, available) + QVERIFY(QTimeZone::isTimeZoneIdAvailable(id)); + + // a-z, A-Z, 0-9, '.', '-', '_' are valid chars + // Can't start with '-' + // Parts separated by '/', each part min 1 and max of 14 chars + QCOMPARE(QTimeZonePrivate::isValidId("az"), true); + QCOMPARE(QTimeZonePrivate::isValidId("AZ"), true); + QCOMPARE(QTimeZonePrivate::isValidId("09"), true); + QCOMPARE(QTimeZonePrivate::isValidId("a/z"), true); + QCOMPARE(QTimeZonePrivate::isValidId("a.z"), true); + QCOMPARE(QTimeZonePrivate::isValidId("a-z"), true); + QCOMPARE(QTimeZonePrivate::isValidId("a_z"), true); + QCOMPARE(QTimeZonePrivate::isValidId(".z"), true); + QCOMPARE(QTimeZonePrivate::isValidId("_z"), true); + QCOMPARE(QTimeZonePrivate::isValidId("12345678901234"), true); + QCOMPARE(QTimeZonePrivate::isValidId("12345678901234/12345678901234"), true); + QCOMPARE(QTimeZonePrivate::isValidId("a z"), false); + QCOMPARE(QTimeZonePrivate::isValidId("a\\z"), false); + QCOMPARE(QTimeZonePrivate::isValidId("a,z"), false); + QCOMPARE(QTimeZonePrivate::isValidId("/z"), false); + QCOMPARE(QTimeZonePrivate::isValidId("-z"), false); + QCOMPARE(QTimeZonePrivate::isValidId("123456789012345"), false); + QCOMPARE(QTimeZonePrivate::isValidId("123456789012345/12345678901234"), false); + QCOMPARE(QTimeZonePrivate::isValidId("12345678901234/123456789012345"), false); +} + void tst_QTimeZone::availableTimeZoneIds() { if (debug) { diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index f1d0e227f6..b10b5704c3 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -50,6 +50,7 @@ #include <QImageWriter> #include <QPainter> #include <QSet> +#include <QTemporaryDir> #ifdef Q_OS_UNIX // for geteuid() # include <sys/types.h> @@ -84,6 +85,7 @@ private slots: void supportedMimeTypes(); void writeToInvalidDevice(); + void testCanWrite(); void supportsOption_data(); void supportsOption(); @@ -402,6 +404,28 @@ void tst_QImageWriter::writeToInvalidDevice() } } +void tst_QImageWriter::testCanWrite() +{ + { + // device is not set + QImageWriter writer; + QVERIFY(!writer.canWrite()); + QCOMPARE(writer.error(), QImageWriter::DeviceError); + } + + { + // check if canWrite won't leave an empty file + QTemporaryDir dir; + QVERIFY(dir.isValid()); + QString fileName(dir.path() + QLatin1String("/001.garble")); + QVERIFY(!QFileInfo(fileName).exists()); + QImageWriter writer(fileName); + QVERIFY(!writer.canWrite()); + QCOMPARE(writer.error(), QImageWriter::UnsupportedFormatError); + QVERIFY(!QFileInfo(fileName).exists()); + } +} + void tst_QImageWriter::supportsOption_data() { QTest::addColumn<QString>("fileName"); diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 776278a480..f3cae6f4eb 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -48,6 +48,7 @@ #include <qudpsocket.h> #include <qhostaddress.h> #include <qhostinfo.h> +#include <qtcpsocket.h> #include <qmap.h> #include <QNetworkProxy> #include <QNetworkInterface> @@ -144,12 +145,26 @@ tst_QUdpSocket::~tst_QUdpSocket() void tst_QUdpSocket::initTestCase_data() { + // hack: we only enable the Socks5 over UDP tests on the old + // test server, because they fail on the new one. See QTBUG-35490 + bool newTestServer = true; + QTcpSocket socket; + socket.connectToHost(QtNetworkSettings::serverName(), 22); + if (socket.waitForConnected(10000)) { + socket.waitForReadyRead(5000); + QByteArray ba = socket.readAll(); + if (ba.startsWith("SSH-2.0-OpenSSH_5.8p1")) + newTestServer = false; + socket.disconnectFromHost(); + } + QTest::addColumn<bool>("setProxy"); QTest::addColumn<int>("proxyType"); QTest::newRow("WithoutProxy") << false << 0; #ifndef QT_NO_SOCKS5 - QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy); + if (!newTestServer) + QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy); #endif #ifndef QT_NO_BEARERMANAGEMENT diff --git a/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted-anssi-tresor.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted-anssi-tresor.pem new file mode 100644 index 0000000000..cf212f117e --- /dev/null +++ b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted-anssi-tresor.pem @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDbDCCAlSgAwIBAgIDAx2nMA0GCSqGSIb3DQEBBQUAMEsxCzAJBgNVBAYTAkZS +MQ4wDAYDVQQKEwVER1RQRTEsMCoGA1UEAxMjQUMgREdUUEUgU2lnbmF0dXJlIEF1 +dGhlbnRpZmljYXRpb24wHhcNMTMwNzE4MTAwNTI4WhcNMTQwNzE4MTAwNTI4WjA+ +MQswCQYDVQQGEwJGUjETMBEGA1UECgwKREcgVHLDqXNvcjEaMBgGA1UEAwwRQUMg +REcgVHLDqXNvciBTU0wwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDI +0WFSUyY+MmtFkqFjTefoFyDgh9b1C/2YvSIvT8oCH62JWT5rpeTCZwaXbqWcjaNf +zggqaFsokqfhBif43HNHNtNJmvKE32VcuLB0SpsLR/1VeTd9F99C1JeHVa+nelum +OHEfouX8rRFrxNXNIYTVeiENT8Y2YqRb/XAril9g7i674uFzLiNR/t/N/F8Exujv +9U8m8rmgud/+tG9WDRaDJwoj3ZFCOnL5qLnSUEcS6TzWpozLmC2JVO5GZKGGd7qC +9FjdBkVilkbVIEGSrYvz2Uz2v5IGqMBIQaFL/kSYWxGTaedTOk2drFEApp9AEPTf +v1NwCWBfegsGQrHUROM3AgMBAAGjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQQwHQYD +VR0OBBYEFAAMW8lJqJW0DtAv5p3Mjogxvh9lMB8GA1UdIwQYMBaAFOnbkI/9W5nk +FTvwYlyn5A1Y6IeZMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEA +tDfGHkHOLW2d9fiMtwtkEwDauISJLJyCjoRmawzmQbIZXq7HaLliVfE0sdfKUm0i +Q0im1/CpnJLPoTeKyBHvNu1ubLc2m+9dabAYhF3pVdKC+gNaAzBXZ9Gt0p1CLk1l +f8Hg+R10HN2IPCv7V/crz2Ga+c234P3pfwYW8+Nd7alGCuvqot6UYXOlheF7zWUk +Hn6z6tvY+9oMDHKSUAthhA/FB50JgJU89zyTv1egY3ldKwvYBW3W3yNZdTHbPyNs +PJdhqA55mDNsteE5YTp1PyySDb1MSVrbxDEruoH6ZE99Hob4Ih8Amn7MHZatGClE +CgjXWFZ2Gxa7OUCaQpcH8g== +-----END CERTIFICATE----- diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 2798d1e22d..de7c528825 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -4221,6 +4221,7 @@ void tst_QGraphicsItem::cursor() QCursor cursor = view.viewport()->cursor(); { + QTest::mouseMove(view.viewport(), QPoint(100, 50)); QMouseEvent event(QEvent::MouseMove, QPoint(100, 50), Qt::NoButton, 0, 0); QApplication::sendEvent(view.viewport(), &event); } diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 36bf76564f..97ea7d7d32 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -1289,7 +1289,7 @@ void tst_QAbstractItemView::task200665_itemEntered() QSignalSpy spy(&view, SIGNAL(entered(QModelIndex))); view.verticalScrollBar()->setValue(view.verticalScrollBar()->maximum()); - QCOMPARE(spy.count(), 1); + QTRY_COMPARE(spy.count(), 1); } void tst_QAbstractItemView::task257481_emptyEditor() diff --git a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp index 6c04e5b39a..e2b2fb9551 100644 --- a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp @@ -1043,13 +1043,14 @@ void tst_QColumnView::dynamicModelChanges() ColumnView view; view.setModel(&model); view.setItemDelegate(&delegate); + centerOnScreen(&view); view.show(); QStandardItem *item = new QStandardItem(QLatin1String("item")); model.appendRow(item); - QTest::qWait(200); //let the time for painting to occur - QCOMPARE(delegate.paintedIndexes.count(), 1); + QVERIFY(QTest::qWaitForWindowExposed(&view)); //let the time for painting to occur + QTRY_COMPARE(delegate.paintedIndexes.count(), 1); QCOMPARE(*delegate.paintedIndexes.begin(), model.index(0,0)); diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index de028aa462..fc3b0d983c 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -4573,7 +4573,6 @@ void tst_QWidget::setGeometry_win() RECT rt; ::GetWindowRect(winHandleOf(&widget), &rt); QVERIFY(rt.left <= 0); - QEXPECT_FAIL("", "QTBUG-26424", Continue); QVERIFY(rt.top <= 0); } #endif // defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 81ed983d0f..9e181c0676 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -598,6 +598,7 @@ void tst_QMenu::layoutDirection() centerOnScreen(&win); QMenu menu(&win); + menu.addAction("foo"); menu.move(win.geometry().topRight() + QPoint(50, 0)); menu.show(); QVERIFY(QTest::qWaitForWindowExposed(&menu)); diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index 1c97686668..21034e8f1b 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp @@ -143,6 +143,8 @@ private slots: void taskQTBUG_5008_textFromValueAndValidate(); void lineEditReturnPressed(); + void positiveSign(); + void setGroupSeparatorShown_data(); void setGroupSeparatorShown(); @@ -1118,6 +1120,21 @@ void tst_QSpinBox::lineEditReturnPressed() QCOMPARE(spyCurrentChanged.count(), 1); } +void tst_QSpinBox::positiveSign() +{ + QSpinBox spinBox; + spinBox.setRange(-20, 20); + spinBox.setValue(-20); + spinBox.show(); + QVERIFY(QTest::qWaitForWindowActive(&spinBox)); + + QTest::keyClick(&spinBox, Qt::Key_End, Qt::ShiftModifier); + QTest::keyClick(&spinBox, Qt::Key_Plus, Qt::ShiftModifier); + QTest::keyClick(&spinBox, Qt::Key_2); + QTest::keyClick(&spinBox, Qt::Key_0); + QCOMPARE(spinBox.text(), QLatin1String("+20")); +} + void tst_QSpinBox::setGroupSeparatorShown_data() { QTest::addColumn<QLocale::Language>("lang"); diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp index 2ae6241849..57624a0d37 100644 --- a/tests/manual/dialogs/filedialogpanel.cpp +++ b/tests/manual/dialogs/filedialogpanel.cpp @@ -124,6 +124,7 @@ private: FileDialogPanel::FileDialogPanel(QWidget *parent) : QWidget(parent) + , m_showDirsOnly(new QCheckBox(tr("Show dirs only"))) , m_readOnly(new QCheckBox(tr("Read only"))) , m_confirmOverWrite(new QCheckBox(tr("Confirm overwrite"))) , m_nameFilterDetailsVisible(new QCheckBox(tr("Name filter details visible"))) @@ -150,6 +151,7 @@ FileDialogPanel::FileDialogPanel(QWidget *parent) optionsLayout->addRow(tr("FileMode:"), m_fileMode); optionsLayout->addRow(tr("ViewMode:"), m_viewMode); optionsLayout->addRow(tr("Allowed Schemes:"), m_allowedSchemes); + optionsLayout->addRow(m_showDirsOnly); optionsLayout->addRow(m_native); optionsLayout->addRow(m_confirmOverWrite); optionsLayout->addRow(m_nameFilterDetailsVisible); @@ -293,6 +295,8 @@ QString FileDialogPanel::filterString() const QFileDialog::Options FileDialogPanel::options() const { QFileDialog::Options result; + if (m_showDirsOnly->isChecked()) + result |= QFileDialog::ShowDirsOnly; if (!m_nameFilterDetailsVisible->isChecked()) result |= QFileDialog::HideNameFilterDetails; if (!m_resolveSymLinks->isChecked()) @@ -439,6 +443,7 @@ void FileDialogPanel::restoreDefaults() setComboBoxValue(m_acceptMode, d.acceptMode()); setComboBoxValue(m_fileMode, d.fileMode()); setComboBoxValue(m_viewMode, d.viewMode()); + m_showDirsOnly->setChecked(d.testOption(QFileDialog::ShowDirsOnly)); m_allowedSchemes->setText(QString()); m_confirmOverWrite->setChecked(d.confirmOverwrite()); m_nameFilterDetailsVisible->setChecked(d.isNameFilterDetailsVisible()); diff --git a/tests/manual/dialogs/filedialogpanel.h b/tests/manual/dialogs/filedialogpanel.h index 1e86e0f18e..8a9d93da03 100644 --- a/tests/manual/dialogs/filedialogpanel.h +++ b/tests/manual/dialogs/filedialogpanel.h @@ -92,6 +92,7 @@ private: void applySettings(QFileDialog *d) const; QFormLayout *filesLayout; + QCheckBox *m_showDirsOnly; QCheckBox *m_readOnly; QCheckBox *m_confirmOverWrite; QCheckBox *m_nameFilterDetailsVisible; |