summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/kernel')
-rw-r--r--tests/auto/widgets/kernel/kernel.pro1
-rw-r--r--tests/auto/widgets/kernel/qaction/qaction.pro1
-rw-r--r--tests/auto/widgets/kernel/qactiongroup/qactiongroup.pro1
-rw-r--r--tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro1
-rw-r--r--tests/auto/widgets/kernel/qapplication/modal/modal.pro1
-rw-r--r--tests/auto/widgets/kernel/qapplication/test/test.pro3
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp5
-rw-r--r--tests/auto/widgets/kernel/qapplication/wincmdline/main.cpp7
-rw-r--r--tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro1
-rw-r--r--tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro1
-rw-r--r--tests/auto/widgets/kernel/qdesktopwidget/qdesktopwidget.pro1
-rw-r--r--tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp17
-rw-r--r--tests/auto/widgets/kernel/qformlayout/qformlayout.pro1
-rw-r--r--tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp6
-rw-r--r--tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro1
-rw-r--r--tests/auto/widgets/kernel/qlayout/qlayout.pro1
-rw-r--r--tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp12
-rw-r--r--tests/auto/widgets/kernel/qshortcut/qshortcut.pro3
-rw-r--r--tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp2
-rw-r--r--tests/auto/widgets/kernel/qsizepolicy/qsizepolicy.pro1
-rw-r--r--tests/auto/widgets/kernel/qstackedlayout/qstackedlayout.pro1
-rw-r--r--tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp1
-rw-r--r--tests/auto/widgets/kernel/qtooltip/qtooltip.pro1
-rw-r--r--tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp2
-rw-r--r--tests/auto/widgets/kernel/qwidget/qwidget.pro1
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp42
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro1
-rw-r--r--tests/auto/widgets/kernel/qwidgetaction/qwidgetaction.pro1
-rw-r--r--tests/auto/widgets/kernel/qwidgetmetatype/qwidgetmetatype.pro1
-rw-r--r--tests/auto/widgets/kernel/qwidgetsvariant/qwidgetsvariant.pro1
-rw-r--r--tests/auto/widgets/kernel/qwindowcontainer/.gitignore1
-rw-r--r--tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro6
-rw-r--r--tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp226
33 files changed, 298 insertions, 54 deletions
diff --git a/tests/auto/widgets/kernel/kernel.pro b/tests/auto/widgets/kernel/kernel.pro
index b280f44f05..20720dc928 100644
--- a/tests/auto/widgets/kernel/kernel.pro
+++ b/tests/auto/widgets/kernel/kernel.pro
@@ -15,6 +15,7 @@ SUBDIRS=\
qwidgetaction \
qwidgetmetatype \
qwidgetsvariant \
+ qwindowcontainer \
qshortcut \
qsizepolicy
diff --git a/tests/auto/widgets/kernel/qaction/qaction.pro b/tests/auto/widgets/kernel/qaction/qaction.pro
index 2cd1351dd7..c57107b1b0 100644
--- a/tests/auto/widgets/kernel/qaction/qaction.pro
+++ b/tests/auto/widgets/kernel/qaction/qaction.pro
@@ -4,4 +4,3 @@ QT += gui-private core-private widgets testlib
SOURCES += tst_qaction.cpp
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qactiongroup/qactiongroup.pro b/tests/auto/widgets/kernel/qactiongroup/qactiongroup.pro
index 6acbc24d86..82c0204aa8 100644
--- a/tests/auto/widgets/kernel/qactiongroup/qactiongroup.pro
+++ b/tests/auto/widgets/kernel/qactiongroup/qactiongroup.pro
@@ -5,4 +5,3 @@ QT += widgets testlib
SOURCES += tst_qactiongroup.cpp
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro
index 8084dd0f83..a10ff71b05 100644
--- a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro
+++ b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro
@@ -4,4 +4,3 @@ CONFIG -= app_bundle debug_and_release_target
DESTDIR = ./
SOURCES += main.cpp
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qapplication/modal/modal.pro b/tests/auto/widgets/kernel/qapplication/modal/modal.pro
index 1eac401b47..a34871d2aa 100644
--- a/tests/auto/widgets/kernel/qapplication/modal/modal.pro
+++ b/tests/auto/widgets/kernel/qapplication/modal/modal.pro
@@ -5,4 +5,3 @@ DESTDIR = ./
CONFIG -= app_bundle debug_and_release_target
HEADERS += base.h
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qapplication/test/test.pro b/tests/auto/widgets/kernel/qapplication/test/test.pro
index 53d18fa2df..7b00ba5293 100644
--- a/tests/auto/widgets/kernel/qapplication/test/test.pro
+++ b/tests/auto/widgets/kernel/qapplication/test/test.pro
@@ -13,6 +13,3 @@ SUBPROGRAMS = desktopsettingsaware modal
win32: !wince*: SUBPROGRAMS += wincmdline
for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../$${file}/$${file}"
-
-
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index 52cd1051ba..c6835f6076 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -316,7 +316,6 @@ void tst_QApplication::alert()
widget.activateWindow();
QApplication::setActiveWindow(&widget);
app.alert(&widget, 200);
- app.syncX();
}
void tst_QApplication::multiple_data()
@@ -1242,7 +1241,7 @@ public slots:
void DeleteLaterWidget::runTest()
{
- QObject *stillAlive = qFindChild<QObject*>(this, "deleteLater");
+ QObject *stillAlive = this->findChild<QObject*>("deleteLater");
QWidget *w = new QWidget(this);
connect(w, SIGNAL(destroyed()), this, SLOT(childDeleted()));
@@ -1288,7 +1287,7 @@ void tst_QApplication::testDeleteLater()
object->setObjectName("deleteLater");
object->deleteLater();
- QObject *stillAlive = qFindChild<QObject*>(wgt, "deleteLater");
+ QObject *stillAlive = wgt->findChild<QObject*>("deleteLater");
QVERIFY(stillAlive);
app.exec();
diff --git a/tests/auto/widgets/kernel/qapplication/wincmdline/main.cpp b/tests/auto/widgets/kernel/qapplication/wincmdline/main.cpp
index e24c21feab..e935cfd53a 100644
--- a/tests/auto/widgets/kernel/qapplication/wincmdline/main.cpp
+++ b/tests/auto/widgets/kernel/qapplication/wincmdline/main.cpp
@@ -40,14 +40,15 @@
****************************************************************************/
#include <QApplication>
#include <stdio.h>
-int main(int argc, char *argv[])
+
+int main(int argc, char *argv[])
{
- QApplication app(argc, argv);
+ QApplication app(argc, argv);
if (argc > 1)
fprintf(stderr, "%s", argv[1]);
else
fprintf(stderr, "Failed");
fflush(stderr);
- return 0;
+ return 0;
}
diff --git a/tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro b/tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro
index d4759da7a8..3e32a6798d 100644
--- a/tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro
+++ b/tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro
@@ -3,4 +3,3 @@ CONFIG -= app_bundle debug_and_release_target
SOURCES += main.cpp
DESTDIR = ./
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro b/tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro
index b683a34e51..e30a4b57b1 100644
--- a/tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro
+++ b/tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro
@@ -5,4 +5,3 @@ QT += widgets testlib
SOURCES += tst_qboxlayout.cpp
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qdesktopwidget/qdesktopwidget.pro b/tests/auto/widgets/kernel/qdesktopwidget/qdesktopwidget.pro
index c0057661d2..77709df5da 100644
--- a/tests/auto/widgets/kernel/qdesktopwidget/qdesktopwidget.pro
+++ b/tests/auto/widgets/kernel/qdesktopwidget/qdesktopwidget.pro
@@ -3,4 +3,3 @@ CONFIG += parallel_test
TARGET = tst_qdesktopwidget
QT += widgets testlib
SOURCES += tst_qdesktopwidget.cpp
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp b/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp
index 63ffc13c68..4efe8c4273 100644
--- a/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp
+++ b/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp
@@ -42,6 +42,7 @@
#include <QtTest/QtTest>
#include <QtWidgets/QDesktopWidget>
+#include <QtGui/QWindow>
#include <QDebug>
class tst_QDesktopWidget : public QObject
@@ -63,6 +64,7 @@ private slots:
void screenNumberForQPoint();
void availableGeometry();
void screenGeometry();
+ void topLevels();
};
tst_QDesktopWidget::tst_QDesktopWidget()
@@ -177,6 +179,21 @@ void tst_QDesktopWidget::screenGeometry()
}
}
+void tst_QDesktopWidget::topLevels()
+{
+ // Desktop widgets/windows should not be listed as top-levels.
+ int topLevelDesktopWidgets = 0;
+ int topLevelDesktopWindows = 0;
+ foreach (const QWidget *w, QApplication::topLevelWidgets())
+ if (w->windowType() == Qt::Desktop)
+ topLevelDesktopWidgets++;
+ foreach (const QWindow *w, QGuiApplication::topLevelWindows())
+ if (w->type() == Qt::Desktop)
+ topLevelDesktopWindows++;
+ QCOMPARE(topLevelDesktopWidgets, 0);
+ QCOMPARE(topLevelDesktopWindows, 0);
+}
+
QTEST_MAIN(tst_QDesktopWidget)
#include "tst_qdesktopwidget.moc"
diff --git a/tests/auto/widgets/kernel/qformlayout/qformlayout.pro b/tests/auto/widgets/kernel/qformlayout/qformlayout.pro
index 4a522bbf72..668b890c97 100644
--- a/tests/auto/widgets/kernel/qformlayout/qformlayout.pro
+++ b/tests/auto/widgets/kernel/qformlayout/qformlayout.pro
@@ -3,4 +3,3 @@ CONFIG += parallel_test
TARGET = tst_qformlayout
QT += widgets testlib
SOURCES += tst_qformlayout.cpp
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
index d77dd003d7..b970de8e87 100644
--- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
@@ -169,11 +169,11 @@ void tst_QFormLayout::rowCount()
fl->addRow(tr("Label 2"), new QLineEdit);
fl->addRow(tr("Label 3"), new QLineEdit);
QCOMPARE(fl->rowCount(), 3);
-
+
fl->addRow(new QWidget);
fl->addRow(new QHBoxLayout);
QCOMPARE(fl->rowCount(), 5);
-
+
fl->insertRow(1, tr("Label 0.5"), new QLineEdit);
QCOMPARE(fl->rowCount(), 6);
@@ -206,7 +206,7 @@ void tst_QFormLayout::buddies()
fl->addRow(le3);
QWidget *label3 = fl->labelForField(le3);
QVERIFY(label3 == 0);
-
+
//TODO: empty label?
delete w;
diff --git a/tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro b/tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro
index a952756080..febcee6c55 100644
--- a/tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro
+++ b/tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro
@@ -10,4 +10,3 @@ FORMS += sortdialog.ui
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qlayout/qlayout.pro b/tests/auto/widgets/kernel/qlayout/qlayout.pro
index c7751aa698..4a5db512c8 100644
--- a/tests/auto/widgets/kernel/qlayout/qlayout.pro
+++ b/tests/auto/widgets/kernel/qlayout/qlayout.pro
@@ -11,4 +11,3 @@ wince* {
} else {
TESTDATA += baseline/*
}
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
index f830ead6c0..2b9b4fd761 100644
--- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
+++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
@@ -155,7 +155,7 @@ void tst_QLayout::geometry()
void tst_QLayout::smartMaxSize()
{
- QVector<int> expectedWidths;
+ QVector<int> expectedWidths;
QFile f(QFINDTESTDATA("baseline/smartmaxsize"));
@@ -170,9 +170,9 @@ void tst_QLayout::smartMaxSize()
f.close();
int sizeCombinations[] = { 0, 10, 20, QWIDGETSIZE_MAX};
- QSizePolicy::Policy policies[] = { QSizePolicy::Fixed,
- QSizePolicy::Minimum,
- QSizePolicy::Maximum,
+ QSizePolicy::Policy policies[] = { QSizePolicy::Fixed,
+ QSizePolicy::Minimum,
+ QSizePolicy::Maximum,
QSizePolicy::Preferred,
QSizePolicy::Expanding,
QSizePolicy::MinimumExpanding,
@@ -250,7 +250,7 @@ void tst_QLayout::setContentsMargins()
MyLayout layout;
layout.invalidated = false;
int left, top, right, bottom;
-
+
layout.setContentsMargins(52, 53, 54, 55);
QVERIFY(layout.invalidated);
layout.invalidated = false;
@@ -260,7 +260,7 @@ void tst_QLayout::setContentsMargins()
QCOMPARE(top, 53);
QCOMPARE(right, 54);
QCOMPARE(bottom, 55);
-
+
layout.setContentsMargins(52, 53, 54, 55);
QVERIFY(!layout.invalidated);
}
diff --git a/tests/auto/widgets/kernel/qshortcut/qshortcut.pro b/tests/auto/widgets/kernel/qshortcut/qshortcut.pro
index 4d2e8d8acc..043d062d60 100644
--- a/tests/auto/widgets/kernel/qshortcut/qshortcut.pro
+++ b/tests/auto/widgets/kernel/qshortcut/qshortcut.pro
@@ -8,6 +8,3 @@ INCLUDEPATH += ../
QT += widgets testlib
HEADERS +=
SOURCES += tst_qshortcut.cpp
-
-
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
index 1958ebfab1..962fd3a8ab 100644
--- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
+++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
@@ -610,7 +610,6 @@ void tst_QShortcut::disabledItems()
{
clearAllShortcuts();
mainW->activateWindow();
- qApp->syncX();
QTest::qWait(100);
/* Testing Disabled Shortcuts
@@ -1072,7 +1071,6 @@ void tst_QShortcut::context()
// Changing focus to 'other2' should make the Focus context there work
other2->activateWindow();
other2->setFocus(); // ###
- qApp->syncX();
QTRY_COMPARE(qApp->activeWindow(), other2->window());
QCOMPARE(qApp->focusWidget(), (QWidget *)other2);
diff --git a/tests/auto/widgets/kernel/qsizepolicy/qsizepolicy.pro b/tests/auto/widgets/kernel/qsizepolicy/qsizepolicy.pro
index 301d097b4f..84629c7c0a 100644
--- a/tests/auto/widgets/kernel/qsizepolicy/qsizepolicy.pro
+++ b/tests/auto/widgets/kernel/qsizepolicy/qsizepolicy.pro
@@ -4,4 +4,3 @@ TARGET = tst_qsizepolicy
QT += widgets widgets-private testlib
SOURCES += tst_qsizepolicy.cpp
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qstackedlayout/qstackedlayout.pro b/tests/auto/widgets/kernel/qstackedlayout/qstackedlayout.pro
index ad780e77fa..cd80253e12 100644
--- a/tests/auto/widgets/kernel/qstackedlayout/qstackedlayout.pro
+++ b/tests/auto/widgets/kernel/qstackedlayout/qstackedlayout.pro
@@ -6,4 +6,3 @@ SOURCES += tst_qstackedlayout.cpp
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp b/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp
index c4c8022237..9ab7bb5305 100644
--- a/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp
+++ b/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp
@@ -132,7 +132,6 @@ void tst_QStackedLayout::init()
// make sure the tests work with focus follows mouse
QCursor::setPos(testWidget->geometry().center());
testWidget->activateWindow();
- QApplication::syncX();
QTest::qWait(250);
}
diff --git a/tests/auto/widgets/kernel/qtooltip/qtooltip.pro b/tests/auto/widgets/kernel/qtooltip/qtooltip.pro
index 8a875d3c6a..6e5dd738cb 100644
--- a/tests/auto/widgets/kernel/qtooltip/qtooltip.pro
+++ b/tests/auto/widgets/kernel/qtooltip/qtooltip.pro
@@ -2,4 +2,3 @@ CONFIG += testcase
TARGET = tst_qtooltip
QT += widgets testlib
SOURCES += tst_qtooltip.cpp
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
index 2d3e3c1702..441277ef53 100644
--- a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
+++ b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
@@ -132,7 +132,7 @@ void tst_QToolTip::whatsThis()
{
qApp->setStyleSheet( "QWidget { font-size: 72px; }" );
QWhatsThis::showText(QPoint(0,0), "THis is text");
- QTest::qWait(400);
+ QTest::qWait(400);
QWidget *whatsthis = 0;
foreach (QWidget *widget, QApplication::topLevelWidgets()) {
if (widget->inherits("QWhatsThat")) {
diff --git a/tests/auto/widgets/kernel/qwidget/qwidget.pro b/tests/auto/widgets/kernel/qwidget/qwidget.pro
index 997311179a..6916ee85e6 100644
--- a/tests/auto/widgets/kernel/qwidget/qwidget.pro
+++ b/tests/auto/widgets/kernel/qwidget/qwidget.pro
@@ -23,4 +23,3 @@ x11 {
!wince*:win32: LIBS += -luser32 -lgdi32
mac:CONFIG+=insignificant_test # QTBUG-25300, QTBUG-23695
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index ba60dd0c01..69d890fb7a 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -412,6 +412,7 @@ private slots:
void keyboardModifiers();
void mouseDoubleClickBubbling_QTBUG29680();
+ void largerThanScreen_QTBUG30142();
private:
bool ensureScreenSize(int width, int height);
@@ -4239,11 +4240,11 @@ void tst_QWidget::isOpaque()
*/
void tst_QWidget::scroll()
{
- if (m_platform == QStringLiteral("xcb"))
- QSKIP("X11: Skip unstable test");
+ const int w = qMin(500, qApp->desktop()->availableGeometry().width() / 2);
+ const int h = qMin(500, qApp->desktop()->availableGeometry().height() / 2);
UpdateWidget updateWidget;
- updateWidget.resize(500, 500);
+ updateWidget.resize(w, h);
updateWidget.reset();
updateWidget.move(QGuiApplication::primaryScreen()->geometry().center() - QPoint(250, 250));
updateWidget.show();
@@ -4255,8 +4256,8 @@ void tst_QWidget::scroll()
updateWidget.reset();
updateWidget.scroll(10, 10);
qApp->processEvents();
- QRegion dirty(QRect(0, 0, 500, 10));
- dirty += QRegion(QRect(0, 10, 10, 490));
+ QRegion dirty(QRect(0, 0, w, 10));
+ dirty += QRegion(QRect(0, 10, 10, h - 10));
QTRY_COMPARE(updateWidget.paintedRegion, dirty);
}
@@ -4265,11 +4266,14 @@ void tst_QWidget::scroll()
updateWidget.update(0, 0, 10, 10);
updateWidget.scroll(0, 10);
qApp->processEvents();
- QRegion dirty(QRect(0, 0, 500, 10));
+ QRegion dirty(QRect(0, 0, w, 10));
dirty += QRegion(QRect(0, 10, 10, 10));
QTRY_COMPARE(updateWidget.paintedRegion, dirty);
}
+ if (updateWidget.width() < 200 || updateWidget.height() < 200)
+ QSKIP("Skip this test due to too small screen geometry.");
+
{
updateWidget.reset();
updateWidget.update(0, 0, 100, 100);
@@ -5434,7 +5438,7 @@ void tst_QWidget::setToolTip()
QScopedPointer<QWidget> popup(new QWidget(0, Qt::Popup));
popup->setObjectName(QString::fromLatin1("tst_qwidget setToolTip #%1").arg(pass));
popup->setWindowTitle(popup->objectName());
- popup->resize(150, 50);
+ popup->setGeometry(50, 50, 150, 50);
QFrame *frame = new QFrame(popup.data());
frame->setGeometry(0, 0, 50, 50);
frame->setFrameStyle(QFrame::Box | QFrame::Plain);
@@ -5630,6 +5634,7 @@ void tst_QWidget::showHideShowX11()
qApp->installNativeEventFilter(&w);
w.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
w.hide();
QEventLoop eventLoop;
@@ -6125,7 +6130,7 @@ static void workaroundPaletteIssue(QWidget *widget)
if (!widget)
return;
- QWidget *navigationBar = qFindChild<QWidget *>(widget, QLatin1String("qt_calendar_navigationbar"));
+ QWidget *navigationBar = widget->findChild<QWidget *>(QLatin1String("qt_calendar_navigationbar"));
QVERIFY(navigationBar);
QPalette palette = navigationBar->palette();
@@ -6224,7 +6229,7 @@ void tst_QWidget::renderInvisible()
}
// Get navigation bar and explicitly hide it.
- QWidget *navigationBar = qFindChild<QWidget *>(calendar.data(), QLatin1String("qt_calendar_navigationbar"));
+ QWidget *navigationBar = calendar.data()->findChild<QWidget *>(QLatin1String("qt_calendar_navigationbar"));
QVERIFY(navigationBar);
navigationBar->hide();
@@ -6247,7 +6252,7 @@ void tst_QWidget::renderInvisible()
}
// Get next month button.
- QWidget *nextMonthButton = qFindChild<QWidget *>(navigationBar, QLatin1String("qt_calendar_nextmonth"));
+ QWidget *nextMonthButton = navigationBar->findChild<QWidget *>(QLatin1String("qt_calendar_nextmonth"));
QVERIFY(nextMonthButton);
{ // Render next month button.
@@ -7014,7 +7019,7 @@ void tst_QWidget::moveWindowInShowEvent()
// show it
widget.show();
- QVERIFY(QTest::qWaitForWindowShown(&widget));
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
QTest::qWait(100);
// it should have moved
QCOMPARE(widget.pos(), position);
@@ -10077,5 +10082,20 @@ void tst_QWidget::mouseDoubleClickBubbling_QTBUG29680()
QTRY_VERIFY(parent.triggered);
}
+void tst_QWidget::largerThanScreen_QTBUG30142()
+{
+ QWidget widget;
+ widget.resize(200, 4000);
+ widget.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
+ QVERIFY(widget.frameGeometry().y() >= 0);
+
+ QWidget widget2;
+ widget2.resize(10000, 400);
+ widget2.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&widget2));
+ QVERIFY(widget2.frameGeometry().x() >= 0);
+}
+
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"
diff --git a/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro b/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro
index 9798f1559a..baa2823f9a 100644
--- a/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro
+++ b/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro
@@ -8,4 +8,3 @@ x11 {
LIBS += $$QMAKE_LIBS_X11
}
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qwidgetaction/qwidgetaction.pro b/tests/auto/widgets/kernel/qwidgetaction/qwidgetaction.pro
index 3f8b26791b..0029ebd51e 100644
--- a/tests/auto/widgets/kernel/qwidgetaction/qwidgetaction.pro
+++ b/tests/auto/widgets/kernel/qwidgetaction/qwidgetaction.pro
@@ -5,4 +5,3 @@ QT += widgets testlib
SOURCES += tst_qwidgetaction.cpp
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qwidgetmetatype/qwidgetmetatype.pro b/tests/auto/widgets/kernel/qwidgetmetatype/qwidgetmetatype.pro
index 3fb0db9426..55228e6a1e 100644
--- a/tests/auto/widgets/kernel/qwidgetmetatype/qwidgetmetatype.pro
+++ b/tests/auto/widgets/kernel/qwidgetmetatype/qwidgetmetatype.pro
@@ -2,4 +2,3 @@ CONFIG += testcase
TARGET = tst_qwidgetmetatype
QT += widgets testlib
SOURCES += tst_qwidgetmetatype.cpp
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qwidgetsvariant/qwidgetsvariant.pro b/tests/auto/widgets/kernel/qwidgetsvariant/qwidgetsvariant.pro
index 9ad0e9a8c8..e3f2da96bd 100644
--- a/tests/auto/widgets/kernel/qwidgetsvariant/qwidgetsvariant.pro
+++ b/tests/auto/widgets/kernel/qwidgetsvariant/qwidgetsvariant.pro
@@ -5,4 +5,3 @@ INCLUDEPATH += $$PWD/../../../other/qvariant_common
SOURCES += tst_qwidgetsvariant.cpp
QT += testlib widgets
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/kernel/qwindowcontainer/.gitignore b/tests/auto/widgets/kernel/qwindowcontainer/.gitignore
new file mode 100644
index 0000000000..038f477220
--- /dev/null
+++ b/tests/auto/widgets/kernel/qwindowcontainer/.gitignore
@@ -0,0 +1 @@
+tst_qwindowcontainer
diff --git a/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro b/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro
new file mode 100644
index 0000000000..4ff05eb04a
--- /dev/null
+++ b/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro
@@ -0,0 +1,6 @@
+CONFIG += testcase
+mac:CONFIG -= app_bundle
+# CONFIG += parallel_test // Cannot be parallel due to the activation test
+TARGET = tst_qwindowcontainer
+QT += widgets testlib
+SOURCES += tst_qwindowcontainer.cpp
diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
new file mode 100644
index 0000000000..440639cd49
--- /dev/null
+++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
@@ -0,0 +1,226 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+#include <qapplication.h>
+#include <qwindow.h>
+#include <qwidget.h>
+
+
+
+class Window : public QWindow
+{
+public:
+ Window()
+ : numberOfExposes(0)
+ , numberOfObscures(0)
+ {
+ }
+
+ void exposeEvent(QExposeEvent *) {
+ if (isExposed())
+ ++numberOfExposes;
+ else
+ ++numberOfObscures;
+ }
+
+ int numberOfExposes;
+ int numberOfObscures;
+};
+
+
+
+class tst_QWindowContainer: public QObject
+{
+ Q_OBJECT
+private slots:
+ void testShow();
+ void testPositionAndSize();
+ void testExposeObscure();
+ void testOwnership();
+ void testBehindTheScenesDeletion();
+ void testUnparenting();
+ void testActivation();
+};
+
+
+
+void tst_QWindowContainer::testShow()
+{
+ QWidget root;
+ root.setGeometry(100, 100, 400, 400);
+
+ Window *window = new Window();
+ QWidget *container = QWidget::createWindowContainer(window, &root);
+
+ container->setGeometry(50, 50, 200, 200);
+
+ root.show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+}
+
+
+
+void tst_QWindowContainer::testPositionAndSize()
+{
+ QWindow *window = new QWindow();
+ window->setGeometry(300, 400, 500, 600);
+
+ QWidget *container = QWidget::createWindowContainer(window);
+ container->setGeometry(50, 50, 200, 200);
+
+
+ container->show();
+ QVERIFY(QTest::qWaitForWindowExposed(container));
+
+ QCOMPARE(window->x(), 0);
+ QCOMPARE(window->y(), 0);
+ QCOMPARE(window->width(), container->width());
+ QCOMPARE(window->height(), container->height());
+}
+
+
+
+void tst_QWindowContainer::testExposeObscure()
+{
+ Window *window = new Window();
+
+ QWidget *container = QWidget::createWindowContainer(window);
+ container->setGeometry(50, 50, 200, 200);
+
+ container->show();
+ QVERIFY(QTest::qWaitForWindowExposed(container));
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QVERIFY(window->numberOfExposes > 0);
+
+ container->hide();
+
+ QElapsedTimer timer;
+ timer.start();
+ while (window->numberOfObscures == 0 && timer.elapsed() < 5000) {
+ QTest::qWait(10);
+ }
+
+ QVERIFY(window->numberOfObscures > 0);
+}
+
+
+
+void tst_QWindowContainer::testOwnership()
+{
+ QPointer<QWindow> window(new QWindow());
+ QWidget *container = QWidget::createWindowContainer(window);
+
+ delete container;
+
+ QCOMPARE(window.data(), (QWindow *) 0);
+}
+
+
+
+void tst_QWindowContainer::testBehindTheScenesDeletion()
+{
+ QWindow *window = new QWindow();
+ QWidget *container = QWidget::createWindowContainer(window);
+
+ delete window;
+
+ // The child got removed, showing not should not have any side effects,
+ // such as for instance, crashing...
+ container->show();
+ QVERIFY(QTest::qWaitForWindowExposed(container));
+ delete container;
+}
+
+
+
+void tst_QWindowContainer::testActivation()
+{
+ QWidget root;
+
+ QWindow *window = new QWindow();
+ QWidget *container = QWidget::createWindowContainer(window, &root);
+
+ container->setGeometry(100, 100, 200, 100);
+ root.setGeometry(100, 100, 400, 300);
+
+ root.show();
+ root.activateWindow();
+
+ QVERIFY(QTest::qWaitForWindowActive(root.windowHandle()));
+ QVERIFY(QGuiApplication::focusWindow() == root.windowHandle());
+
+ // Under KDE (ubuntu 12.10), we experience that doing two activateWindow in a row
+ // does not work. The second gets ignored by the window manager, even though the
+ // timestamp in the xcb connection is unique for both.
+ if (QGuiApplication::platformName() == "xcb")
+ QTest::qWait(100);
+
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+}
+
+
+
+void tst_QWindowContainer::testUnparenting()
+{
+ QWindow *window = new QWindow();
+ QWidget *container = QWidget::createWindowContainer(window);
+ container->setGeometry(100, 100, 200, 100);
+
+ window->setParent(0);
+
+ container->show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(container));
+
+ // Window should not be made visible by container..
+ QVERIFY(!window->isVisible());
+}
+
+QTEST_MAIN(tst_QWindowContainer)
+
+#include "tst_qwindowcontainer.moc"