summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2012-04-17 12:58:41 +0200
committerLars Knoll <lars.knoll@nokia.com>2012-04-17 12:58:52 +0200
commit64255ef6502b1144f7b0aa4b2bf62803e0d4788b (patch)
tree29bf116bfda2ccf61057115690d14f85cc9b085b /tests/auto/widgets
parent4a9fb41a7947d0bb7a47a9625603a436df288b24 (diff)
parent7e0beba891cb963a1d535bd45b0be78b43b8d07f (diff)
Merge remote-tracking branch 'origin/api_changes'
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp4
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp4
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp15
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp32
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp3
-rw-r--r--tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp43
-rw-r--r--tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp11
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp39
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp3
-rw-r--r--tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp3
-rw-r--r--tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp6
-rw-r--r--tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp2
-rw-r--r--tests/auto/widgets/widgets/qworkspace/.gitignore1
-rw-r--r--tests/auto/widgets/widgets/qworkspace/qworkspace.pro4
-rw-r--r--tests/auto/widgets/widgets/qworkspace/tst_qworkspace.cpp676
-rw-r--r--tests/auto/widgets/widgets/widgets.pro1
16 files changed, 82 insertions, 765 deletions
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
index e46d905022..0e19e88793 100644
--- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
+++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
@@ -388,12 +388,16 @@ void tst_QDialog::toolDialogPosition()
#if defined(Q_OS_WINCE)
QSKIP("No real support for Qt::Tool on WinCE");
#endif
+#ifdef Q_OS_WIN
+ QSKIP("QTBUG-25331 - positioning failure");
+#endif
QDialog dialog(0, Qt::Tool);
dialog.move(QPoint(100,100));
const QPoint beforeShowPosition = dialog.pos();
dialog.show();
const QPoint afterShowPosition = dialog.pos();
QCOMPARE(afterShowPosition, beforeShowPosition);
+
}
class Dialog : public QDialog
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 1a3d083864..47c40032c3 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -400,7 +400,7 @@ bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringLi
if (initial_files.at(i)[0] == '.') {
QString hiddenFile = QDir::toNativeSeparators(file.fileName());
wchar_t nativeHiddenFile[MAX_PATH];
- qMemSet(nativeHiddenFile, 0, sizeof(nativeHiddenFile));
+ memset(nativeHiddenFile, 0, sizeof(nativeHiddenFile));
hiddenFile.toWCharArray(nativeHiddenFile);
DWORD currentAttributes = ::GetFileAttributes(nativeHiddenFile);
if (currentAttributes == 0xFFFFFFFF) {
@@ -863,7 +863,7 @@ void tst_QFileSystemModel::sort()
QTest::qWait(500);
QModelIndex parent = myModel->index(dirPath, 0);
QList<QString> expectedOrder;
- expectedOrder << tempFile2.fileName() << tempFile.fileName() << dirPath + QChar('/') + "." << dirPath + QChar('/') + "..";
+ expectedOrder << tempFile2.fileName() << tempFile.fileName() << dirPath + QChar('/') + ".." << dirPath + QChar('/') + ".";
//File dialog Mode means sub trees are not sorted, only the current root
if (fileDialogMode) {
// FIXME: we were only able to disableRecursiveSort in developer builds, so we can only
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 98c3866dd2..639a1f61a9 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -11116,20 +11116,23 @@ void tst_QGraphicsItem::doNotMarkFullUpdateIfNotInScene()
view.showFullScreen();
else
view.show();
- QTest::qWaitForWindowShown(&view);
- QEXPECT_FAIL("", "QTBUG-22434", Abort);
- QTRY_COMPARE(view.repaints, 1);
- QTRY_COMPARE(item->painted, 1);
+ QTest::qWaitForWindowShown(view.windowHandle());
+ view.activateWindow();
+ QTRY_VERIFY(view.isActiveWindow());
+ QTRY_VERIFY(view.repaints >= 1);
+ int count = view.repaints;
+ QTRY_COMPARE(item->painted, count);
+ // cached as graphics effects, not painted multiple times
QTRY_COMPARE(item2->painted, 1);
QTRY_COMPARE(item3->painted, 1);
item2->update();
QApplication::processEvents();
- QTRY_COMPARE(item->painted, 2);
+ QTRY_COMPARE(item->painted, count + 1);
QTRY_COMPARE(item2->painted, 2);
QTRY_COMPARE(item3->painted, 2);
item2->update();
QApplication::processEvents();
- QTRY_COMPARE(item->painted, 3);
+ QTRY_COMPARE(item->painted, count + 2);
QTRY_COMPARE(item2->painted, 3);
QTRY_COMPARE(item3->painted, 3);
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index 8772fb1e7e..df529c6095 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -1078,19 +1078,14 @@ void tst_QGraphicsScene::addItem()
CustomView view;
view.setScene(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ QTest::qWaitForWindowShown(view.windowHandle());
qApp->processEvents();
view.repaints = 0;
scene.addItem(path);
// Adding an item should always issue a repaint.
- qApp->processEvents(); // <- delayed update is called
- qApp->processEvents(); // <- scene schedules pending update
- qApp->processEvents(); // <- pending update is sent to view
- QVERIFY(view.repaints > 0);
+ QTRY_VERIFY(view.repaints > 0);
view.repaints = 0;
QCOMPARE(scene.itemAt(0, 0), path);
@@ -1103,10 +1098,7 @@ void tst_QGraphicsScene::addItem()
scene.addItem(path2);
// Adding an item should always issue a repaint.
- qApp->processEvents(); // <- delayed update is called
- qApp->processEvents(); // <- scene schedules pending update
- qApp->processEvents(); // <- pending update is sent to view
- QVERIFY(view.repaints > 0);
+ QTRY_VERIFY(view.repaints > 0);
QCOMPARE(scene.itemAt(100, 100), path2);
}
@@ -1285,9 +1277,7 @@ void tst_QGraphicsScene::removeItem()
QGraphicsView view(&scene);
view.setFixedSize(150, 150);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ QTest::qWaitForWindowShown(view.windowHandle());
QTest::mouseMove(view.viewport(), QPoint(-1, -1));
{
QMouseEvent moveEvent(QEvent::MouseMove, view.mapFromScene(hoverItem->scenePos() + QPointF(20, 20)), Qt::NoButton, 0, 0);
@@ -1615,9 +1605,7 @@ void tst_QGraphicsScene::hoverEvents_siblings()
view.rotate(10);
view.scale(1.7, 1.7);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ QTest::qWaitForWindowShown(view.windowHandle());
qApp->setActiveWindow(&view);
view.activateWindow();
QTest::qWait(70);
@@ -2748,11 +2736,8 @@ void tst_QGraphicsScene::contextMenuEvent()
QGraphicsView view(&scene);
view.show();
- QTest::qWaitForWindowShown(&view);
+ QTest::qWaitForWindowShown(view.windowHandle());
view.activateWindow();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
view.centerOn(item);
{
@@ -2785,10 +2770,7 @@ void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations()
QGraphicsView view(&scene, &topLevel);
view.resize(200, 200);
topLevel.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
- QTest::qWaitForWindowShown(&topLevel);
+ QTest::qWaitForWindowShown(topLevel.windowHandle());
{
QPoint pos(50, 50);
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index c6b2b49d98..3c98f8936c 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -1384,7 +1384,6 @@ void tst_QGraphicsWidget::setAttribute_data()
QTest::newRow("WA_RightToLeft") << Qt::WA_RightToLeft << true;
QTest::newRow("WA_SetStyle") << Qt::WA_SetStyle << true;
QTest::newRow("WA_Resized") << Qt::WA_Resized << true;
- QTest::newRow("unsupported") << Qt::WA_PaintOutsidePaintEvent << false;
}
// void setAttribute(Qt::WidgetAttribute attribute, bool on = true) public
@@ -1393,8 +1392,6 @@ void tst_QGraphicsWidget::setAttribute()
QFETCH(Qt::WidgetAttribute, attribute);
QFETCH(bool, supported);
SubQGraphicsWidget widget;
- if (attribute == Qt::WA_PaintOutsidePaintEvent)
- QTest::ignoreMessage(QtWarningMsg, "QGraphicsWidget::setAttribute: unsupported attribute 13");
widget.setAttribute(attribute);
QCOMPARE(widget.testAttribute(attribute), supported);
}
diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
index 2b52f5f234..f9610fab16 100644
--- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
@@ -58,6 +58,7 @@
#include <qtreewidget.h>
#include <QItemDelegate>
+#include <QComboBox>
#include <QAbstractItemDelegate>
#include <QTextEdit>
#include <QPlainTextEdit>
@@ -228,6 +229,7 @@ private slots:
void editorEvent();
void enterKey_data();
void enterKey();
+ void comboBox();
void task257859_finalizeEdit();
void QTBUG4435_keepSelectionOnCheck();
@@ -780,6 +782,9 @@ void tst_QItemDelegate::dateTimeEditor()
QTimeEdit *timeEditor = qFindChild<QTimeEdit *>(widget.viewport());
QVERIFY(timeEditor);
QCOMPARE(timeEditor->time(), time);
+ // The data must actually be different in order for the model
+ // to be updated.
+ timeEditor->setTime(time.addSecs(60));
widget.clearFocus();
qApp->setActiveWindow(&widget);
@@ -791,6 +796,7 @@ void tst_QItemDelegate::dateTimeEditor()
QDateEdit *dateEditor = qFindChild<QDateEdit *>(widget.viewport());
QVERIFY(dateEditor);
QCOMPARE(dateEditor->date(), date);
+ dateEditor->setDate(date.addDays(60));
widget.clearFocus();
widget.setFocus();
@@ -806,6 +812,12 @@ void tst_QItemDelegate::dateTimeEditor()
QVERIFY(dateTimeEditor);
QCOMPARE(dateTimeEditor->date(), date);
QCOMPARE(dateTimeEditor->time(), time);
+ dateTimeEditor->setTime(time.addSecs(600));
+ widget.clearFocus();
+
+ QVERIFY(item1->data(Qt::EditRole).userType() == QMetaType::QTime);
+ QVERIFY(item2->data(Qt::EditRole).userType() == QMetaType::QDate);
+ QVERIFY(item3->data(Qt::EditRole).userType() == QMetaType::QDateTime);
}
void tst_QItemDelegate::decoration_data()
@@ -873,7 +885,7 @@ void tst_QItemDelegate::decoration()
}
case QVariant::Image: {
QImage img(size, QImage::Format_Mono);
- qMemSet(img.bits(), 0, img.byteCount());
+ memset(img.bits(), 0, img.byteCount());
value = img;
break;
}
@@ -1195,6 +1207,35 @@ void tst_QItemDelegate::QTBUG4435_keepSelectionOnCheck()
QCOMPARE(model.item(0)->checkState(), Qt::Checked);
}
+void tst_QItemDelegate::comboBox()
+{
+ QTableWidgetItem *item1 = new QTableWidgetItem;
+ item1->setData(Qt::DisplayRole, true);
+
+ QTableWidget widget(1, 1);
+ widget.setItem(0, 0, item1);
+ widget.show();
+
+ widget.editItem(item1);
+
+ QTestEventLoop::instance().enterLoop(1);
+
+ QComboBox *boolEditor = qFindChild<QComboBox*>(widget.viewport());
+ QVERIFY(boolEditor);
+ QCOMPARE(boolEditor->currentIndex(), 1); // True is selected initially.
+ // The data must actually be different in order for the model
+ // to be updated.
+ boolEditor->setCurrentIndex(0);
+ QCOMPARE(boolEditor->currentIndex(), 0); // Changed to false.
+
+ widget.clearFocus();
+ widget.setFocus();
+
+ QVariant data = item1->data(Qt::EditRole);
+ QCOMPARE(data.userType(), (int)QMetaType::Bool);
+ QCOMPARE(data.toBool(), false);
+}
+
// ### _not_ covered:
diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
index 764d777cea..647376412f 100644
--- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
+++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
@@ -52,6 +52,7 @@
#include <QtWidgets/QFrame>
#include <QtWidgets/QWindowsStyle>
#include <QtWidgets/QSizePolicy>
+#include <QtWidgets/QComboBox>
#include <QPushButton>
#include <QRadioButton>
#include <private/qlayoutengine_p.h>
@@ -77,6 +78,7 @@ private slots:
void layoutItemRect();
void warnIfWrongParent();
void controlTypes();
+ void controlTypes2();
void adjustSizeShouldMakeSureLayoutIsActivated();
};
@@ -310,7 +312,16 @@ void tst_QLayout::controlTypes()
QCOMPARE(layout.controlTypes(), QSizePolicy::DefaultType);
QSizePolicy p;
QCOMPARE(p.controlType(),QSizePolicy::DefaultType);
+}
+void tst_QLayout::controlTypes2()
+{
+ QWidget main;
+ QVBoxLayout *const layout = new QVBoxLayout(&main);
+ layout->setMargin(0);
+ QComboBox *combo = new QComboBox(&main);
+ layout->addWidget(combo);
+ QCOMPARE(layout->controlTypes(), QSizePolicy::ComboBox);
}
void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated()
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 975c88db05..0c769d55da 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -377,9 +377,6 @@ private slots:
#endif
void windowFlags();
void initialPosForDontShowOnScreenWidgets();
-#ifdef Q_WS_X11
- void paintOutsidePaintEvent();
-#endif
void updateOnDestroyedSignal();
void toplevelLineEditFocus();
void inputFocus_task257832();
@@ -8711,42 +8708,6 @@ void tst_QWidget::initialPosForDontShowOnScreenWidgets()
}
}
-#ifdef Q_WS_X11
-void tst_QWidget::paintOutsidePaintEvent()
-{
- QWidget widget;
- widget.resize(200, 200);
-
- QWidget child1(&widget);
- child1.resize(100, 100);
- child1.setPalette(Qt::red);
- child1.setAutoFillBackground(true);
-
- QWidget child2(&widget);
- child2.setGeometry(50, 50, 100, 100);
- child2.setPalette(Qt::blue);
- child2.setAutoFillBackground(true);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QTest::qWait(60);
-
- const QPixmap before = QPixmap::grabWindow(widget.winId());
-
- // Child 1 should be clipped by child 2, so nothing should change.
- child1.setAttribute(Qt::WA_PaintOutsidePaintEvent);
- QPainter painter(&child1);
- painter.fillRect(child1.rect(), Qt::red);
- painter.end();
- XSync(QX11Info::display(), false); // Flush output buffer.
- QTest::qWait(60);
-
- const QPixmap after = QPixmap::grabWindow(widget.winId());
-
- QCOMPARE(before, after);
-}
-#endif
-
class MyEvilObject : public QObject
{
Q_OBJECT
diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
index 78d9d36bc9..be33381620 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
@@ -91,6 +91,9 @@ void tst_QWidget_window::cleanupTestCase()
void tst_QWidget_window::tst_move_show()
{
+#ifdef Q_OS_WIN
+ QSKIP("QTBUG-25331");
+#endif
QWidget w;
w.move(100, 100);
w.show();
diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
index d8b2a800b9..19ff947a1c 100644
--- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
+++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
@@ -255,9 +255,6 @@ void tst_QLabel::setTextFormat()
testWidget->setTextFormat( Qt::RichText );
QVERIFY( testWidget->textFormat() == Qt::RichText );
- testWidget->setTextFormat( Qt::LogText );
- QVERIFY( testWidget->textFormat() == Qt::LogText );
-
testWidget->setTextFormat( Qt::AutoText );
QVERIFY( testWidget->textFormat() == Qt::AutoText );
}
diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
index 82632a018c..eeb2eea9a1 100644
--- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
+++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
@@ -199,7 +199,7 @@ static bool verifyArrangement(QMdiArea *mdiArea, Arrangement arrangement, const
if (qobject_cast<QMacStyle *>(firstSubWindow->style()))
titleBarHeight -= 4;
#endif
- const QFontMetrics fontMetrics = QFontMetrics(QApplication::font("QWorkspaceTitleBar"));
+ const QFontMetrics fontMetrics = QFontMetrics(QApplication::font("QMdiSubWindowTitleBar"));
const int dy = qMax(titleBarHeight - (titleBarHeight - fontMetrics.height()) / 2, 1);
const int dx = 10;
@@ -1275,7 +1275,7 @@ static int numberOfConnectedSignals(MySubWindow *subWindow)
QMetaMethod method = subWindow->metaObject()->method(i);
if (method.methodType() == QMetaMethod::Signal) {
QString signature(QLatin1String("2"));
- signature += QLatin1String(method.signature());
+ signature += QLatin1String(method.methodSignature().constData());
numConnectedSignals += subWindow->receivers(signature.toLatin1());
}
}
@@ -1823,7 +1823,7 @@ void tst_QMdiArea::cascadeAndTileSubWindows()
// ### Remove this after the mac style has been fixed
if (windows.at(1)->style()->inherits("QMacStyle"))
titleBarHeight -= 4;
- const QFontMetrics fontMetrics = QFontMetrics(QApplication::font("QWorkspaceTitleBar"));
+ const QFontMetrics fontMetrics = QFontMetrics(QApplication::font("QMdiSubWindowTitleBar"));
const int dy = qMax(titleBarHeight - (titleBarHeight - fontMetrics.height()) / 2, 1);
QCOMPARE(windows.at(2)->geometry().top() - windows.at(1)->geometry().top(), dy);
diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
index eb433786f2..bc5100f118 100644
--- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
+++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
@@ -1823,7 +1823,7 @@ void tst_QMdiSubWindow::setFont()
qt_x11_wait_for_window_manager(&mdiArea);
#endif
- const QFont originalFont = QApplication::font("QWorkspaceTitleBar");
+ const QFont originalFont = QApplication::font("QMdiSubWindowTitleBar");
QStyleOptionTitleBar opt;
opt.initFrom(subWindow);
const int titleBarHeight = subWindow->style()->pixelMetric(QStyle::PM_TitleBarHeight, &opt);
diff --git a/tests/auto/widgets/widgets/qworkspace/.gitignore b/tests/auto/widgets/widgets/qworkspace/.gitignore
deleted file mode 100644
index 73facc366e..0000000000
--- a/tests/auto/widgets/widgets/qworkspace/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-tst_qworkspace
diff --git a/tests/auto/widgets/widgets/qworkspace/qworkspace.pro b/tests/auto/widgets/widgets/qworkspace/qworkspace.pro
deleted file mode 100644
index 02de0031fd..0000000000
--- a/tests/auto/widgets/widgets/qworkspace/qworkspace.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qworkspace
-QT += widgets testlib
-SOURCES += tst_qworkspace.cpp
diff --git a/tests/auto/widgets/widgets/qworkspace/tst_qworkspace.cpp b/tests/auto/widgets/widgets/qworkspace/tst_qworkspace.cpp
deleted file mode 100644
index 582f56da17..0000000000
--- a/tests/auto/widgets/widgets/qworkspace/tst_qworkspace.cpp
+++ /dev/null
@@ -1,676 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtTest/QtTest>
-#include <qapplication.h>
-#include <qmainwindow.h>
-#include <qmenubar.h>
-#include <qworkspace.h>
-
-class tst_QWorkspace : public QObject
-{
- Q_OBJECT
-
-public:
- tst_QWorkspace();
- virtual ~tst_QWorkspace();
-
-
-protected slots:
- void activeChanged( QWidget *w );
- void accelActivated();
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-private slots:
- void getSetCheck();
- void windowActivated_data();
- void windowActivated();
- void windowActivatedWithMinimize();
- void showWindows();
- void changeWindowTitle();
- void changeModified();
- void childSize();
- void fixedSize();
-#if defined(Q_WS_WIN) || defined(Q_WS_X11)
- void nativeSubWindows();
-#endif
- void task206368();
-
-private:
- QWidget *activeWidget;
- bool accelPressed;
-};
-
-// Testing get/set functions
-void tst_QWorkspace::getSetCheck()
-{
- QWorkspace obj1;
- // bool QWorkspace::scrollBarsEnabled()
- // void QWorkspace::setScrollBarsEnabled(bool)
- obj1.setScrollBarsEnabled(false);
- QCOMPARE(false, obj1.scrollBarsEnabled());
- obj1.setScrollBarsEnabled(true);
- QCOMPARE(true, obj1.scrollBarsEnabled());
-}
-
-tst_QWorkspace::tst_QWorkspace()
- : activeWidget( 0 )
-{
-}
-
-tst_QWorkspace::~tst_QWorkspace()
-{
-
-}
-
-// initTestCase will be executed once before the first testfunction is executed.
-void tst_QWorkspace::initTestCase()
-{
-
-}
-
-// cleanupTestCase will be executed once after the last testfunction is executed.
-void tst_QWorkspace::cleanupTestCase()
-{
-}
-
-// init() will be executed immediately before each testfunction is run.
-void tst_QWorkspace::init()
-{
-// TODO: Add testfunction specific initialization code here.
-}
-
-// cleanup() will be executed immediately after each testfunction is run.
-void tst_QWorkspace::cleanup()
-{
-// TODO: Add testfunction specific cleanup code here.
-}
-
-void tst_QWorkspace::activeChanged( QWidget *w )
-{
- activeWidget = w;
-}
-
-void tst_QWorkspace::windowActivated_data()
-{
- // define the test elements we're going to use
- QTest::addColumn<int>("count");
-
- // create a first testdata instance and fill it with data
- QTest::newRow( "data0" ) << 0;
- QTest::newRow( "data1" ) << 1;
- QTest::newRow( "data2" ) << 2;
-}
-
-void tst_QWorkspace::windowActivated()
-{
- QMainWindow mw(0, Qt::X11BypassWindowManagerHint);
- mw.menuBar();
- QWorkspace *workspace = new QWorkspace(&mw);
- workspace->setObjectName("testWidget");
- mw.setCentralWidget(workspace);
- QSignalSpy spy(workspace, SIGNAL(windowActivated(QWidget*)));
- connect( workspace, SIGNAL(windowActivated(QWidget*)), this, SLOT(activeChanged(QWidget*)) );
- mw.show();
- qApp->setActiveWindow(&mw);
-
- QFETCH( int, count );
- int i;
-
- for ( i = 0; i < count; ++i ) {
- QWidget *widget = new QWidget(workspace, 0);
- widget->setAttribute(Qt::WA_DeleteOnClose);
- workspace->addWindow(widget);
- widget->show();
- qApp->processEvents();
- QVERIFY( activeWidget == workspace->activeWindow() );
- QCOMPARE(spy.count(), 1);
- spy.clear();
- }
-
- QWidgetList windows = workspace->windowList();
- QCOMPARE( (int)windows.count(), count );
-
- for ( i = 0; i < count; ++i ) {
- QWidget *window = windows.at(i);
- window->showMinimized();
- qApp->processEvents();
- QVERIFY( activeWidget == workspace->activeWindow() );
- if ( i == 1 )
- QVERIFY( activeWidget == window );
- }
-
- for ( i = 0; i < count; ++i ) {
- QWidget *window = windows.at(i);
- window->showNormal();
- qApp->processEvents();
- QVERIFY( window == activeWidget );
- QVERIFY( activeWidget == workspace->activeWindow() );
- }
- spy.clear();
-
- while ( workspace->activeWindow() ) {
- workspace->activeWindow()->close();
- qApp->processEvents();
- QVERIFY( activeWidget == workspace->activeWindow() );
- QCOMPARE(spy.count(), 1);
- spy.clear();
- }
- QVERIFY(activeWidget == 0);
- QVERIFY(workspace->activeWindow() == 0);
- QVERIFY(workspace->windowList().count() == 0);
-
- {
- workspace->hide();
- QWidget *widget = new QWidget(workspace);
- widget->setObjectName("normal");
- widget->setAttribute(Qt::WA_DeleteOnClose);
- workspace->addWindow(widget);
- widget->show();
- QCOMPARE(spy.count(), 0);
- workspace->show();
- QCOMPARE(spy.count(), 1);
- spy.clear();
- QVERIFY( activeWidget == widget );
- widget->close();
- qApp->processEvents();
- QCOMPARE(spy.count(), 1);
- spy.clear();
- QVERIFY( activeWidget == 0 );
- }
-
- {
- workspace->hide();
- QWidget *widget = new QWidget(workspace);
- widget->setObjectName("maximized");
- widget->setAttribute(Qt::WA_DeleteOnClose);
- workspace->addWindow(widget);
- widget->showMaximized();
- qApp->sendPostedEvents();
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "This test has never passed on Mac. QWorkspace is obsoleted -> won't fix", Abort);
-#endif
- QCOMPARE(spy.count(), 0);
- spy.clear();
- workspace->show();
- QCOMPARE(spy.count(), 1);
- spy.clear();
- QVERIFY( activeWidget == widget );
- widget->close();
- qApp->processEvents();
- QCOMPARE(spy.count(), 1);
- spy.clear();
- QVERIFY( activeWidget == 0 );
- }
-
- {
- QWidget *widget = new QWidget(workspace);
- widget->setObjectName("minimized");
- widget->setAttribute(Qt::WA_DeleteOnClose);
- workspace->addWindow(widget);
- widget->showMinimized();
- QCOMPARE(spy.count(), 1);
- spy.clear();
- QVERIFY( activeWidget == widget );
- QVERIFY(workspace->activeWindow() == widget);
- widget->close();
- qApp->processEvents();
- QCOMPARE(spy.count(), 1);
- spy.clear();
- QVERIFY(workspace->activeWindow() == 0);
- QVERIFY( activeWidget == 0 );
- }
-}
-void tst_QWorkspace::windowActivatedWithMinimize()
-{
- QMainWindow mw(0, Qt::X11BypassWindowManagerHint) ;
- mw.menuBar();
- QWorkspace *workspace = new QWorkspace(&mw);
- workspace->setObjectName("testWidget");
- mw.setCentralWidget(workspace);
- QSignalSpy spy(workspace, SIGNAL(windowActivated(QWidget*)));
- connect( workspace, SIGNAL(windowActivated(QWidget*)), this, SLOT(activeChanged(QWidget*)) );
- mw.show();
- qApp->setActiveWindow(&mw);
- QWidget *widget = new QWidget(workspace);
- widget->setObjectName("minimized1");
- widget->setAttribute(Qt::WA_DeleteOnClose);
- workspace->addWindow(widget);
- QWidget *widget2 = new QWidget(workspace);
- widget2->setObjectName("minimized2");
- widget2->setAttribute(Qt::WA_DeleteOnClose);
- workspace->addWindow(widget2);
-
- widget->showMinimized();
- QVERIFY( activeWidget == widget );
- widget2->showMinimized();
- QVERIFY( activeWidget == widget2 );
-
- widget2->close();
- qApp->processEvents();
- QVERIFY( activeWidget == widget );
-
- widget->close();
- qApp->processEvents();
- QVERIFY(workspace->activeWindow() == 0);
- QVERIFY( activeWidget == 0 );
-
- QVERIFY( workspace->windowList().count() == 0 );
-}
-
-void tst_QWorkspace::accelActivated()
-{
- accelPressed = true;
-}
-
-void tst_QWorkspace::showWindows()
-{
- QWorkspace *ws = new QWorkspace( 0 );
-
- QWidget *widget = 0;
- ws->show();
-
- widget = new QWidget(ws);
- widget->setObjectName("plain1");
- widget->show();
- QVERIFY( widget->isVisible() );
-
- widget = new QWidget(ws);
- widget->setObjectName("maximized1");
- widget->showMaximized();
- QVERIFY( widget->isMaximized() );
- widget->showNormal();
- QVERIFY( !widget->isMaximized() );
-
- widget = new QWidget(ws);
- widget->setObjectName("minimized1");
- widget->showMinimized();
- QVERIFY( widget->isMinimized() );
- widget->showNormal();
- QVERIFY( !widget->isMinimized() );
-
- ws->hide();
-
- widget = new QWidget(ws);
- widget->setObjectName("plain2");
- ws->show();
- QVERIFY( widget->isVisible() );
-
- ws->hide();
-
- widget = new QWidget(ws);
- widget->setObjectName("maximized2");
- widget->showMaximized();
- QVERIFY( widget->isMaximized() );
- ws->show();
- QVERIFY( widget->isVisible() );
- QVERIFY( widget->isMaximized() );
- ws->hide();
-
- widget = new QWidget(ws);
- widget->setObjectName("minimized2");
- widget->showMinimized();
- ws->show();
- QVERIFY( widget->isMinimized() );
- ws->hide();
-
- delete ws;
-}
-
-
-//#define USE_SHOW
-
-void tst_QWorkspace::changeWindowTitle()
-{
-#ifdef Q_OS_WINCE
- QSKIP( "Test fails on Windows CE due to QWorkspace state handling");
-#endif
- const QString mwc( "MainWindow's Caption" );
- const QString mwc2( "MainWindow's New Caption" );
- const QString wc( "Widget's Caption" );
- const QString wc2( "Widget's New Caption" );
-
- QMainWindow *mw = new QMainWindow(0, Qt::X11BypassWindowManagerHint);
- mw->setWindowTitle( mwc );
- QWorkspace *ws = new QWorkspace( mw );
- mw->setCentralWidget( ws );
-
-
- QWidget *widget = new QWidget( ws );
- widget->setWindowTitle( wc );
- ws->addWindow(widget);
-
- QCOMPARE( mw->windowTitle(), mwc );
-
-
-#ifdef USE_SHOW
- widget->showMaximized();
-#else
- widget->setWindowState(Qt::WindowMaximized);
-#endif
- QCOMPARE( mw->windowTitle(), QString("%1 - [%2]").arg(mwc).arg(wc) );
-
-#ifdef USE_SHOW
- widget->showNormal();
-#else
- widget->setWindowState(Qt::WindowNoState);
-#endif
- qApp->processEvents();
- QCOMPARE( mw->windowTitle(), mwc );
-
-#ifdef USE_SHOW
- widget->showMaximized();
-#else
- widget->setWindowState(Qt::WindowMaximized);
-#endif
- qApp->processEvents();
- QCOMPARE( mw->windowTitle(), QString("%1 - [%2]").arg(mwc).arg(wc) );
- widget->setWindowTitle( wc2 );
- QCOMPARE( mw->windowTitle(), QString("%1 - [%2]").arg(mwc).arg(wc2) );
- mw->setWindowTitle( mwc2 );
- QCOMPARE( mw->windowTitle(), QString("%1 - [%2]").arg(mwc2).arg(wc2) );
-
- mw->show();
- qApp->setActiveWindow(mw);
-
-#ifdef USE_SHOW
- mw->showFullScreen();
-#else
- mw->setWindowState(Qt::WindowFullScreen);
-#endif
-
- qApp->processEvents();
- QCOMPARE( mw->windowTitle(), QString("%1 - [%2]").arg(mwc2).arg(wc2) );
-#ifdef USE_SHOW
- widget->showNormal();
-#else
- widget->setWindowState(Qt::WindowNoState);
-#endif
- qApp->processEvents();
- QCOMPARE( mw->windowTitle(), mwc2 );
-#ifdef USE_SHOW
- widget->showMaximized();
-#else
- widget->setWindowState(Qt::WindowMaximized);
-#endif
- qApp->processEvents();
- QCOMPARE( mw->windowTitle(), QString("%1 - [%2]").arg(mwc2).arg(wc2) );
-
-#ifdef USE_SHOW
- mw->showNormal();
-#else
- mw->setWindowState(Qt::WindowNoState);
-#endif
- qApp->processEvents();
- QCOMPARE( mw->windowTitle(), QString("%1 - [%2]").arg(mwc2).arg(wc2) );
-#ifdef USE_SHOW
- widget->showNormal();
-#else
- widget->setWindowState(Qt::WindowNoState);
-#endif
- QCOMPARE( mw->windowTitle(), mwc2 );
-
- delete mw;
-}
-
-void tst_QWorkspace::changeModified()
-{
- const QString mwc( "MainWindow's Caption" );
- const QString wc( "Widget's Caption[*]" );
-
- QMainWindow *mw = new QMainWindow(0, Qt::X11BypassWindowManagerHint);
- mw->setWindowTitle( mwc );
- QWorkspace *ws = new QWorkspace( mw );
- mw->setCentralWidget( ws );
-
- QWidget *widget = new QWidget( ws );
- widget->setWindowTitle( wc );
- ws->addWindow(widget);
-
- QCOMPARE( mw->isWindowModified(), false);
- QCOMPARE( widget->isWindowModified(), false);
- widget->setWindowState(Qt::WindowMaximized);
- QCOMPARE( mw->isWindowModified(), false);
- QCOMPARE( widget->isWindowModified(), false);
-
- widget->setWindowState(Qt::WindowNoState);
- QCOMPARE( mw->isWindowModified(), false);
- QCOMPARE( widget->isWindowModified(), false);
-
- widget->setWindowModified(true);
- QCOMPARE( mw->isWindowModified(), false);
- QCOMPARE( widget->isWindowModified(), true);
- widget->setWindowState(Qt::WindowMaximized);
- QCOMPARE( mw->isWindowModified(), true);
- QCOMPARE( widget->isWindowModified(), true);
-
- widget->setWindowState(Qt::WindowNoState);
- QCOMPARE( mw->isWindowModified(), false);
- QCOMPARE( widget->isWindowModified(), true);
-
- widget->setWindowState(Qt::WindowMaximized);
- QCOMPARE( mw->isWindowModified(), true);
- QCOMPARE( widget->isWindowModified(), true);
-
- widget->setWindowModified(false);
- QCOMPARE( mw->isWindowModified(), false);
- QCOMPARE( widget->isWindowModified(), false);
-
- widget->setWindowModified(true);
- QCOMPARE( mw->isWindowModified(), true);
- QCOMPARE( widget->isWindowModified(), true);
-
- widget->setWindowState(Qt::WindowNoState);
- QCOMPARE( mw->isWindowModified(), false);
- QCOMPARE( widget->isWindowModified(), true);
-
- delete mw;
-}
-
-class MyChild : public QWidget
-{
-public:
- MyChild(QWidget *parent = 0, Qt::WFlags f = 0)
- : QWidget(parent, f)
- {
- }
-
- QSize sizeHint() const
- {
- return QSize(234, 123);
- }
-};
-
-void tst_QWorkspace::childSize()
-{
- QWorkspace ws;
-
- MyChild *child = new MyChild(&ws);
- child->show();
- QCOMPARE(child->size(), child->sizeHint());
- delete child;
-
- child = new MyChild(&ws);
- child->setFixedSize(200, 200);
- child->show();
- QCOMPARE(child->size(), child->minimumSize());
- delete child;
-
- child = new MyChild(&ws);
- child->resize(150, 150);
- child->show();
- QCOMPARE(child->size(), QSize(150,150));
- delete child;
-}
-
-void tst_QWorkspace::fixedSize()
-{
- QWorkspace *ws = new QWorkspace;
- int i;
-
- ws->resize(500, 500);
-// ws->show();
-
- QSize fixed(300, 300);
- for (i = 0; i < 4; ++i) {
- QWidget *child = new QWidget(ws);
- child->setFixedSize(fixed);
- child->show();
- }
-
- QWidgetList windows = ws->windowList();
- for (i = 0; i < (int)windows.count(); ++i) {
- QWidget *child = windows.at(i);
- QCOMPARE(child->size(), fixed);
- QCOMPARE(child->visibleRegion().boundingRect().size(), fixed);
- }
-
- ws->cascade();
- ws->resize(800, 800);
- for (i = 0; i < (int)windows.count(); ++i) {
- QWidget *child = windows.at(i);
- QCOMPARE(child->size(), fixed);
- QCOMPARE(child->visibleRegion().boundingRect().size(), fixed);
- }
- ws->resize(500, 500);
-
- ws->tile();
- ws->resize(800, 800);
- for (i = 0; i < (int)windows.count(); ++i) {
- QWidget *child = windows.at(i);
- QCOMPARE(child->size(), fixed);
- QCOMPARE(child->visibleRegion().boundingRect().size(), fixed);
- }
- ws->resize(500, 500);
-
- for (i = 0; i < (int)windows.count(); ++i) {
- QWidget *child = windows.at(i);
- delete child;
- }
-
- delete ws;
-}
-
-#if defined(Q_WS_WIN) || defined(Q_WS_X11)
-void tst_QWorkspace::nativeSubWindows()
-{
- { // Add native widgets after show.
- QWorkspace workspace;
- workspace.addWindow(new QWidget);
- workspace.addWindow(new QWidget);
- workspace.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&workspace);
-#endif
-
- // No native widgets.
- foreach (QWidget *subWindow, workspace.windowList())
- QVERIFY(!subWindow->parentWidget()->internalWinId());
-
- QWidget *nativeWidget = new QWidget;
- QVERIFY(nativeWidget->winId()); // enforce native window.
- workspace.addWindow(nativeWidget);
-
- // All the sub-windows must be native.
- foreach (QWidget *subWindow, workspace.windowList())
- QVERIFY(subWindow->parentWidget()->internalWinId());
-
- // Add a non-native widget. This should become native.
- QWidget *subWindow = workspace.addWindow(new QWidget);
- QVERIFY(subWindow->parentWidget()->internalWinId());
- }
-
- { // Add native widgets before show.
- QWorkspace workspace;
- workspace.addWindow(new QWidget);
- QWidget *nativeWidget = new QWidget;
- (void)nativeWidget->winId();
- workspace.addWindow(nativeWidget);
- workspace.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&workspace);
-#endif
-
- // All the sub-windows must be native.
- foreach (QWidget *subWindow, workspace.windowList())
- QVERIFY(subWindow->parentWidget()->internalWinId());
- }
-
- { // Make a sub-window native *after* it's added to the area.
- QWorkspace workspace;
- workspace.addWindow(new QWidget);
- workspace.addWindow(new QWidget);
- workspace.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&workspace);
-#endif
-
- QWidget *nativeSubWindow = workspace.windowList().last()->parentWidget();
- QVERIFY(!nativeSubWindow->internalWinId());
- (void)nativeSubWindow->winId();
-
- // All the sub-windows should be native at this point.
- foreach (QWidget *subWindow, workspace.windowList())
- QVERIFY(subWindow->parentWidget()->internalWinId());
- }
-}
-#endif
-
-void tst_QWorkspace::task206368()
-{
- // Make sure the internal list of iconified windows doesn't contain dangling pointers.
- QWorkspace workspace;
- QWidget *child = new QWidget;
- QWidget *window = workspace.addWindow(child);
- workspace.show();
- child->showMinimized();
- delete window;
- // This shouldn't crash.
- workspace.arrangeIcons();
-}
-
-QTEST_MAIN(tst_QWorkspace)
-#include "tst_qworkspace.moc"
diff --git a/tests/auto/widgets/widgets/widgets.pro b/tests/auto/widgets/widgets/widgets.pro
index e77c311cde..0497cd205e 100644
--- a/tests/auto/widgets/widgets/widgets.pro
+++ b/tests/auto/widgets/widgets/widgets.pro
@@ -47,7 +47,6 @@ SUBDIRS=\
qtoolbar \
qtoolbox \
qtoolbutton \
- qworkspace \
# The following tests depend on private API:
!contains(QT_CONFIG, private_tests): SUBDIRS -= \