diff options
Diffstat (limited to 'tests')
22 files changed, 402 insertions, 97 deletions
diff --git a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp index b00fd0dfd4..d1aadab7d8 100644 --- a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp +++ b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp @@ -53,11 +53,7 @@ public: // test data: QTextCodec *codec; QString (*from8BitPtr)(const char *, int); -#ifdef Q_COMPILER_REF_QUALIFIERS - QByteArray (QString:: *to8Bit)() const &; -#else - QByteArray (QString:: *to8Bit)() const; -#endif + static QByteArray to8Bit(const QString &); inline QString from8Bit(const QByteArray &ba) { return from8BitPtr(ba.constData(), ba.length()); } @@ -97,14 +93,21 @@ void tst_Utf8::init() if (useLocale) { codec = QTextCodec::codecForLocale(); from8BitPtr = &QString::fromLocal8Bit; - to8Bit = &QString::toLocal8Bit; } else { codec = QTextCodec::codecForMib(106); from8BitPtr = &QString::fromUtf8; - to8Bit = &QString::toUtf8; } } +QByteArray tst_Utf8::to8Bit(const QString &s) +{ + QFETCH_GLOBAL(bool, useLocale); + if (useLocale) + return s.toLocal8Bit(); + else + return s.toUtf8(); +} + void tst_Utf8::roundTrip_data() { QTest::addColumn<QByteArray>("utf8"); @@ -114,10 +117,10 @@ void tst_Utf8::roundTrip_data() QTest::newRow("nul") << QByteArray("", 1) << QString(QChar(QChar::Null)); static const char ascii[] = "This is a standard US-ASCII message"; - QTest::newRow("ascii") << QByteArray(ascii) << ascii; + QTest::newRow("ascii") << QByteArray(ascii) << QString::fromLatin1(ascii); static const char ascii2[] = "\1This\2is\3an\4US-ASCII\020 message interspersed with control chars"; - QTest::newRow("ascii2") << QByteArray(ascii2) << ascii2; + QTest::newRow("ascii2") << QByteArray(ascii2) << QString::fromLatin1(ascii2); static const char utf8_1[] = "\302\240"; // NBSP QTest::newRow("utf8_1") << QByteArray(utf8_1) << QString(QChar(QChar::Nbsp)); @@ -161,11 +164,20 @@ void tst_Utf8::roundTrip() QFETCH(QByteArray, utf8); QFETCH(QString, utf16); - QCOMPARE((utf16.*to8Bit)(), utf8); + QCOMPARE(to8Bit(utf16), utf8); + QCOMPARE(from8Bit(utf8), utf16); + + QCOMPARE(to8Bit(from8Bit(utf8)), utf8); + QCOMPARE(from8Bit(to8Bit(utf16)), utf16); + + // repeat with a longer message + utf8.prepend("12345678901234"); + utf16.prepend(QLatin1String("12345678901234")); + QCOMPARE(to8Bit(utf16), utf8); QCOMPARE(from8Bit(utf8), utf16); - QCOMPARE((from8Bit(utf8).*to8Bit)(), utf8); - QCOMPARE(from8Bit((utf16.*to8Bit)()), utf16); + QCOMPARE(to8Bit(from8Bit(utf8)), utf8); + QCOMPARE(from8Bit(to8Bit(utf16)), utf16); } void tst_Utf8::charByChar_data() diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index a58c7dfb4b..4f7ddce9c3 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 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. @@ -405,6 +405,13 @@ void tst_QFileSystemWatcher::removePaths() watcher.removePaths(paths); } +static QByteArray msgFileOperationFailed(const char *what, const QFile &f) +{ + return what + QByteArrayLiteral(" failed on \"") + + QDir::toNativeSeparators(f.fileName()).toLocal8Bit() + + QByteArrayLiteral("\": ") + f.errorString().toLocal8Bit(); +} + void tst_QFileSystemWatcher::watchFileAndItsDirectory() { QFETCH(QString, backend); @@ -420,14 +427,10 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() QString testFileName = testDir.filePath("testFile.txt"); QString secondFileName = testDir.filePath("testFile2.txt"); - QFile::remove(secondFileName); QFile testFile(testFileName); - testFile.setPermissions(QFile::ReadOwner | QFile::WriteOwner); - testFile.remove(); - - QVERIFY(testFile.open(QIODevice::WriteOnly | QIODevice::Truncate)); - testFile.write(QByteArray("hello")); + QVERIFY2(testFile.open(QIODevice::WriteOnly | QIODevice::Truncate), msgFileOperationFailed("open", testFile)); + QVERIFY2(testFile.write(QByteArrayLiteral("hello")) > 0, msgFileOperationFailed("write", testFile)); testFile.close(); QFileSystemWatcher watcher; @@ -449,8 +452,8 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() // wait before modifying the directory... QTest::qWait(2000); - QVERIFY(testFile.open(QIODevice::WriteOnly | QIODevice::Truncate)); - testFile.write(QByteArray("hello again")); + QVERIFY2(testFile.open(QIODevice::WriteOnly | QIODevice::Truncate), msgFileOperationFailed("open", testFile)); + QVERIFY2(testFile.write(QByteArrayLiteral("hello again")), msgFileOperationFailed("write", testFile)); testFile.close(); #ifdef Q_OS_MAC @@ -472,8 +475,8 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() fileChangedSpy.clear(); dirChangedSpy.clear(); QFile secondFile(secondFileName); - secondFile.open(QIODevice::WriteOnly | QIODevice::Truncate); - secondFile.write("Foo"); + QVERIFY2(secondFile.open(QIODevice::WriteOnly | QIODevice::Truncate), msgFileOperationFailed("open", secondFile)); + QVERIFY2(secondFile.write(QByteArrayLiteral("Foo")) > 0, msgFileOperationFailed("write", secondFile)); secondFile.close(); timer.start(3000); @@ -491,17 +494,17 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() dirChangedSpy.clear(); - QFile::remove(testFileName); + QVERIFY(QFile::remove(testFileName)); QTRY_VERIFY(fileChangedSpy.count() > 0); - QCOMPARE(dirChangedSpy.count(), 1); + QTRY_COMPARE(dirChangedSpy.count(), 1); fileChangedSpy.clear(); dirChangedSpy.clear(); // removing a deleted file should fail QVERIFY(!watcher.removePath(testFileName)); - QFile::remove(secondFileName); + QVERIFY(QFile::remove(secondFileName)); timer.start(3000); eventLoop.exec(); diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index 6e183f3212..cdcbd19ae8 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp @@ -1863,7 +1863,7 @@ void tst_QByteArray::reserve() QCOMPARE(qba.capacity(), capacity); QCOMPARE(copy.capacity(), capacity); - copy = qba; + qba = copy; qba.reserve(capacity * 2); QCOMPARE(qba.size(), capacity); QCOMPARE(qba.capacity(), capacity * 2); diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index 6ef9957fa1..e551d99959 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -48,6 +48,10 @@ #include <qpa/qwindowsysteminterface.h> #include <qgenericplugin.h> +#if defined(Q_OS_QNX) +#include <QOpenGLContext> +#endif + #include <QDebug> #include "tst_qcoreapplication.h" @@ -124,6 +128,9 @@ void tst_QGuiApplication::focusObject() const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry(); DummyWindow window1; +#if defined(Q_OS_QNX) + window1.setSurfaceType(QSurface::OpenGLSurface); +#endif window1.resize(windowSize, windowSize); window1.setTitle(QStringLiteral("focusObject:window1")); window1.setFramePosition(QPoint(screenGeometry.left() + spacing, screenGeometry.top() + spacing)); @@ -134,6 +141,15 @@ void tst_QGuiApplication::focusObject() window1.show(); +#if defined(Q_OS_QNX) // We either need to create a eglSurface or a create a backing store + // and then post the window in order for screen to show the window + QOpenGLContext context; + context.create(); + context.makeCurrent(&window1); + QTest::qWaitForWindowExposed(&window1); // Buffer swap only succeeds with exposed window + context.swapBuffers(&window1); +#endif + QSignalSpy spy(&app, SIGNAL(focusObjectChanged(QObject*))); @@ -279,15 +295,35 @@ void tst_QGuiApplication::changeFocusWindow() // focus is changed between FocusAboutToChange and FocusChanged FocusChangeWindow window1; +#if defined(Q_OS_QNX) + window1.setSurfaceType(QSurface::OpenGLSurface); +#endif window1.resize(windowSize, windowSize); window1.setFramePosition(QPoint(screenGeometry.left() + spacing, screenGeometry.top() + spacing)); window1.setTitle(QStringLiteral("changeFocusWindow:window1")); window1.show(); +#if defined(Q_OS_QNX) // We either need to create a eglSurface or a create a backing store + // and then post the window in order for screen to show the window + QOpenGLContext context; + context.create(); + context.makeCurrent(&window1); + QTest::qWaitForWindowExposed(&window1); // Buffer swap only succeeds with exposed window + context.swapBuffers(&window1); +#endif FocusChangeWindow window2; +#if defined(Q_OS_QNX) + window2.setSurfaceType(QSurface::OpenGLSurface); +#endif window2.resize(windowSize, windowSize); window2.setFramePosition(QPoint(screenGeometry.left() + 2 * spacing + windowSize, screenGeometry.top() + spacing)); window2.setTitle(QStringLiteral("changeFocusWindow:window2")); window2.show(); +#if defined(Q_OS_QNX) // We either need to create a eglSurface or a create a backing store + // and then post the window in order for screen to show the window + context.makeCurrent(&window2); + QTest::qWaitForWindowExposed(&window2); // Buffer swap only succeeds with exposed window + context.swapBuffers(&window2); +#endif QVERIFY(QTest::qWaitForWindowExposed(&window1)); QVERIFY(QTest::qWaitForWindowExposed(&window2)); window1.requestActivate(); diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index eefa85a745..589f3e66e1 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -88,6 +88,10 @@ private slots: void visibility(); void mask(); void initialSize(); + void modalDialog(); + void modalDialogClosingOneOfTwoModal(); + void modalWithChildWindow(); + void modalWindowModallity(); void initTestCase() { @@ -1316,6 +1320,115 @@ void tst_QWindow::initialSize() } } +void tst_QWindow::modalDialog() +{ + QWindow normalWindow; + normalWindow.resize(400, 400); + normalWindow.show(); + QVERIFY(QTest::qWaitForWindowExposed(&normalWindow)); + + QWindow dialog; + dialog.resize(200,200); + dialog.setModality(Qt::ApplicationModal); + dialog.setFlags(Qt::Dialog); + dialog.show(); + QVERIFY(QTest::qWaitForWindowExposed(&dialog)); + + normalWindow.requestActivate(); + + QGuiApplication::sync(); + QGuiApplication::processEvents(); + QTRY_COMPARE(QGuiApplication::focusWindow(), &dialog); +} + +void tst_QWindow::modalDialogClosingOneOfTwoModal() +{ + QWindow normalWindow; + normalWindow.resize(400, 400); + normalWindow.show(); + QVERIFY(QTest::qWaitForWindowExposed(&normalWindow)); + + QWindow first_dialog; + first_dialog.resize(200,200); + first_dialog.setModality(Qt::ApplicationModal); + first_dialog.setFlags(Qt::Dialog); + first_dialog.show(); + QVERIFY(QTest::qWaitForWindowExposed(&first_dialog)); + + { + QWindow second_dialog; + second_dialog.resize(200,200); + second_dialog.setModality(Qt::ApplicationModal); + second_dialog.setFlags(Qt::Dialog); + second_dialog.show(); + QVERIFY(QTest::qWaitForWindowExposed(&second_dialog)); + + QTRY_COMPARE(QGuiApplication::focusWindow(), &second_dialog); + + second_dialog.close(); + } + + QGuiApplication::sync(); + QGuiApplication::processEvents(); + QTRY_COMPARE(QGuiApplication::focusWindow(), &first_dialog); +} + +void tst_QWindow::modalWithChildWindow() +{ + QWindow normalWindow; + normalWindow.resize(400, 400); + normalWindow.show(); + QVERIFY(QTest::qWaitForWindowExposed(&normalWindow)); + + QWindow tlw_dialog; + tlw_dialog.resize(400,200); + tlw_dialog.setModality(Qt::ApplicationModal); + tlw_dialog.setFlags(Qt::Dialog); + tlw_dialog.create(); + + QWindow sub_window(&tlw_dialog); + sub_window.resize(200,300); + sub_window.show(); + + tlw_dialog.show(); + QVERIFY(QTest::qWaitForWindowExposed(&tlw_dialog)); + QVERIFY(QTest::qWaitForWindowExposed(&sub_window)); + + QTRY_COMPARE(QGuiApplication::focusWindow(), &tlw_dialog); + + sub_window.requestActivate(); + QGuiApplication::sync(); + QGuiApplication::processEvents(); + QTRY_COMPARE(QGuiApplication::focusWindow(), &sub_window); +} + +void tst_QWindow::modalWindowModallity() +{ + QWindow normal_window; + normal_window.resize(400, 400); + normal_window.show(); + QVERIFY(QTest::qWaitForWindowExposed(&normal_window)); + + QWindow parent_to_modal; + parent_to_modal.resize(400, 400); + parent_to_modal.show(); + QVERIFY(QTest::qWaitForWindowExposed(&parent_to_modal)); + QTRY_COMPARE(QGuiApplication::focusWindow(), &parent_to_modal); + + QWindow modal_dialog; + modal_dialog.resize(400,200); + modal_dialog.setModality(Qt::WindowModal); + modal_dialog.setFlags(Qt::Dialog); + modal_dialog.setTransientParent(&parent_to_modal); + modal_dialog.show(); + QVERIFY(QTest::qWaitForWindowExposed(&modal_dialog)); + QTRY_COMPARE(QGuiApplication::focusWindow(), &modal_dialog); + + normal_window.requestActivate(); + QTRY_COMPARE(QGuiApplication::focusWindow(), &normal_window); + +} + #include <tst_qwindow.moc> QTEST_MAIN(tst_QWindow) diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index e589d520cb..122ac63034 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -331,8 +331,8 @@ void tst_QTcpSocket::initTestCase_data() qDebug() << QtNetworkSettings::serverName(); QTest::newRow("WithoutProxy") << false << 0 << false; - QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy) << false; - QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic) << false; + //QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy) << false; ### temporarily disabled, QTBUG-38385 + //QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic) << false; ### temporarily disabled, QTBUG-38385 QTest::newRow("WithHttpProxy") << true << int(HttpProxy) << false; QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic) << false; @@ -340,8 +340,8 @@ void tst_QTcpSocket::initTestCase_data() #ifndef QT_NO_SSL QTest::newRow("WithoutProxy SSL") << false << 0 << true; - QTest::newRow("WithSocks5Proxy SSL") << true << int(Socks5Proxy) << true; - QTest::newRow("WithSocks5AuthProxy SSL") << true << int(Socks5Proxy | AuthBasic) << true; + //QTest::newRow("WithSocks5Proxy SSL") << true << int(Socks5Proxy) << true; ### temporarily disabled, QTBUG-38385 + //QTest::newRow("WithSocks5AuthProxy SSL") << true << int(Socks5Proxy | AuthBasic) << true; ### temporarily disabled, QTBUG-38385 QTest::newRow("WithHttpProxy SSL") << true << int(HttpProxy) << true; QTest::newRow("WithHttpProxyBasicAuth SSL") << true << int(HttpProxy | AuthBasic) << true; diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index baaf21e6bb..30a9e19138 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -273,10 +273,12 @@ void tst_QSslSocket::initTestCase_data() void tst_QSslSocket::initTestCase() { +#ifndef QT_NO_SSL qDebug("Using SSL library %s (%ld)", qPrintable(QSslSocket::sslLibraryVersionString()), QSslSocket::sslLibraryVersionNumber()); QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +#endif } void tst_QSslSocket::init() diff --git a/tests/auto/opengl/qglbuffer/tst_qglbuffer.cpp b/tests/auto/opengl/qglbuffer/tst_qglbuffer.cpp index 915f503b3f..a8a9deb25f 100644 --- a/tests/auto/opengl/qglbuffer/tst_qglbuffer.cpp +++ b/tests/auto/opengl/qglbuffer/tst_qglbuffer.cpp @@ -207,6 +207,10 @@ void tst_QGLBuffer::bufferSharing() QSKIP("Unreproducible timeout on Windows (MSVC/MinGW) CI bots"); #endif +#if defined(Q_OS_QNX) + QSKIP("Crashes on QNX when destroying the second QGLWidget (see QTBUG-38275)"); +#endif + QGLWidget *w1 = new QGLWidget(); w1->makeCurrent(); diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index fcc5581bea..1cc79f643a 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -3283,7 +3283,7 @@ void tst_QAccessibility::comboBoxTest() QVERIFY(!combo.view()->isVisible()); QVERIFY(iface->actionInterface()); - QCOMPARE(iface->actionInterface()->actionNames(), QStringList() << QAccessibleActionInterface::showMenuAction()); + QCOMPARE(iface->actionInterface()->actionNames(), QStringList() << QAccessibleActionInterface::showMenuAction() << QAccessibleActionInterface::pressAction()); iface->actionInterface()->doAction(QAccessibleActionInterface::showMenuAction()); QTRY_VERIFY(combo.view()->isVisible()); diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index 55cb67eed9..824f042ffc 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -195,6 +195,9 @@ private slots: void task_233829_data() { generic_data("QPSQL"); } void task_233829(); + void QTBUG_12477_data() { generic_data("QPSQL"); } + void QTBUG_12477(); + void sqlServerReturn0_data() { generic_data(); } void sqlServerReturn0(); @@ -1247,6 +1250,26 @@ void tst_QSqlQuery::seek() QVERIFY( q.seek( 0 ) ); QCOMPARE( q.at(), 0 ); QCOMPARE( q.value( 0 ).toInt(), 1 ); + + QVERIFY(!q.seek(QSql::BeforeFirstRow)); + QCOMPARE(q.at(), int(QSql::BeforeFirstRow)); + QVERIFY(q.seek(1, true)); + QCOMPARE(q.at(), 0); + QCOMPARE(q.value(0).toInt(), 1); + + qint32 count = 1; + while (q.next()) ++count; + + QCOMPARE(q.at(), int(QSql::AfterLastRow)); + + if (!q.isForwardOnly()) { + QVERIFY(q.seek(-1, true)); + QCOMPARE(q.at(), count - 1); + QCOMPARE(q.value(0).toInt(), count); + } else { + QVERIFY(!q.seek(-1, true)); + QCOMPARE(q.at(), int(QSql::AfterLastRow)); + } } void tst_QSqlQuery::seekForwardOnlyQuery() @@ -2992,6 +3015,47 @@ void tst_QSqlQuery::task_233829() QVERIFY_SQL(q,exec()); } +void tst_QSqlQuery::QTBUG_12477() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + if (!db.driverName().startsWith("QPSQL")) + QSKIP("PostgreSQL specific test"); + + QSqlQuery q(db); + QVERIFY_SQL(q, exec("SELECT 1::bit, '10101010000111101101'::varbit, " + "'10101111011'::varbit(15), '22222.20'::numeric(16,2), " + "'333333'::numeric(18), '444444'::numeric")); + QVERIFY_SQL(q, next()); + QSqlRecord r = q.record(); + QSqlField f; + + f = r.field(0); + QCOMPARE(f.length(), 1); + QCOMPARE(f.precision(), -1); + + f = r.field(1); + QCOMPARE(f.length(), -1); + QCOMPARE(f.precision(), -1); + + f = r.field(2); + QCOMPARE(f.length(), 15); + QCOMPARE(f.precision(), -1); + + f = r.field(3); + QCOMPARE(f.length(), 16); + QCOMPARE(f.precision(), 2); + + f = r.field(4); + QCOMPARE(f.length(), 18); + QCOMPARE(f.precision(), 0); + + f = r.field(5); + QCOMPARE(f.length(), -1); + QCOMPARE(f.precision(), -1); +} + void tst_QSqlQuery::sqlServerReturn0() { QFETCH( QString, dbName ); diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index d360a646f1..047df0d3f2 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 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. @@ -43,6 +43,7 @@ #include <QtTest/QtTest> #include <qcoreapplication.h> +#include <qfile.h> #include <qdebug.h> #include <qsharedpointer.h> #include <qfiledialog.h> @@ -72,6 +73,7 @@ #include <QFileSystemModel> #if defined(Q_OS_UNIX) +#include <unistd.h> // for pathconf() on OS X #ifdef QT_BUILD_INTERNAL QT_BEGIN_NAMESPACE extern Q_GUI_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded = 0); @@ -79,6 +81,19 @@ QT_END_NAMESPACE #endif #endif +static inline bool isCaseSensitiveFileSystem(const QString &path) +{ + Q_UNUSED(path) +#if defined(Q_OS_MAC) + return pathconf(QFile::encodeName(path).constData(), _PC_CASE_SENSITIVE); +#elif defined(Q_OS_WIN) + return false; +#else + return true; +#endif +} + + class QNonNativeFileDialog : public QFileDialog { Q_OBJECT @@ -130,6 +145,7 @@ private slots: void selectFile_data(); void selectFile(); void selectFiles(); + void selectFileWrongCaseSaveAs(); void selectFilter(); void viewMode(); void proxymodel(); @@ -147,6 +163,7 @@ private slots: void clearLineEdit(); void enableChooseButton(); void widgetlessNativeDialog(); + void selectedFilesWithoutWidgets(); void trailingDotsAndSpaces(); #ifdef Q_OS_UNIX #ifdef QT_BUILD_INTERNAL @@ -857,36 +874,59 @@ void tst_QFiledialog::selectFile() { QFETCH(QString, file); QFETCH(int, count); - QNonNativeFileDialog fd; - QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model"); + QScopedPointer<QNonNativeFileDialog> fd(new QNonNativeFileDialog); + QFileSystemModel *model = fd->findChild<QFileSystemModel*>("qt_filesystem_model"); QVERIFY(model); - fd.setDirectory(QDir::currentPath()); + fd->setDirectory(QDir::currentPath()); // default value - QCOMPARE(fd.selectedFiles().count(), 1); + QCOMPARE(fd->selectedFiles().count(), 1); - QTemporaryFile tempFile(QDir::tempPath() + "/aXXXXXX"); - bool inTemp = (file == "temp"); - if (inTemp) { - tempFile.open(); - file = tempFile.fileName(); + QScopedPointer<QTemporaryFile> tempFile; + if (file == QLatin1String("temp")) { + tempFile.reset(new QTemporaryFile(QDir::tempPath() + QStringLiteral("/aXXXXXX"))); + QVERIFY(tempFile->open()); + file = tempFile->fileName(); } - fd.selectFile(file); - QCOMPARE(fd.selectedFiles().count(), count); - if (inTemp) { - QCOMPARE(model->index(fd.directory().path()), model->index(QDir::tempPath())); + fd->selectFile(file); + QCOMPARE(fd->selectedFiles().count(), count); + if (tempFile.isNull()) { + QCOMPARE(model->index(fd->directory().path()), model->index(QDir::currentPath())); } else { - QCOMPARE(model->index(fd.directory().path()), model->index(QDir::currentPath())); + QCOMPARE(model->index(fd->directory().path()), model->index(QDir::tempPath())); } + fd.reset(); // Ensure the file dialog let's go of the temporary file for "temp". +} + +void tst_QFiledialog::selectFileWrongCaseSaveAs() +{ + const QString home = QDir::homePath(); + if (isCaseSensitiveFileSystem(home)) + QSKIP("This test is intended for case-insensitive file systems only."); + // QTBUG-38162: when passing a wrongly capitalized path to selectFile() + // on a case-insensitive file system, the line edit should only + // contain the file name ("c:\PRogram files\foo.txt" -> "foo.txt"). + const QString fileName = QStringLiteral("foo.txt"); + const QString path = home + QLatin1Char('/') + fileName; + QString wrongCasePath = path; + for (int c = 0; c < wrongCasePath.size(); c += 2) + wrongCasePath[c] = wrongCasePath.at(c).isLower() ? wrongCasePath.at(c).toUpper() : wrongCasePath.at(c).toLower(); + QNonNativeFileDialog fd(0, "QTBUG-38162", wrongCasePath); + fd.setAcceptMode(QFileDialog::AcceptSave); + fd.selectFile(wrongCasePath); + const QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit"); + QVERIFY(lineEdit); + QCOMPARE(lineEdit->text().compare(fileName, Qt::CaseInsensitive), 0); } void tst_QFiledialog::selectFiles() { - QNonNativeFileDialog fd; - fd.setViewMode(QFileDialog::List); QTemporaryDir tempDir; QVERIFY(tempDir.isValid()); const QString tempPath = tempDir.path(); + { + QNonNativeFileDialog fd; + fd.setViewMode(QFileDialog::List); fd.setDirectory(tempPath); QSignalSpy spyCurrentChanged(&fd, SIGNAL(currentChanged(QString))); QSignalSpy spyDirectoryEntered(&fd, SIGNAL(directoryEntered(QString))); @@ -931,17 +971,20 @@ void tst_QFiledialog::selectFiles() QCOMPARE(spyFilesSelected.count(), 0); QCOMPARE(spyFilterSelected.count(), 0); - //If the selection is invalid then we fill the line edit but without the / - QNonNativeFileDialog * dialog = new QNonNativeFileDialog( 0, "Save" ); - dialog->setFileMode( QFileDialog::AnyFile ); - dialog->setAcceptMode( QFileDialog::AcceptSave ); - dialog->selectFile(tempPath + QStringLiteral("/blah")); - dialog->show(); - QVERIFY(QTest::qWaitForWindowExposed(dialog)); - QLineEdit *lineEdit = dialog->findChild<QLineEdit*>("fileNameEdit"); - QVERIFY(lineEdit); - QCOMPARE(lineEdit->text(),QLatin1String("blah")); - delete dialog; + } + + { + //If the selection is invalid then we fill the line edit but without the / + QNonNativeFileDialog dialog( 0, "Save" ); + dialog.setFileMode( QFileDialog::AnyFile ); + dialog.setAcceptMode( QFileDialog::AcceptSave ); + dialog.selectFile(tempPath + QStringLiteral("/blah")); + dialog.show(); + QVERIFY(QTest::qWaitForWindowExposed(&dialog)); + QLineEdit *lineEdit = dialog.findChild<QLineEdit*>("fileNameEdit"); + QVERIFY(lineEdit); + QCOMPARE(lineEdit->text(),QLatin1String("blah")); + } } void tst_QFiledialog::viewMode() @@ -1321,6 +1364,14 @@ void tst_QFiledialog::widgetlessNativeDialog() QVERIFY(!button); } +void tst_QFiledialog::selectedFilesWithoutWidgets() +{ + // Test for a crash when widgets are not instantiated yet. + QFileDialog fd; + fd.setAcceptMode(QFileDialog::AcceptOpen); + QVERIFY(fd.selectedFiles().size() >= 0); +} + void tst_QFiledialog::trailingDotsAndSpaces() { #ifndef Q_OS_WIN diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index 9e0446388e..3925090465 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 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. @@ -476,13 +476,19 @@ void tst_QFileSystemModel::rowCount() void tst_QFileSystemModel::rowsInserted_data() { QTest::addColumn<int>("count"); - QTest::addColumn<int>("assending"); + QTest::addColumn<int>("ascending"); for (int i = 0; i < 4; ++i) { QTest::newRow(QString("Qt::AscendingOrder %1").arg(i).toLocal8Bit().constData()) << i << (int)Qt::AscendingOrder; QTest::newRow(QString("Qt::DescendingOrder %1").arg(i).toLocal8Bit().constData()) << i << (int)Qt::DescendingOrder; } } +static inline QString lastEntry(const QModelIndex &root) +{ + const QAbstractItemModel *model = root.model(); + return model->index(model->rowCount(root) - 1, 0, root).data().toString(); +} + void tst_QFileSystemModel::rowsInserted() { #if defined(Q_OS_WINCE) @@ -492,9 +498,9 @@ void tst_QFileSystemModel::rowsInserted() rowCount(); QModelIndex root = model->index(model->rootPath()); - QFETCH(int, assending); + QFETCH(int, ascending); QFETCH(int, count); - model->sort(0, (Qt::SortOrder)assending); + model->sort(0, (Qt::SortOrder)ascending); QSignalSpy spy0(model, SIGNAL(rowsInserted(QModelIndex,int,int))); QSignalSpy spy1(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int))); @@ -505,7 +511,6 @@ void tst_QFileSystemModel::rowsInserted() QVERIFY(createFiles(tmp, files, 5)); TRY_WAIT(model->rowCount(root) == oldCount + count); QTRY_COMPARE(model->rowCount(root), oldCount + count); - QTest::qWait(100); // Let the sort settle. int totalRowsInserted = 0; for (int i = 0; i < spy0.count(); ++i) { int start = spy0[i].value(1).toInt(); @@ -513,12 +518,9 @@ void tst_QFileSystemModel::rowsInserted() totalRowsInserted += end - start + 1; } QCOMPARE(totalRowsInserted, count); - if (assending == (Qt::SortOrder)Qt::AscendingOrder) { - QString letter = model->index(model->rowCount(root) - 1, 0, root).data().toString(); - QCOMPARE(letter, QString("j")); - } else { - QCOMPARE(model->index(model->rowCount(root) - 1, 0, root).data().toString(), QString("b")); - } + const QString expected = ascending == Qt::AscendingOrder ? QStringLiteral("j") : QStringLiteral("b"); + QTRY_COMPARE(lastEntry(root), expected); + if (spy0.count() > 0) { if (count == 0) QCOMPARE(spy0.count(), 0); @@ -548,8 +550,8 @@ void tst_QFileSystemModel::rowsRemoved() QModelIndex root = model->index(model->rootPath()); QFETCH(int, count); - QFETCH(int, assending); - model->sort(0, (Qt::SortOrder)assending); + QFETCH(int, ascending); + model->sort(0, (Qt::SortOrder)ascending); QTest::qWait(WAITTIME); QSignalSpy spy0(model, SIGNAL(rowsRemoved(QModelIndex,int,int))); diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index 4c07b48c00..a932a2e859 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -2605,6 +2605,9 @@ void tst_QWizard::task161658_alignments() void tst_QWizard::task177022_setFixedSize() { +#ifdef Q_OS_BLACKBERRY + QSKIP("Window is forced fullscreen"); +#endif int width = 300; int height = 200; QWizard wiz; @@ -2622,7 +2625,7 @@ void tst_QWizard::task177022_setFixedSize() QCOMPARE(wiz.maximumWidth(), width); QCOMPARE(wiz.maximumHeight(), height); - wiz.show(); + wiz.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&wiz)); QCOMPARE(wiz.size(), QSize(width, height)); diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 5b178903cf..8f57eca0a7 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -2502,9 +2502,6 @@ void tst_QGraphicsProxyWidget::popup_basic() void tst_QGraphicsProxyWidget::popup_subwidget() { -#ifdef Q_OS_WIN - QSKIP("This test crashes on Windows, QTBUG-33213"); -#endif QGroupBox *groupBox = new QGroupBox; groupBox->setTitle("GroupBox"); groupBox->setCheckable(true); @@ -3183,10 +3180,6 @@ void tst_QGraphicsProxyWidget::actionsContextMenu() void tst_QGraphicsProxyWidget::deleteProxyForChildWidget() { -#if defined(Q_OS_WIN) - QSKIP("This test is crashing on windows, it needs to be fixed. QTBUG-29684"); -#endif - QDialog dialog; dialog.resize(320, 120); dialog.move(80, 40); diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 83c4582645..daca1d1516 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -1257,7 +1257,7 @@ void tst_QAbstractItemView::task250754_fontChange() tree.setModel(m); tree.setHeaderHidden(true); // The header is (in certain styles) dpi dependent - w.resize(160, 300); // Minimum width for windows with frame on Windows 8 + w.resize(160, 350); // Minimum width for windows with frame on Windows 8 centerOnScreen(&w); moveCursorAway(&w); w.showNormal(); diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 0579914940..77690cc27a 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -2488,7 +2488,7 @@ void tst_QTreeView::extendedSelection_data() QTest::addColumn<int>("selectedCount"); QTest::newRow("select") << QPoint(10, 10) << 2; - QTest::newRow("unselect") << QPoint(10, 150) << 0; + QTest::newRow("unselect") << QPoint(10, 300) << 0; } void tst_QTreeView::extendedSelection() @@ -2499,7 +2499,7 @@ void tst_QTreeView::extendedSelection() QStandardItemModel model(5, 2); QWidget topLevel; QTreeView view(&topLevel); - view.resize(qMax(mousePressPos.x() * 2, 200), qMax(mousePressPos.y() * 2, 200)); + view.resize(qMax(mousePressPos.x() * 2, 300), qMax(mousePressPos.y() * 2, 350)); view.setModel(&model); view.setSelectionMode(QAbstractItemView::ExtendedSelection); topLevel.show(); diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 509ccc37b6..abc0129f8b 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -2064,7 +2064,7 @@ void tst_QComboBox::itemListPosition() topLevel.move(screen.width() - topLevel.sizeHint().width() - 10, 0); //puts the combo to the top-right corner - topLevel.show(); + topLevel.showNormal(); //wait because the window manager can move the window if there is a right panel QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); @@ -2232,7 +2232,7 @@ void tst_QComboBox::task190205_setModelAdjustToContents() box.move(100, 100); box.setSizeAdjustPolicy(QComboBox::AdjustToContents); box.addItems(initialContent); - box.show(); + box.showNormal(); //wait needed in order to get the combo initial size QTRY_VERIFY(box.isVisible()); @@ -2244,7 +2244,7 @@ void tst_QComboBox::task190205_setModelAdjustToContents() correctBox.move(400, 100); correctBox.addItems(finalContent); - correctBox.show(); + correctBox.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&box)); QVERIFY(QTest::qWaitForWindowExposed(&correctBox)); @@ -2266,7 +2266,7 @@ void tst_QComboBox::task248169_popupWithMinimalSize() comboBox.setGeometry(desktopSize.width() - (desktopSize.width() / 4), (desktopSize.width() / 4), (desktopSize.width() / 2), (desktopSize.width() / 4)); - comboBox.show(); + comboBox.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&comboBox)); QTRY_VERIFY(comboBox.isVisible()); comboBox.showPopup(); @@ -2274,7 +2274,7 @@ void tst_QComboBox::task248169_popupWithMinimalSize() QTest::qWaitForWindowExposed(comboBox.view()); QTRY_VERIFY(comboBox.view()->isVisible()); -#ifdef QT_BUILD_INTERNAL +#if defined QT_BUILD_INTERNAL && !defined Q_OS_BLACKBERRY QFrame *container = comboBox.findChild<QComboBoxPrivateContainer *>(); QVERIFY(container); QTRY_VERIFY(desktop.screenGeometry(container).contains(container->geometry())); @@ -2609,7 +2609,7 @@ void tst_QComboBox::keyBoardNavigationWithMouse() for (int i = 0; i < 80; i++) combo.addItem( QString::number(i)); - combo.show(); + combo.showNormal(); centerCursor(&combo); // QTBUG-33973, cursor needs to be within view from start on Mac. QApplication::setActiveWindow(&combo); QVERIFY(QTest::qWaitForWindowActive(&combo)); @@ -2629,7 +2629,7 @@ void tst_QComboBox::keyBoardNavigationWithMouse() QCOMPARE(combo.currentText(), QLatin1String("0")); // When calling cursor function, Windows CE responds with: This function is not supported on this system. -#ifndef Q_OS_WINCE +#if !defined Q_OS_WINCE && !defined Q_OS_QNX // Force cursor movement to prevent QCursor::setPos() from returning prematurely on QPA: centerCursor(combo.view()); QTest::qWait(200); diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp index 6551a88232..095fa3347d 100644 --- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp @@ -801,13 +801,16 @@ void tst_QDockWidget::task237438_setFloatingCrash() void tst_QDockWidget::task248604_infiniteResize() { +#if defined Q_OS_BLACKBERRY + QSKIP("Top level window is stretched to fullscreen"); +#endif QDockWidget d; QTabWidget *t = new QTabWidget; t->addTab(new QWidget, "Foo"); d.setWidget(t); d.setContentsMargins(2, 2, 2, 2); d.setMinimumSize(320, 240); - d.show(); + d.showNormal(); QTest::qWait(400); QCOMPARE(d.size(), QSize(320, 240)); } diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp index 6784ee477b..6b763f5a4c 100644 --- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp @@ -825,6 +825,8 @@ void tst_QDoubleSpinBox::editingFinished() QCOMPARE(editingFinishedSpy1.count(), 4); QCOMPARE(editingFinishedSpy2.count(), 4); + testFocusWidget->show(); // On BlackBerry this is our root window we need to show it again + // otherwise subsequent tests will fail } void tst_QDoubleSpinBox::removeAll() diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 077e1aa1df..36f14cb1ba 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -1322,7 +1322,7 @@ void tst_QLineEdit::undo_keypressevents_data() // unselect any current selection keys.addKeyClick(Qt::Key_Right); -#ifdef Q_OS_WIN //Mac has a specialcase to handle jumping to the end of a selection +#if defined Q_OS_WIN || defined Q_OS_QNX //Windows and QNX do not jump to the beginning of the selection keys.addKeyClick(Qt::Key_Left); #endif @@ -3206,7 +3206,7 @@ void tst_QLineEdit::leftKeyOnSelectedText() QCOMPARE(testWidget->cursorPosition(), 2); QCOMPARE(testWidget->selectedText(), QString("23")); QTest::keyClick(testWidget, Qt::Key_Left); -#ifdef Q_OS_WIN +#if defined Q_OS_WIN || defined Q_OS_QNX QCOMPARE(testWidget->cursorPosition(), 1); #else // Selection is cleared ands cursor remains at position 2. diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index bc2e4caacd..59021108a2 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -1007,7 +1007,7 @@ void tst_QMdiArea::activeSubWindow() qApp->setActiveWindow(&mainWindow); QCOMPARE(mdiArea->activeSubWindow(), subWindow); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WIN) +#if !defined(Q_OS_MAC) && !defined(Q_OS_WIN) && !defined(Q_OS_QNX) qApp->setActiveWindow(0); QVERIFY(!mdiArea->activeSubWindow()); #endif @@ -1088,7 +1088,7 @@ void tst_QMdiArea::currentSubWindow() QVERIFY(mdiArea.activeSubWindow()); QVERIFY(mdiArea.currentSubWindow()); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WIN) +#if !defined(Q_OS_MAC) && !defined(Q_OS_WIN) && !defined(Q_OS_QNX) qApp->setActiveWindow(0); QVERIFY(!mdiArea.activeSubWindow()); QVERIFY(mdiArea.currentSubWindow()); @@ -1701,7 +1701,7 @@ void tst_QMdiArea::tileSubWindows() qApp->processEvents(); QTRY_COMPARE(workspace.size(), QSize(350, 150)); - const QSize minSize(300, 100); + const QSize minSize(600, 130); foreach (QMdiSubWindow *subWindow, workspace.subWindowList()) subWindow->setMinimumSize(minSize); @@ -1908,6 +1908,9 @@ void tst_QMdiArea::dontMaximizeSubWindowOnActivation() for (int i = 0; i < 5; ++i) { QMdiSubWindow *window = mdiArea.addSubWindow(new QWidget); window->show(); +#if defined Q_OS_QNX + QEXPECT_FAIL("", "QTBUG-38231", Abort); +#endif QVERIFY(window->isMaximized()); qApp->processEvents(); } diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index 268638a504..ffc3e3b67d 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -206,6 +206,7 @@ private slots: void task_233197(); void task_226929(); void styleChange(); + void testFullScreenState(); }; void tst_QMdiSubWindow::initTestCase() @@ -2007,6 +2008,19 @@ void tst_QMdiSubWindow::styleChange() QCOMPARE(spy.count(), 0); } +void tst_QMdiSubWindow::testFullScreenState() +{ + QMdiArea mdiArea; + mdiArea.showMaximized(); + + QMdiSubWindow *subWindow = mdiArea.addSubWindow(new QWidget); + subWindow->setGeometry(0, 0, 300, 300); + subWindow->showFullScreen(); // QMdiSubWindow does not support the fullscreen state. This call + // should be equivalent to setVisible(true) (and not showNormal()) + QVERIFY(QTest::qWaitForWindowExposed(&mdiArea)); + QCOMPARE(subWindow->size(), QSize(300, 300)); +} + QTEST_MAIN(tst_QMdiSubWindow) #include "tst_qmdisubwindow.moc" |