summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp6
-rw-r--r--tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp94
-rw-r--r--tests/auto/other/qobjectrace/tst_qobjectrace.cpp76
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp9
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp5
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp14
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp12
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp4
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp28
9 files changed, 165 insertions, 83 deletions
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index 1e2b0ed649..6c80c5ff47 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -2903,6 +2903,12 @@ void tst_QDateTime::timeZones() const
// - Test 03:00:00 = 1 hour after tran
hourAfterStd = QDateTime(QDate(2013, 10, 27), QTime(3, 0, 0), cet);
QCOMPARE(hourAfterStd.toMSecsSinceEpoch(), dstToStdMSecs + 3600000);
+
+ // Test Time Zone that has transitions but no future transitions afer a given date
+ QTimeZone sgt("Asia/Singapore");
+ QDateTime future(QDate(2015, 1, 1), QTime(0, 0, 0), sgt);
+ QVERIFY(future.isValid());
+ QCOMPARE(future.offsetFromUtc(), 28800);
}
void tst_QDateTime::invalid() const
diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
index ed08bcefbf..d7643ff55d 100644
--- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
@@ -57,6 +57,7 @@ private slots:
void nullTest();
void dataStreamTest();
void availableTimeZoneIds();
+ void stressTest();
void windowsId();
// Backend tests
void utcTest();
@@ -75,7 +76,7 @@ private:
tst_QTimeZone::tst_QTimeZone()
{
- // Set to true to print debug output
+ // Set to true to print debug output, test Display Names and run long stress tests
debug = false;
}
@@ -367,11 +368,59 @@ void tst_QTimeZone::availableTimeZoneIds()
}
}
+void tst_QTimeZone::stressTest()
+{
+ QList<QByteArray> idList = QTimeZone::availableTimeZoneIds();
+ foreach (const QByteArray &id, idList) {
+ QTimeZone testZone = QTimeZone(id);
+ QCOMPARE(testZone.isValid(), true);
+ QCOMPARE(testZone.id(), id);
+ QDateTime testDate = QDateTime(QDate(2015, 1, 1), QTime(0, 0, 0), Qt::UTC);
+ testZone.country();
+ testZone.comment();
+ testZone.displayName(testDate);
+ testZone.displayName(QTimeZone::DaylightTime);
+ testZone.displayName(QTimeZone::StandardTime);
+ testZone.abbreviation(testDate);
+ testZone.offsetFromUtc(testDate);
+ testZone.standardTimeOffset(testDate);
+ testZone.daylightTimeOffset(testDate);
+ testZone.hasDaylightTime();
+ testZone.isDaylightTime(testDate);
+ testZone.offsetData(testDate);
+ testZone.hasTransitions();
+ testZone.nextTransition(testDate);
+ testZone.previousTransition(testDate);
+ // Dates known to be outside possible tz file pre-calculated rules range
+ QDateTime lowDate1 = QDateTime(QDate(1800, 1, 1), QTime(0, 0, 0), Qt::UTC);
+ QDateTime lowDate2 = QDateTime(QDate(1800, 6, 1), QTime(0, 0, 0), Qt::UTC);
+ QDateTime highDate1 = QDateTime(QDate(2200, 1, 1), QTime(0, 0, 0), Qt::UTC);
+ QDateTime highDate2 = QDateTime(QDate(2200, 6, 1), QTime(0, 0, 0), Qt::UTC);
+ testZone.nextTransition(lowDate1);
+ testZone.nextTransition(lowDate2);
+ testZone.previousTransition(lowDate2);
+ testZone.previousTransition(lowDate2);
+ testZone.nextTransition(highDate1);
+ testZone.nextTransition(highDate2);
+ testZone.previousTransition(highDate1);
+ testZone.previousTransition(highDate2);
+ if (debug) {
+ // This could take a long time, depending on platform and database
+ qDebug() << "Stress test calculating transistions for" << testZone.id();
+ testZone.transitions(lowDate1, highDate1);
+ }
+ testDate.setTimeZone(testZone);
+ testDate.isValid();
+ testDate.offsetFromUtc();
+ testDate.timeZoneAbbreviation();
+ }
+}
+
void tst_QTimeZone::windowsId()
{
/*
Current Windows zones for "Central Standard Time":
- Region Olsen Id(s)
+ Region IANA Id(s)
Default "America/Chicago"
Canada "America/Winnipeg America/Rainy_River America/Rankin_Inlet America/Resolute"
Mexico "America/Matamoros"
@@ -380,24 +429,24 @@ void tst_QTimeZone::windowsId()
"America/North_Dakota/New_Salem"
AnyCountry "CST6CDT"
*/
- QCOMPARE(QTimeZone::olsenIdToWindowsId("America/Chicago"),
+ QCOMPARE(QTimeZone::ianaIdToWindowsId("America/Chicago"),
QByteArray("Central Standard Time"));
- QCOMPARE(QTimeZone::olsenIdToWindowsId("America/Resolute"),
+ QCOMPARE(QTimeZone::ianaIdToWindowsId("America/Resolute"),
QByteArray("Central Standard Time"));
// Partials shouldn't match
- QCOMPARE(QTimeZone::olsenIdToWindowsId("America/Chi"), QByteArray());
- QCOMPARE(QTimeZone::olsenIdToWindowsId("InvalidZone"), QByteArray());
- QCOMPARE(QTimeZone::olsenIdToWindowsId(QByteArray()), QByteArray());
+ QCOMPARE(QTimeZone::ianaIdToWindowsId("America/Chi"), QByteArray());
+ QCOMPARE(QTimeZone::ianaIdToWindowsId("InvalidZone"), QByteArray());
+ QCOMPARE(QTimeZone::ianaIdToWindowsId(QByteArray()), QByteArray());
// Check default value
- QCOMPARE(QTimeZone::windowsIdToDefaultOlsenId("Central Standard Time"),
+ QCOMPARE(QTimeZone::windowsIdToDefaultIanaId("Central Standard Time"),
QByteArray("America/Chicago"));
- QCOMPARE(QTimeZone::windowsIdToDefaultOlsenId("Central Standard Time", QLocale::Canada),
+ QCOMPARE(QTimeZone::windowsIdToDefaultIanaId("Central Standard Time", QLocale::Canada),
QByteArray("America/Winnipeg"));
- QCOMPARE(QTimeZone::windowsIdToDefaultOlsenId("Central Standard Time", QLocale::AnyCountry),
+ QCOMPARE(QTimeZone::windowsIdToDefaultIanaId("Central Standard Time", QLocale::AnyCountry),
QByteArray("CST6CDT"));
- QCOMPARE(QTimeZone::windowsIdToDefaultOlsenId(QByteArray()), QByteArray());
+ QCOMPARE(QTimeZone::windowsIdToDefaultIanaId(QByteArray()), QByteArray());
// No country is sorted list of all zones
QList<QByteArray> list;
@@ -406,39 +455,39 @@ void tst_QTimeZone::windowsId()
<< "America/North_Dakota/Center" << "America/North_Dakota/New_Salem"
<< "America/Rainy_River" << "America/Rankin_Inlet" << "America/Resolute"
<< "America/Winnipeg" << "CST6CDT";
- QCOMPARE(QTimeZone::windowsIdToOlsenIds("Central Standard Time"), list);
+ QCOMPARE(QTimeZone::windowsIdToIanaIds("Central Standard Time"), list);
// Check country with no match returns empty list
list.clear();
- QCOMPARE(QTimeZone::windowsIdToOlsenIds("Central Standard Time", QLocale::NewZealand),
+ QCOMPARE(QTimeZone::windowsIdToIanaIds("Central Standard Time", QLocale::NewZealand),
list);
// Check valid country returns list in preference order
list.clear();
list << "America/Winnipeg" << "America/Rainy_River" << "America/Rankin_Inlet"
<< "America/Resolute";
- QCOMPARE(QTimeZone::windowsIdToOlsenIds("Central Standard Time", QLocale::Canada), list);
+ QCOMPARE(QTimeZone::windowsIdToIanaIds("Central Standard Time", QLocale::Canada), list);
list.clear();
list << "America/Matamoros";
- QCOMPARE(QTimeZone::windowsIdToOlsenIds("Central Standard Time", QLocale::Mexico), list);
+ QCOMPARE(QTimeZone::windowsIdToIanaIds("Central Standard Time", QLocale::Mexico), list);
list.clear();
list << "America/Chicago" << "America/Indiana/Knox" << "America/Indiana/Tell_City"
<< "America/Menominee" << "America/North_Dakota/Beulah" << "America/North_Dakota/Center"
<< "America/North_Dakota/New_Salem";
- QCOMPARE(QTimeZone::windowsIdToOlsenIds("Central Standard Time", QLocale::UnitedStates),
+ QCOMPARE(QTimeZone::windowsIdToIanaIds("Central Standard Time", QLocale::UnitedStates),
list);
list.clear();
list << "CST6CDT";
- QCOMPARE(QTimeZone::windowsIdToOlsenIds("Central Standard Time", QLocale::AnyCountry),
+ QCOMPARE(QTimeZone::windowsIdToIanaIds("Central Standard Time", QLocale::AnyCountry),
list);
// Check no windowsId return empty
list.clear();
- QCOMPARE(QTimeZone::windowsIdToOlsenIds(QByteArray()), list);
- QCOMPARE(QTimeZone::windowsIdToOlsenIds(QByteArray(), QLocale::AnyCountry), list);
+ QCOMPARE(QTimeZone::windowsIdToIanaIds(QByteArray()), list);
+ QCOMPARE(QTimeZone::windowsIdToIanaIds(QByteArray(), QLocale::AnyCountry), list);
}
void tst_QTimeZone::utcTest()
@@ -639,10 +688,11 @@ void tst_QTimeZone::tzTest()
QCOMPARE(dat.standardTimeOffset, 3600);
QCOMPARE(dat.daylightTimeOffset, 0);
+ // Test previous to low value is invalid
dat = tzp.previousTransition(-9999999999999);
- QCOMPARE(dat.atMSecsSinceEpoch, (qint64)-2422054408000);
- QCOMPARE(dat.standardTimeOffset, 3600);
- QCOMPARE(dat.daylightTimeOffset, 0);
+ QCOMPARE(dat.atMSecsSinceEpoch, std::numeric_limits<qint64>::min());
+ QCOMPARE(dat.standardTimeOffset, std::numeric_limits<int>::min());
+ QCOMPARE(dat.daylightTimeOffset, std::numeric_limits<int>::min());
dat = tzp.nextTransition(-9999999999999);
QCOMPARE(dat.atMSecsSinceEpoch, (qint64)-2422054408000);
diff --git a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp
index ab05c64fe5..71a90e83f7 100644
--- a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp
+++ b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp
@@ -47,6 +47,12 @@
enum { OneMinute = 60 * 1000,
TwoMinutes = OneMinute * 2 };
+
+struct Functor
+{
+ void operator()() const {};
+};
+
class tst_QObjectRace: public QObject
{
Q_OBJECT
@@ -122,11 +128,7 @@ signals:
private slots:
void checkStopWatch()
{
-#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS)
- if (stopWatch.elapsed() >= OneMinute / 2)
-#else
- if (stopWatch.elapsed() >= OneMinute)
-#endif
+ if (stopWatch.elapsed() >= 5000)
quit();
QObject o;
@@ -188,16 +190,34 @@ class MyObject : public QObject
void signal7();
};
+namespace {
+const char *_slots[] = { SLOT(slot1()) , SLOT(slot2()) , SLOT(slot3()),
+ SLOT(slot4()) , SLOT(slot5()) , SLOT(slot6()),
+ SLOT(slot7()) };
+
+const char *_signals[] = { SIGNAL(signal1()), SIGNAL(signal2()), SIGNAL(signal3()),
+ SIGNAL(signal4()), SIGNAL(signal5()), SIGNAL(signal6()),
+ SIGNAL(signal7()) };
+typedef void (MyObject::*PMFType)();
+const PMFType _slotsPMF[] = { &MyObject::slot1, &MyObject::slot2, &MyObject::slot3,
+ &MyObject::slot4, &MyObject::slot5, &MyObject::slot6,
+ &MyObject::slot7 };
+
+const PMFType _signalsPMF[] = { &MyObject::signal1, &MyObject::signal2, &MyObject::signal3,
+ &MyObject::signal4, &MyObject::signal5, &MyObject::signal6,
+ &MyObject::signal7 };
+
+}
class DestroyThread : public QThread
{
Q_OBJECT
- QObject **objects;
+ MyObject **objects;
int number;
public:
- void setObjects(QObject **o, int n)
+ void setObjects(MyObject **o, int n)
{
objects = o;
number = n;
@@ -206,8 +226,29 @@ public:
}
void run() {
- for(int i = 0; i < number; i++)
+ for (int i = number-1; i >= 0; --i) {
+ /* Do some more connection and disconnection between object in this thread that have not been destroyed yet */
+
+ const int nAlive = i+1;
+ connect (objects[((i+1)*31) % nAlive], _signals[(12*i)%7], objects[((i+2)*37) % nAlive], _slots[(15*i+2)%7] );
+ disconnect(objects[((i+1)*31) % nAlive], _signals[(12*i)%7], objects[((i+2)*37) % nAlive], _slots[(15*i+2)%7] );
+
+ connect (objects[((i+4)*41) % nAlive], _signalsPMF[(18*i)%7], objects[((i+5)*43) % nAlive], _slotsPMF[(19*i+2)%7] );
+ disconnect(objects[((i+4)*41) % nAlive], _signalsPMF[(18*i)%7], objects[((i+5)*43) % nAlive], _slotsPMF[(19*i+2)%7] );
+
+ QMetaObject::Connection c = connect(objects[((i+5)*43) % nAlive], _signalsPMF[(9*i+1)%7], Functor());
+ disconnect(c);
+
+ disconnect(objects[i], _signalsPMF[(10*i+5)%7], 0, 0);
+ disconnect(objects[i], _signals[(11*i+6)%7], 0, 0);
+
+ disconnect(objects[i], 0, objects[(i*17+6) % nAlive], 0);
+ if (i%4 == 1) {
+ disconnect(objects[i], 0, 0, 0);
+ }
+
delete objects[i];
+ }
}
};
@@ -216,27 +257,24 @@ public:
void tst_QObjectRace::destroyRace()
{
- enum { ThreadCount = 10, ObjectCountPerThread = 733,
+ enum { ThreadCount = 10, ObjectCountPerThread = 2777,
ObjectCount = ThreadCount * ObjectCountPerThread };
- const char *_slots[] = { SLOT(slot1()) , SLOT(slot2()) , SLOT(slot3()),
- SLOT(slot4()) , SLOT(slot5()) , SLOT(slot6()),
- SLOT(slot7()) };
-
- const char *_signals[] = { SIGNAL(signal1()), SIGNAL(signal2()), SIGNAL(signal3()),
- SIGNAL(signal4()), SIGNAL(signal5()), SIGNAL(signal6()),
- SIGNAL(signal7()) };
-
- QObject *objects[ObjectCount];
+ MyObject *objects[ObjectCount];
for (int i = 0; i < ObjectCount; ++i)
objects[i] = new MyObject;
- for (int i = 0; i < ObjectCount * 11; ++i) {
+ for (int i = 0; i < ObjectCount * 17; ++i) {
connect(objects[(i*13) % ObjectCount], _signals[(2*i)%7],
objects[((i+2)*17) % ObjectCount], _slots[(3*i+2)%7] );
connect(objects[((i+6)*23) % ObjectCount], _signals[(5*i+4)%7],
objects[((i+8)*41) % ObjectCount], _slots[(i+6)%7] );
+
+ connect(objects[(i*67) % ObjectCount], _signalsPMF[(2*i)%7],
+ objects[((i+1)*71) % ObjectCount], _slotsPMF[(3*i+2)%7] );
+ connect(objects[((i+3)*73) % ObjectCount], _signalsPMF[(5*i+4)%7],
+ objects[((i+5)*79) % ObjectCount], Functor() );
}
DestroyThread *threads[ThreadCount];
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 61a2abc084..9cb391d5f4 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -212,7 +212,14 @@ void tst_QFileSystemModel::rootPath()
QString oldRootPath = model->rootPath();
const QStringList documentPaths = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
QVERIFY(!documentPaths.isEmpty());
- const QString documentPath = documentPaths.front();
+ QString documentPath = documentPaths.front();
+ // In particular on Linux, ~/Documents (the first
+ // DocumentsLocation) may not exist, so choose ~ in that case:
+ if (!QFile::exists(documentPath)) {
+ documentPath = QDir::homePath();
+ qWarning("%s: first documentPath \"%s\" does not exist. Using ~ (\"%s\") instead.",
+ Q_FUNC_INFO, qPrintable(documentPaths.front()), qPrintable(documentPath));
+ }
root = model->setRootPath(documentPath);
QTRY_VERIFY(model->rowCount(root) >= 0);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index fe1df6c8f0..15c92663ec 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -4072,6 +4072,7 @@ void tst_QGraphicsScene::isActive()
{
+ const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry();
QWidget toplevel2;
QHBoxLayout *layout = new QHBoxLayout;
toplevel2.setLayout(layout);
@@ -4085,12 +4086,13 @@ void tst_QGraphicsScene::isActive()
QVERIFY(!scene1.hasFocus());
QVERIFY(!scene2.hasFocus());
+ toplevel2.move(availableGeometry.topLeft() + QPoint(50, 50));
toplevel2.show();
QApplication::setActiveWindow(&toplevel2);
QVERIFY(QTest::qWaitForWindowActive(&toplevel2));
QCOMPARE(QApplication::activeWindow(), &toplevel2);
- QVERIFY(scene1.isActive());
+ QTRY_VERIFY(scene1.isActive());
QVERIFY(!scene2.isActive());
QVERIFY(scene1.hasFocus());
QVERIFY(!scene2.hasFocus());
@@ -4133,6 +4135,7 @@ void tst_QGraphicsScene::isActive()
QVERIFY(!scene2.hasFocus());
QGraphicsView topLevelView;
+ topLevelView.move(availableGeometry.topLeft() + QPoint(500, 50));
topLevelView.show();
QApplication::setActiveWindow(&topLevelView);
topLevelView.setFocus();
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 7a0ba50ff0..37cc6522a2 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -4687,13 +4687,17 @@ public:
void tst_QGraphicsView::hoverLeave()
{
+ const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry();
QGraphicsScene scene;
QGraphicsView view(&scene);
+ view.resize(160, 160);
+ view.move(availableGeometry.center() - QPoint(80, 80));
GraphicsItemWithHover *item = new GraphicsItemWithHover;
scene.addItem(item);
// move the cursor out of the way
- QCursor::setPos(1,1);
+ const QPoint outOfWindow = view.geometry().topRight() + QPoint(50, 0);
+ QCursor::setPos(outOfWindow);
view.show();
qApp->setActiveWindow(&view);
@@ -4701,16 +4705,14 @@ void tst_QGraphicsView::hoverLeave()
QPoint pos = view.viewport()->mapToGlobal(view.mapFromScene(item->mapToScene(10, 10)));
QCursor::setPos(pos);
- QTest::qWait(200);
- QVERIFY(item->receivedEnterEvent);
+ QTRY_VERIFY(item->receivedEnterEvent);
QCOMPARE(item->enterWidget, view.viewport());
- QCursor::setPos(1,1);
- QTest::qWait(200);
+ QCursor::setPos(outOfWindow);
#ifdef Q_OS_MAC
QEXPECT_FAIL("", "QTBUG-26274 - behaviour regression", Abort);
#endif
- QVERIFY(item->receivedLeaveEvent);
+ QTRY_VERIFY(item->receivedLeaveEvent);
QCOMPARE(item->leaveWidget, view.viewport());
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index 2dd2089f81..3271b31692 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -53,6 +53,7 @@
#include <qwidgetaction.h>
#include <qcommonstyle.h>
#include <qstylefactory.h>
+#include <qscreen.h>
#include "../../../qtest-config.h"
@@ -1780,8 +1781,11 @@ void tst_QGraphicsWidget::verifyFocusChain()
void tst_QGraphicsWidget::updateFocusChainWhenChildDie()
{
+ const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry();
QGraphicsScene scene;
QGraphicsView view(&scene);
+ view.resize(200, 150);
+ view.move(availableGeometry.topLeft() + QPoint(50, 50));
view.show();
QApplication::setActiveWindow(&view);
QVERIFY(QTest::qWaitForWindowActive(&view));
@@ -1801,6 +1805,9 @@ void tst_QGraphicsWidget::updateFocusChainWhenChildDie()
QVERIFY(w1_1->hasFocus());
QWidget myWidget(0);
QLineEdit edit(&myWidget);
+ (new QHBoxLayout(&myWidget))->addWidget(&edit);
+ edit.setMinimumWidth(160); // Windows
+ myWidget.move(availableGeometry.topLeft() + QPoint(350, 50));
myWidget.show();
edit.setFocus();
QTRY_VERIFY(edit.hasFocus());
@@ -1809,8 +1816,9 @@ void tst_QGraphicsWidget::updateFocusChainWhenChildDie()
w->setParentItem(parent);
//We don't crash perfect
QVERIFY(w);
- QTest::mouseMove(view.viewport());
- QTest::mouseClick(view.viewport(), Qt::LeftButton, 0);
+ const QPoint center(view.viewport()->width() / 2, view.viewport()->height() / 2);
+ QTest::mouseMove(view.viewport(), center);
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, center);
#ifdef Q_OS_MAC
QEXPECT_FAIL("", "QTBUG-23699", Continue);
#endif
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 7bb5fd4614..03d6c1cdbd 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -7192,10 +7192,6 @@ void tst_QWidget::hideOpaqueChildWhileHidden()
#if !defined(Q_OS_WINCE)
void tst_QWidget::updateWhileMinimized()
{
-#ifdef Q_OS_UNIX
- if (qgetenv("XDG_CURRENT_DESKTOP").contains("Unity"))
- QSKIP("This test fails on Unity."); // Minimized windows are not unmapped for some reason.
-#endif // Q_OS_UNIX
UpdateWidget widget;
// Filter out activation change and focus events to avoid update() calls in QWidget.
widget.updateOnActivationChangeAndFocusIn = false;
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 f5585c583a..1bbbfd610e 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
@@ -91,8 +91,6 @@ private slots:
void tst_showWithoutActivating();
void tst_paintEventOnSecondShow();
- void obscuredNativeMapped();
-
#ifndef QT_NO_DRAGANDDROP
void tst_dnd();
#endif
@@ -370,32 +368,6 @@ void tst_QWidget_window::tst_paintEventOnSecondShow()
QTRY_VERIFY(w.paintEventReceived);
}
-// QTBUG-33520, a toplevel fully obscured by native children should still receive Qt::WA_Mapped
-void tst_QWidget_window::obscuredNativeMapped()
-{
- enum { size = 200 };
-
- QWidget topLevel;
- topLevel.setWindowFlags(Qt::FramelessWindowHint);
- QWidget *child = new QWidget(&topLevel);
- child->resize(size, size);
- topLevel.resize(size, size);
- topLevel.move(QGuiApplication::primaryScreen()->availableGeometry().center() - QPoint(size /2 , size / 2));
- child->winId();
- topLevel.show();
- QTRY_VERIFY(topLevel.testAttribute(Qt::WA_Mapped));
-#if defined(Q_OS_MAC)
- QSKIP("This test fails on Mac."); // Minimized windows are not unmapped for some reason.
-#elif defined(Q_OS_UNIX)
- if (qgetenv("XDG_CURRENT_DESKTOP").contains("Unity"))
- QSKIP("This test fails on Unity."); // Minimized windows are not unmapped for some reason.
-#endif // Q_OS_UNIX
- topLevel.setWindowState(Qt::WindowMinimized);
- QTRY_VERIFY(!topLevel.testAttribute(Qt::WA_Mapped));
- topLevel.setWindowState(Qt::WindowNoState);
- QTRY_VERIFY(topLevel.testAttribute(Qt::WA_Mapped));
-}
-
#ifndef QT_NO_DRAGANDDROP
/* DnD test for QWidgetWindow (handleDrag*Event() functions).