summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp152
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp28
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp5
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp7
-rw-r--r--tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp33
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp36
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp148
-rw-r--r--tests/auto/widgets/styles/styles.pro2
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp14
-rw-r--r--tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp5
-rw-r--r--tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp2
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp4
-rw-r--r--tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp9
-rw-r--r--tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp14
15 files changed, 333 insertions, 128 deletions
diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
index d360a646f1..096658ae02 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
@@ -154,6 +171,7 @@ private slots:
void tildeExpansion();
#endif // QT_BUILD_INTERNAL
#endif
+ void getFileUrl();
private:
QByteArray userSettings;
@@ -857,36 +875,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 +972,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 +1365,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
@@ -1378,5 +1430,49 @@ void tst_QFiledialog::tildeExpansion()
#endif // QT_BUILD_INTERNAL
#endif
+class DialogRejecter : public QObject
+{
+ Q_OBJECT
+public:
+ DialogRejecter()
+ {
+ QTimer *timer = new QTimer(this);
+ timer->setInterval(1000);
+ connect(timer, &QTimer::timeout, this, &DialogRejecter::rejectFileDialog);
+ timer->start();
+ }
+
+public slots:
+ void rejectFileDialog()
+ {
+ if (QWidget *w = QApplication::activeModalWidget())
+ if (QDialog *d = qobject_cast<QDialog *>(w))
+ d->reject();
+ }
+};
+
+void tst_QFiledialog::getFileUrl()
+{
+ // QTBUG-38672 , static functions should return empty Urls
+ const QFileDialog::Options options = QFileDialog::DontUseNativeDialog;
+ DialogRejecter dr;
+
+ QUrl url = QFileDialog::getOpenFileUrl(0, QStringLiteral("getOpenFileUrl"),
+ QUrl(), QString(), Q_NULLPTR, options);
+ QVERIFY(url.isEmpty());
+ QVERIFY(!url.isValid());
+
+ url = QFileDialog::getExistingDirectoryUrl(0, QStringLiteral("getExistingDirectoryUrl"),
+ QUrl(), options | QFileDialog::ShowDirsOnly);
+ QVERIFY(url.isEmpty());
+ QVERIFY(!url.isValid());
+
+ url = QFileDialog::getSaveFileUrl(0, QStringLiteral("getSaveFileUrl"),
+ QUrl(), QString(), Q_NULLPTR, options);
+ QVERIFY(url.isEmpty());
+ QVERIFY(!url.isValid());
+
+}
+
QTEST_MAIN(tst_QFiledialog)
#include "tst_qfiledialog.moc"
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..d12fb06daa 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.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.
@@ -261,6 +261,7 @@ private slots:
void taskQTBUG_18539_emitLayoutChanged();
void taskQTBUG_8176_emitOnExpandAll();
void taskQTBUG_34717_collapseAtBottom();
+ void taskQTBUG_37813_crash();
void testInitialFocus();
};
@@ -2488,7 +2489,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 +2500,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();
@@ -4327,5 +4328,31 @@ void tst_QTreeView::quickExpandCollapse()
}
#endif
+void tst_QTreeView::taskQTBUG_37813_crash()
+{
+ // QTBUG_37813: Crash in visual / logical index mapping in QTreeViewPrivate::adjustViewOptionsForIndex()
+ // when hiding/moving columns. It is reproduceable with a QTreeWidget only.
+#ifdef QT_BUILD_INTERNAL
+ QTreeWidget treeWidget;
+ treeWidget.setDragEnabled(true);
+ treeWidget.setColumnCount(2);
+ QList<QTreeWidgetItem *> items;
+ for (int r = 0; r < 2; ++r) {
+ QTreeWidgetItem *item = new QTreeWidgetItem();
+ for (int c = 0; c < treeWidget.columnCount(); ++c)
+ item->setText(c, QString::fromLatin1("Row %1 Column %2").arg(r).arg(c));
+ items.append(item);
+ }
+ treeWidget.addTopLevelItems(items);
+ treeWidget.setColumnHidden(0, true);
+ treeWidget.header()->moveSection(0, 1);
+ QItemSelection sel(treeWidget.model()->index(0, 0), treeWidget.model()->index(0, 1));
+ QRect rect;
+ QAbstractItemViewPrivate *av = static_cast<QAbstractItemViewPrivate*>(qt_widget_private(&treeWidget));
+ const QPixmap pixmap = av->renderToPixmap(sel.indexes(), &rect);
+ QVERIFY(pixmap.size().isValid());
+#endif // QT_BUILD_INTERNAL
+}
+
QTEST_MAIN(tst_QTreeView)
#include "tst_qtreeview.moc"
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index dd3d041f56..2a70431223 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -4631,32 +4631,28 @@ void tst_QWidget::windowMoveResize()
QTest::qWait(10);
QTRY_COMPARE(widget.pos(), rect.topLeft());
- if (m_platform == QStringLiteral("windows")) {
- QEXPECT_FAIL("130,100 0x200, flags 0", "QTBUG-26424", Continue);
- QEXPECT_FAIL("130,50 0x0, flags 0", "QTBUG-26424", Continue);
- }
- QTRY_COMPARE(widget.size(), rect.size());
+ // Windows: Minimum size of decorated windows.
+ const bool expectResizeFail = (!windowFlags && (rect.width() < 160 || rect.height() < 40))
+ && m_platform == QStringLiteral("windows");
+ if (!expectResizeFail)
+ QTRY_COMPARE(widget.size(), rect.size());
// move() while shown
foreach (const QRect &r, rects) {
- if (m_platform == QStringLiteral("xcb")
- && ((widget.width() == 0 || widget.height() == 0) && r.width() != 0 && r.height() != 0)) {
- QEXPECT_FAIL("130,100 0x200, flags 0",
- "First resize after show of zero-sized gets wrong win_gravity.",
- Continue);
- QEXPECT_FAIL("100,50 200x0, flags 0",
- "First resize after show of zero-sized gets wrong win_gravity.",
- Continue);
- QEXPECT_FAIL("130,50 0x0, flags 0",
- "First resize after show of zero-sized gets wrong win_gravity.",
- Continue);
- }
-
+ // XCB: First resize after show of zero-sized gets wrong win_gravity.
+ const bool expectMoveFail = !windowFlags
+ && ((widget.width() == 0 || widget.height() == 0) && r.width() != 0 && r.height() != 0)
+ && m_platform == QStringLiteral("xcb")
+ && (rect == QRect(QPoint(130, 100), QSize(0, 200))
+ || rect == QRect(QPoint(100, 50), QSize(200, 0))
+ || rect == QRect(QPoint(130, 50), QSize(0, 0)));
widget.move(r.topLeft());
widget.resize(r.size());
QApplication::processEvents();
- QTRY_COMPARE(widget.pos(), r.topLeft());
- QTRY_COMPARE(widget.size(), r.size());
+ if (!expectMoveFail) {
+ QTRY_COMPARE(widget.pos(), r.topLeft());
+ QTRY_COMPARE(widget.size(), r.size());
+ }
}
widget.move(rect.topLeft());
widget.resize(rect.size());
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 5a36ffc671..14d59d3630 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -49,6 +49,12 @@
#include "../../../qtest-config.h"
+static inline void centerOnScreen(QWidget *w)
+{
+ const QPoint offset = QPoint(w->width() / 2, w->height() / 2);
+ w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
+}
+
class tst_QStyleSheetStyle : public QObject
{
Q_OBJECT
@@ -142,6 +148,8 @@ tst_QStyleSheetStyle::~tst_QStyleSheetStyle()
void tst_QStyleSheetStyle::numinstances()
{
QWidget w;
+ w.resize(200, 200);
+ centerOnScreen(&w);
QCommonStyle *style = new QCommonStyle;
style->setParent(&w);
QWidget c(&w);
@@ -531,7 +539,14 @@ void tst_QStyleSheetStyle::dynamicProperty()
qApp->setStyleSheet(QString());
QString appStyle = qApp->style()->metaObject()->className();
- QPushButton pb1, pb2;
+ QPushButton pb1(QStringLiteral("dynamicProperty_pb1"));
+ pb1.setMinimumWidth(160);
+ pb1.move(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(20, 100));
+
+ QPushButton pb2(QStringLiteral("dynamicProperty_pb2"));
+ pb2.setMinimumWidth(160);
+ pb2.move(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(20, 200));
+
pb1.setProperty("type", "critical");
qApp->setStyleSheet("*[class~=\"QPushButton\"] { color: red; } *[type=\"critical\"] { background: white; }");
QVERIFY(COLOR(pb1) == Qt::red);
@@ -675,6 +690,8 @@ void tst_QStyleSheetStyle::onWidgetDestroyed()
void tst_QStyleSheetStyle::fontPrecedence()
{
QLineEdit edit;
+ edit.setMinimumWidth(200);
+ centerOnScreen(&edit);
edit.show();
QFont font;
QVERIFY(FONTSIZE(edit) != 22); // Sanity check to make sure this test makes sense.
@@ -737,8 +754,9 @@ void tst_QStyleSheetStyle::focusColors()
// ten pixels of the right color requires quite a many characters, as the
// majority of the pixels will have slightly different colors due to the
// anti-aliasing effect.
-#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) && !(defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL))
- QSKIP("This is a fragile test which fails on many esoteric platforms because of focus problems. "
+#if !defined(Q_OS_WIN32) && !(defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL))
+ QSKIP("This is a fragile test which fails on many esoteric platforms because of focus problems"
+ " (for example, QTBUG-33959)."
"That doesn't mean that the feature doesn't work in practice.");
#endif
QList<QWidget *> widgets;
@@ -768,6 +786,7 @@ void tst_QStyleSheetStyle::focusColors()
layout->addWidget(widget);
frame.setLayout(layout);
+ centerOnScreen(&frame);
frame.show();
QApplication::setActiveWindow(&frame);
QVERIFY(QTest::qWaitForWindowActive(&frame));
@@ -795,6 +814,9 @@ void tst_QStyleSheetStyle::focusColors()
#ifndef QTEST_NO_CURSOR
void tst_QStyleSheetStyle::hoverColors()
{
+#ifdef Q_OS_OSX
+ QSKIP("This test is fragile on Mac, most likely due to QTBUG-33959.");
+#endif
QList<QWidget *> widgets;
widgets << new QPushButton("TESTING TESTING");
widgets << new QLineEdit("TESTING TESTING");
@@ -822,31 +844,22 @@ void tst_QStyleSheetStyle::hoverColors()
layout->addWidget(widget);
frame.setLayout(layout);
+ centerOnScreen(&frame);
frame.show();
QApplication::setActiveWindow(&frame);
QVERIFY(QTest::qWaitForWindowActive(&frame));
//move the mouse inside the widget, it should be colored
QTest::mouseMove ( widget, QPoint(6,6));
- QTest::qWait(60);
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "Numerous failures related to Qt::WA_UnderMouse, see QTBUGT-23685", Continue);
-#endif
- QVERIFY(widget->testAttribute(Qt::WA_UnderMouse));
+ QTRY_VERIFY(widget->testAttribute(Qt::WA_UnderMouse));
QImage image(frame.width(), frame.height(), QImage::Format_ARGB32);
frame.render(&image);
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "Numerous failures related to Qt::WA_UnderMouse, see QTBUGT-23685", Continue);
-#endif
QVERIFY2(testForColors(image, QColor(0xe8, 0xff, 0x66)),
(QString::fromLatin1(widget->metaObject()->className())
+ " did not contain background color #e8ff66").toLocal8Bit().constData());
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "Numerous failures related to Qt::WA_UnderMouse, see QTBUGT-23685", Continue);
-#endif
QVERIFY2(testForColors(image, QColor(0xff, 0x00, 0x84)),
(QString::fromLatin1(widget->metaObject()->className())
+ " did not contain text color #ff0084").toLocal8Bit().constData());
@@ -866,9 +879,7 @@ void tst_QStyleSheetStyle::hoverColors()
//move the mouse again inside the widget, it should be colored
QTest::mouseMove (widget, QPoint(5,5));
- QTest::qWait(60);
-
- QVERIFY(widget->testAttribute(Qt::WA_UnderMouse));
+ QTRY_VERIFY(widget->testAttribute(Qt::WA_UnderMouse));
frame.render(&image);
@@ -904,35 +915,47 @@ public:
void tst_QStyleSheetStyle::background()
{
- const int number = 4;
- QWidget* widgets[number];
+ typedef QSharedPointer<QWidget> WidgetPtr;
+
+ const QString styleSheet = QStringLiteral("* { background-color: #e8ff66; }");
+ QVector<WidgetPtr> widgets;
+ const QPoint topLeft = QGuiApplication::primaryScreen()->availableGeometry().topLeft();
// Testing inheritance styling of QDialog.
- widgets[0] = new SingleInheritanceDialog;
- widgets[0]->setStyleSheet("* { background-color: #e8ff66; }");
- widgets[1] = new DoubleInheritanceDialog;
- widgets[1]->setStyleSheet("* { background-color: #e8ff66; }");
+ WidgetPtr toplevel(new SingleInheritanceDialog);
+ toplevel->resize(200, 200);
+ toplevel->move(topLeft + QPoint(20, 20));
+ toplevel->setStyleSheet(styleSheet);
+ widgets.append(toplevel);
+
+ toplevel = WidgetPtr(new DoubleInheritanceDialog);
+ toplevel->resize(200, 200);
+ toplevel->move(topLeft + QPoint(20, 320));
+ toplevel->setStyleSheet(styleSheet);
+ widgets.append(toplevel);
// Testing gradients in QComboBox.
- QLayout* layout;
- QComboBox* cb;
// First color
- widgets[2] = new QDialog;
- layout = new QGridLayout;
- cb = new QComboBox;
+ toplevel = WidgetPtr(new QDialog);
+ toplevel->move(topLeft + QPoint(320, 20));
+ QGridLayout *layout = new QGridLayout(toplevel.data());
+ QComboBox* cb = new QComboBox;
+ cb->setMinimumWidth(160);
cb->setStyleSheet("* { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #e8ff66, stop:1 #000000); }");
- layout->addWidget(cb);
- widgets[2]->setLayout(layout);
+ layout->addWidget(cb, 0, 0);
+ widgets.append(toplevel);
// Second color
- widgets[3] = new QDialog;
- layout = new QGridLayout;
+ toplevel = WidgetPtr(new QDialog);
+ toplevel->move(topLeft + QPoint(320, 320));
+ layout = new QGridLayout(toplevel.data());
cb = new QComboBox;
+ cb->setMinimumWidth(160);
cb->setStyleSheet("* { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #e8ff66, stop:1 #000000); }");
- layout->addWidget(cb);
- widgets[3]->setLayout(layout);
-
- for (int c = 0; c < number; ++c) {
- QWidget* widget = widgets[c];
+ layout->addWidget(cb, 0, 0);
+ widgets.append(toplevel);
+ for (int c = 0; c < widgets.size(); ++c) {
+ QWidget *widget = widgets.at(c).data();
+ widget->setWindowTitle(QStringLiteral("background ") + QString::number(c));
widget->show();
QVERIFY(QTest::qWaitForWindowExposed(widget));
@@ -941,12 +964,15 @@ void tst_QStyleSheetStyle::background()
if (image.depth() < 24)
QSKIP("Test doesn't support color depth < 24");
+ if (c == 2 && !QApplication::style()->objectName().compare(QLatin1String("fusion"), Qt::CaseInsensitive))
+ QEXPECT_FAIL("", "QTBUG-21468", Abort);
+
QVERIFY2(testForColors(image, QColor(0xe8, 0xff, 0x66)),
- (QString::fromLatin1(widget->metaObject()->className())
+ (QString::number(c) + QLatin1Char(' ') + QString::fromLatin1(widget->metaObject()->className())
+ " did not contain background image with color #e8ff66")
.toLocal8Bit().constData());
- delete widget;
+ widget->hide();
}
}
@@ -956,6 +982,7 @@ void tst_QStyleSheetStyle::tabAlignement()
QTabWidget tabWidget(&topLevel);
tabWidget.addTab(new QLabel("tab1"),"tab1");
tabWidget.resize(QSize(400,400));
+ centerOnScreen(&topLevel);
topLevel.show();
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
QTabBar *bar = tabWidget.findChild<QTabBar*>();
@@ -1023,6 +1050,7 @@ void tst_QStyleSheetStyle::minmaxSizes()
tabWidget.setStyleSheet("QTabBar::tab { min-width:100px; max-width:130px; }");
+ centerOnScreen(&tabWidget);
tabWidget.show();
QTest::qWait(50);
//i allow 4px additional border from the native style (hence the -2, <=2)
@@ -1050,6 +1078,7 @@ void tst_QStyleSheetStyle::task206238_twice()
tw->addTab(new QLabel("foo"), "test");
w.setCentralWidget(tw);
w.setStyleSheet("background: red;");
+ centerOnScreen(&w);
w.show();
QTest::qWait(20);
QCOMPARE(BACKGROUND(w) , QColor("red"));
@@ -1219,6 +1248,8 @@ void tst_QStyleSheetStyle::proxyStyle()
QString styleSheet("QPushButton {background-color: red; }");
QWidget *w = new QWidget;
+ w->setMinimumWidth(160);
+ centerOnScreen(w);
QVBoxLayout *layout = new QVBoxLayout(w);
QPushButton *pb1 = new QPushButton(qApp->style()->objectName(), w);
@@ -1294,6 +1325,7 @@ void tst_QStyleSheetStyle::emptyStyleSheet()
layout.addWidget(new QDateEdit(&w));
layout.addWidget(new QGroupBox("some text", &w));
+ centerOnScreen(&w);
w.show();
QVERIFY(QTest::qWaitForWindowExposed(&w));
//workaround the fact that the label sizehint is one pixel different the first time.
@@ -1315,13 +1347,30 @@ void tst_QStyleSheetStyle::emptyStyleSheet()
img2.save("emptyStyleSheet_img2.png");
}
+ QEXPECT_FAIL("", "QTBUG-21468", Abort);
QCOMPARE(img1,img2);
}
+class ApplicationStyleSetter
+{
+public:
+ explicit inline ApplicationStyleSetter(QStyle *s) : m_oldStyleName(QApplication::style()->objectName())
+ { QApplication::setStyle(s); }
+ inline ~ApplicationStyleSetter()
+ { QApplication::setStyle(QStyleFactory::create(m_oldStyleName)); }
+
+private:
+ const QString m_oldStyleName;
+};
+
void tst_QStyleSheetStyle::toolTip()
{
qApp->setStyleSheet(QString());
QWidget w;
+ // Use "Fusion" to prevent the Vista style from clobbering the tooltip palette in polish().
+ QStyle *fusionStyle = QStyleFactory::create(QLatin1String("Fusion"));
+ QVERIFY(fusionStyle);
+ ApplicationStyleSetter as(fusionStyle);
QHBoxLayout layout(&w);
w.setLayout(&layout);
@@ -1349,11 +1398,12 @@ void tst_QStyleSheetStyle::toolTip()
wid4->setToolTip("this is wid4");
wid4->setObjectName("wid4");
+ centerOnScreen(&w);
w.show();
qApp->setActiveWindow(&w);
QVERIFY(QTest::qWaitForWindowActive(&w));
- QColor normalToolTip = qApp->palette().toolTipBase().color();
+ const QColor normalToolTip = QToolTip::palette().color(QPalette::Inactive, QPalette::ToolTipBase);
QList<QWidget *> widgets;
QList<QColor> colors;
@@ -1372,12 +1422,13 @@ void tst_QStyleSheetStyle::toolTip()
QWidget *tooltip = 0;
foreach (QWidget *widget, QApplication::topLevelWidgets()) {
- if (widget->inherits("QTipLabel") && widget->isVisible()) {
+ if (widget->inherits("QTipLabel")) {
tooltip = widget;
break;
}
}
QVERIFY(tooltip);
+ QTRY_VERIFY(tooltip->isVisible()); // Wait until Roll-Effect is finished (Windows Vista)
QCOMPARE(tooltip->palette().color(tooltip->backgroundRole()), col);
}
@@ -1394,6 +1445,8 @@ void tst_QStyleSheetStyle::embeddedFonts()
{
//task 235622 and 210551
QSpinBox spin;
+ spin.setMinimumWidth(160);
+ spin.move(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(20, 20));
spin.show();
spin.setStyleSheet("QSpinBox { font-size: 32px; }");
QTest::qWait(20);
@@ -1411,6 +1464,8 @@ void tst_QStyleSheetStyle::embeddedFonts()
//task 242556
QComboBox box;
+ box.setMinimumWidth(160);
+ box.move(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(20, 120));
box.setEditable(true);
box.addItems(QStringList() << "First" << "Second" << "Third");
box.setStyleSheet("QComboBox { font-size: 32px; }");
@@ -1483,6 +1538,7 @@ void tst_QStyleSheetStyle::complexWidgetFocus()
layout->addWidget(widget);
frame.setLayout(layout);
+ centerOnScreen(&frame);
frame.show();
QApplication::setActiveWindow(&frame);
QVERIFY(QTest::qWaitForWindowActive(&frame));
@@ -1507,6 +1563,7 @@ void tst_QStyleSheetStyle::task188195_baseBackground()
{
QTreeView tree;
tree.setStyleSheet( "QTreeView:disabled { background-color:#ab1251; }" );
+ tree.move(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(20, 100));
tree.show();
QTest::qWait(20);
QImage image(tree.width(), tree.height(), QImage::Format_ARGB32);
@@ -1527,6 +1584,7 @@ void tst_QStyleSheetStyle::task188195_baseBackground()
QTableWidget table(12, 12);
table.setItem(0, 0, new QTableWidgetItem());
table.setStyleSheet( "QTableView {background-color: #ff0000}" );
+ table.move(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(300, 100));
table.show();
QTest::qWait(20);
image = QImage(table.width(), table.height(), QImage::Format_ARGB32);
@@ -1560,6 +1618,7 @@ void tst_QStyleSheetStyle::task232085_spinBoxLineEditBg()
layout->addWidget(spinbox);
frame.setLayout(layout);
+ centerOnScreen(&frame);
frame.show();
QApplication::setActiveWindow(&frame);
spinbox->setFocus();
@@ -1619,6 +1678,7 @@ void tst_QStyleSheetStyle::QTBUG11658_cachecrash()
Widget(QWidget *parent = 0)
: QWidget(parent)
{
+ setMinimumWidth(160);
QVBoxLayout* pLayout = new QVBoxLayout(this);
QCheckBox* pCheckBox = new QCheckBox(this);
pLayout->addWidget(pCheckBox);
@@ -1633,6 +1693,7 @@ void tst_QStyleSheetStyle::QTBUG11658_cachecrash()
Widget *w = new Widget();
delete w;
w = new Widget();
+ centerOnScreen(w);
w->show();
QVERIFY(QTest::qWaitForWindowExposed(w));
@@ -1653,6 +1714,8 @@ void tst_QStyleSheetStyle::QTBUG15910_crashNullWidget()
}
} w;
w.setStyleSheet("* { background-color: white; color:black; border 3px solid yellow }");
+ w.setMinimumWidth(160);
+ centerOnScreen(&w);
w.show();
QVERIFY(QTest::qWaitForWindowExposed(&w));
}
@@ -1675,6 +1738,7 @@ void tst_QStyleSheetStyle::QTBUG36933_brokenPseudoClassLookup()
// parsing of this stylesheet must not crash, and it must be correctly applied
widget.setStyleSheet(QStringLiteral("QHeaderView::section:vertical { background-color: #FF0000 }"));
+ centerOnScreen(&widget);
widget.show();
QVERIFY(QTest::qWaitForWindowExposed(&widget));
@@ -1685,6 +1749,8 @@ void tst_QStyleSheetStyle::QTBUG36933_brokenPseudoClassLookup()
QHeaderView *verticalHeader = widget.verticalHeader();
QImage image(verticalHeader->size(), QImage::Format_ARGB32);
verticalHeader->render(&image);
+ if (!QApplication::style()->objectName().compare(QLatin1String("fusion"), Qt::CaseInsensitive))
+ QEXPECT_FAIL("", "QTBUG-21468", Abort);
QVERIFY(testForColors(image, QColor(0xFF, 0x00, 0x00)));
}
diff --git a/tests/auto/widgets/styles/styles.pro b/tests/auto/widgets/styles/styles.pro
index 1791279b72..508b6ecd41 100644
--- a/tests/auto/widgets/styles/styles.pro
+++ b/tests/auto/widgets/styles/styles.pro
@@ -12,5 +12,5 @@ SUBDIRS=\
!mac:SUBDIRS -= \
qmacstyle \
-!contains( styles, motif ):SUBDIRS -= \
+ios|android|qnx|*wince*:SUBDIRS -= \
qstylesheetstyle \
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"