summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/kernel')
-rw-r--r--tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp10
-rw-r--r--tests/auto/gui/kernel/qdrag/qdrag.pro1
-rw-r--r--tests/auto/gui/kernel/qevent/qevent.pro1
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp16
-rw-r--r--tests/auto/gui/kernel/qguimetatype/qguimetatype.pro1
-rw-r--r--tests/auto/gui/kernel/qguitimer/qguitimer.pro1
-rw-r--r--tests/auto/gui/kernel/qguivariant/no_application/no_application.pro1
-rw-r--r--tests/auto/gui/kernel/qguivariant/test/test.pro1
-rw-r--r--tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp2
-rw-r--r--tests/auto/gui/kernel/qkeysequence/qkeysequence.pro2
-rw-r--r--tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp4
-rw-r--r--tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp21
-rw-r--r--tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp26
-rw-r--r--tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro2
-rw-r--r--tests/auto/gui/kernel/qpalette/qpalette.pro1
-rw-r--r--tests/auto/gui/kernel/qscreen/qscreen.pro1
-rw-r--r--tests/auto/gui/kernel/qsurfaceformat/qsurfaceformat.pro1
-rw-r--r--tests/auto/gui/kernel/qwindow/BLACKLIST2
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp216
19 files changed, 203 insertions, 107 deletions
diff --git a/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp b/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp
index d21569dcc0..0257a50924 100644
--- a/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp
+++ b/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp
@@ -44,20 +44,10 @@ class tst_NoQtEventLoop : public QObject
Q_OBJECT
private slots:
- void initTestCase();
- void cleanup();
void consumeMouseEvents();
};
-void tst_NoQtEventLoop::initTestCase()
-{
-}
-
-void tst_NoQtEventLoop::cleanup()
-{
-}
-
class Window : public QWindow
{
public:
diff --git a/tests/auto/gui/kernel/qdrag/qdrag.pro b/tests/auto/gui/kernel/qdrag/qdrag.pro
index d4a7bc2705..ac3fde8028 100644
--- a/tests/auto/gui/kernel/qdrag/qdrag.pro
+++ b/tests/auto/gui/kernel/qdrag/qdrag.pro
@@ -3,7 +3,6 @@
############################################################
CONFIG += testcase
-CONFIG += parallel_test
TARGET = tst_qdrag
QT += testlib
SOURCES += tst_qdrag.cpp
diff --git a/tests/auto/gui/kernel/qevent/qevent.pro b/tests/auto/gui/kernel/qevent/qevent.pro
index 09d4395f4d..2959089ce3 100644
--- a/tests/auto/gui/kernel/qevent/qevent.pro
+++ b/tests/auto/gui/kernel/qevent/qevent.pro
@@ -2,4 +2,3 @@ CONFIG += testcase
TARGET = tst_qevent
SOURCES += tst_qevent.cpp
QT = core testlib
-CONFIG += parallel_test
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
index d18f9664fc..ea8f594f9c 100644
--- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
@@ -63,6 +63,7 @@ private slots:
void initTestCase();
void cleanup();
void displayName();
+ void desktopFileName();
void firstWindowTitle();
void windowIcon();
void focusObject();
@@ -117,6 +118,21 @@ void tst_QGuiApplication::displayName()
QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("The GUI Application"));
}
+void tst_QGuiApplication::desktopFileName()
+{
+ int argc = 1;
+ char *argv[] = { const_cast<char*>("tst_qguiapplication") };
+ QGuiApplication app(argc, argv);
+
+ QCOMPARE(QGuiApplication::desktopFileName(), QString());
+
+ QGuiApplication::setDesktopFileName("io.qt.QGuiApplication.desktop");
+ QCOMPARE(QGuiApplication::desktopFileName(), QString::fromLatin1("io.qt.QGuiApplication.desktop"));
+
+ QGuiApplication::setDesktopFileName(QString());
+ QCOMPARE(QGuiApplication::desktopFileName(), QString());
+}
+
void tst_QGuiApplication::firstWindowTitle()
{
int argc = 3;
diff --git a/tests/auto/gui/kernel/qguimetatype/qguimetatype.pro b/tests/auto/gui/kernel/qguimetatype/qguimetatype.pro
index 914142404b..331295bab9 100644
--- a/tests/auto/gui/kernel/qguimetatype/qguimetatype.pro
+++ b/tests/auto/gui/kernel/qguimetatype/qguimetatype.pro
@@ -2,4 +2,3 @@ CONFIG += testcase
TARGET = tst_qguimetatype
SOURCES += tst_qguimetatype.cpp
QT = core gui testlib
-CONFIG += parallel_test
diff --git a/tests/auto/gui/kernel/qguitimer/qguitimer.pro b/tests/auto/gui/kernel/qguitimer/qguitimer.pro
index 15793d6e70..8a71e48007 100644
--- a/tests/auto/gui/kernel/qguitimer/qguitimer.pro
+++ b/tests/auto/gui/kernel/qguitimer/qguitimer.pro
@@ -1,5 +1,4 @@
CONFIG += testcase
-CONFIG += parallel_test
TARGET = tst_qguitimer
QT = core gui testlib
SOURCES += ../../../corelib/kernel/qtimer/tst_qtimer.cpp
diff --git a/tests/auto/gui/kernel/qguivariant/no_application/no_application.pro b/tests/auto/gui/kernel/qguivariant/no_application/no_application.pro
index cc72c225a3..ada3817e55 100644
--- a/tests/auto/gui/kernel/qguivariant/no_application/no_application.pro
+++ b/tests/auto/gui/kernel/qguivariant/no_application/no_application.pro
@@ -1,5 +1,4 @@
CONFIG += testcase
-CONFIG += parallel_test
TARGET = no_application
SOURCES += main.cpp
QT += testlib
diff --git a/tests/auto/gui/kernel/qguivariant/test/test.pro b/tests/auto/gui/kernel/qguivariant/test/test.pro
index c4123797d2..39e4b3b71f 100644
--- a/tests/auto/gui/kernel/qguivariant/test/test.pro
+++ b/tests/auto/gui/kernel/qguivariant/test/test.pro
@@ -1,5 +1,4 @@
CONFIG += testcase
-CONFIG += parallel_test
TARGET = tst_qguivariant
SOURCES += tst_qguivariant.cpp
RESOURCES = tst_qguivariant.qrc
diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
index 0a704b9f64..c45342cc06 100644
--- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
+++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
@@ -390,7 +390,7 @@ void tst_QGuiVariant::toString_data()
#ifndef Q_OS_MAC
<< QString( "Ctrl+A" );
#else
- << QString(QChar(0x2318)) + "A";
+ << QString(QChar(0x2318)) + QLatin1Char('A');
#endif
QFont font( "times", 12 );
diff --git a/tests/auto/gui/kernel/qkeysequence/qkeysequence.pro b/tests/auto/gui/kernel/qkeysequence/qkeysequence.pro
index 7c1e8d52de..9f79fe9ab7 100644
--- a/tests/auto/gui/kernel/qkeysequence/qkeysequence.pro
+++ b/tests/auto/gui/kernel/qkeysequence/qkeysequence.pro
@@ -1,5 +1,4 @@
CONFIG += testcase
-CONFIG += parallel_test
TARGET = tst_qkeysequence
QT += testlib
@@ -8,4 +7,3 @@ QT += core-private gui-private
SOURCES += tst_qkeysequence.cpp
RESOURCES += qkeysequence.qrc
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
index 3fcbd0a16f..84680fb7a6 100644
--- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
+++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
@@ -250,7 +250,7 @@ void tst_QKeySequence::operatorQString()
seq = QKeySequence( modifiers | keycode );
- QCOMPARE( (QString)seq, keystring );
+ QCOMPARE( seq.toString(QKeySequence::NativeText), keystring );
}
// this verifies that the constructors can handle the same strings in and out
@@ -260,7 +260,7 @@ void tst_QKeySequence::symetricConstructors()
QFETCH( int, keycode );
QKeySequence seq1( modifiers | keycode );
- QKeySequence seq2( (QString)seq1 );
+ QKeySequence seq2( seq1.toString(QKeySequence::NativeText) );
QVERIFY( seq1 == seq2 );
}
diff --git a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
index e6aa579ecd..e44f9c7da2 100644
--- a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
+++ b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
@@ -75,16 +75,10 @@ class tst_QMouseEvent : public QObject
{
Q_OBJECT
-public:
- tst_QMouseEvent();
- virtual ~tst_QMouseEvent();
-
-
public slots:
void initTestCase();
void cleanupTestCase();
void init();
- void cleanup();
private slots:
void checkMousePressEvent_data();
void checkMousePressEvent();
@@ -95,17 +89,6 @@ private:
MouseEventWidget* testMouseWidget;
};
-
-
-tst_QMouseEvent::tst_QMouseEvent()
-{
-}
-
-tst_QMouseEvent::~tst_QMouseEvent()
-{
-
-}
-
void tst_QMouseEvent::initTestCase()
{
testMouseWidget = new MouseEventWidget(0);
@@ -129,10 +112,6 @@ void tst_QMouseEvent::init()
testMouseWidget->mouseReleaseModifiers = 0;
}
-void tst_QMouseEvent::cleanup()
-{
-}
-
void tst_QMouseEvent::checkMousePressEvent_data()
{
QTest::addColumn<int>("buttonPressed");
diff --git a/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp b/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp
index 4fae6fa096..ecf7a6a248 100644
--- a/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp
+++ b/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp
@@ -51,17 +51,9 @@ class tst_qmouseevent_modal : public QObject
{
Q_OBJECT
-public:
- tst_qmouseevent_modal();
- virtual ~tst_qmouseevent_modal();
-
-
-public slots:
+private slots:
void initTestCase();
void cleanupTestCase();
- void init();
- void cleanup();
-private slots:
void mousePressRelease();
private:
@@ -97,14 +89,6 @@ private:
int c;
};
-tst_qmouseevent_modal::tst_qmouseevent_modal()
-{
-}
-
-tst_qmouseevent_modal::~tst_qmouseevent_modal()
-{
-}
-
void tst_qmouseevent_modal::initTestCase()
{
w = new TstWidget;
@@ -117,14 +101,6 @@ void tst_qmouseevent_modal::cleanupTestCase()
w = 0;
}
-void tst_qmouseevent_modal::init()
-{
-}
-
-void tst_qmouseevent_modal::cleanup()
-{
-}
-
/*
Test for task 22500
*/
diff --git a/tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro b/tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro
index 43a62b4811..d09af5084b 100644
--- a/tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro
+++ b/tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro
@@ -5,4 +5,4 @@ QT += core-private gui-private testlib
SOURCES += tst_qopenglwindow.cpp
-win32:CONFIG+=insignificant_test # QTBUG-28264
+win32:CONFIG+=insignificant_test # QTBUG-46452, QTBUG-49630
diff --git a/tests/auto/gui/kernel/qpalette/qpalette.pro b/tests/auto/gui/kernel/qpalette/qpalette.pro
index de87e8fafe..9dd3f3e715 100644
--- a/tests/auto/gui/kernel/qpalette/qpalette.pro
+++ b/tests/auto/gui/kernel/qpalette/qpalette.pro
@@ -1,5 +1,4 @@
CONFIG += testcase
-CONFIG += parallel_test
TARGET = tst_qpalette
QT += testlib
SOURCES += tst_qpalette.cpp
diff --git a/tests/auto/gui/kernel/qscreen/qscreen.pro b/tests/auto/gui/kernel/qscreen/qscreen.pro
index b2c98a9dfd..b631f4cf37 100644
--- a/tests/auto/gui/kernel/qscreen/qscreen.pro
+++ b/tests/auto/gui/kernel/qscreen/qscreen.pro
@@ -1,5 +1,4 @@
CONFIG += testcase
-CONFIG += parallel_test
TARGET = tst_qscreen
QT += core-private gui-private testlib
diff --git a/tests/auto/gui/kernel/qsurfaceformat/qsurfaceformat.pro b/tests/auto/gui/kernel/qsurfaceformat/qsurfaceformat.pro
index 9a705f443e..97d9d69fb7 100644
--- a/tests/auto/gui/kernel/qsurfaceformat/qsurfaceformat.pro
+++ b/tests/auto/gui/kernel/qsurfaceformat/qsurfaceformat.pro
@@ -1,5 +1,4 @@
CONFIG += testcase
-CONFIG += parallel_test
TARGET = tst_qsurfaceformat
QT += core-private gui-private testlib
diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST
index ee9709e68b..774c22a8e9 100644
--- a/tests/auto/gui/kernel/qwindow/BLACKLIST
+++ b/tests/auto/gui/kernel/qwindow/BLACKLIST
@@ -4,3 +4,5 @@ ubuntu-14.04
ubuntu-14.04
[modalWithChildWindow]
ubuntu-14.04
+[setVisible]
+ubuntu-14.04
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index a89f0da4d2..d764b88ef7 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -58,12 +58,17 @@ class tst_QWindow: public QObject
Q_OBJECT
private slots:
+ void create();
+ void setParent();
+ void setVisible();
void eventOrderOnShow();
void resizeEventAfterResize();
void mapGlobal();
void positioning_data();
void positioning();
void positioningDuringMinimized();
+ void childWindowPositioning_data();
+ void childWindowPositioning();
void platformSurface();
void isExposed();
void isActive();
@@ -126,6 +131,111 @@ void tst_QWindow::cleanup()
QVERIFY(QGuiApplication::allWindows().isEmpty());
}
+void tst_QWindow::create()
+{
+ QWindow a;
+ QVERIFY2(!a.handle(), "QWindow should lazy init the platform window");
+
+ a.create();
+ QVERIFY2(a.handle(), "Explicitly creating a platform window should never fail");
+
+ QWindow b;
+ QWindow c(&b);
+ b.create();
+ QVERIFY(b.handle());
+ QVERIFY2(!c.handle(), "Creating a parent window should not automatically create children");
+
+ QWindow d;
+ QWindow e(&d);
+ e.create();
+ QVERIFY(e.handle());
+ QVERIFY2(d.handle(), "Creating a child window should automatically create parents");
+
+ QWindow f;
+ QWindow g(&f);
+ f.create();
+ QVERIFY(f.handle());
+ QPlatformWindow *platformWindow = f.handle();
+ g.create();
+ QVERIFY(g.handle());
+ QVERIFY2(f.handle() == platformWindow, "Creating a child window should not affect parent if already created");
+}
+
+void tst_QWindow::setParent()
+{
+ QWindow a;
+ QWindow b(&a);
+ QVERIFY2(b.parent() == &a, "Setting parent at construction time should work");
+ QVERIFY2(a.children().contains(&b), "Parent should have child in list of children");
+
+ QWindow c;
+ QWindow d;
+ d.setParent(&c);
+ QVERIFY2(d.parent() == &c, "Setting parent after construction should work");
+ QVERIFY2(c.children().contains(&d), "Parent should have child in list of children");
+
+ a.create();
+ b.setParent(0);
+ QVERIFY2(!b.handle(), "Making window top level shouild not automatically create it");
+
+ QWindow e;
+ c.create();
+ e.setParent(&c);
+ QVERIFY2(!e.handle(), "Making window a child of a created window should not automatically create it");
+
+ QWindow f;
+ QWindow g;
+ g.create();
+ QVERIFY(g.handle());
+ g.setParent(&f);
+ QVERIFY2(f.handle(), "Making a created window a child of a non-created window should automatically create it");
+}
+
+void tst_QWindow::setVisible()
+{
+ QWindow a;
+ QWindow b(&a);
+ a.setVisible(true);
+ QVERIFY2(!b.handle(), "Making a top level window visible doesn't create its children");
+ QVERIFY2(!b.isVisible(), "Making a top level window visible doesn't make its children visible");
+ QVERIFY(QTest::qWaitForWindowExposed(&a));
+
+ QWindow c;
+ QWindow d(&c);
+ d.setVisible(true);
+ QVERIFY2(!c.handle(), "Making a child window visible doesn't create parent window if parent is hidden");
+ QVERIFY2(!c.isVisible(), "Making a child window visible doesn't make its parent visible");
+
+ QVERIFY2(!d.handle(), "Making a child window visible doesn't create platform window if parent is hidden");
+
+ c.create();
+ QVERIFY(c.handle());
+ QVERIFY2(d.handle(), "Creating a parent window should automatically create children if they are visible");
+ QVERIFY2(!c.isVisible(), "Creating a parent window should not make it visible just because it has visible children");
+
+ QWindow e;
+ QWindow f(&e);
+ f.setVisible(true);
+ QVERIFY(!f.handle());
+ QVERIFY(!e.handle());
+ f.setParent(0);
+ QVERIFY2(f.handle(), "Making a visible but not created child window top level should create it");
+ QVERIFY(QTest::qWaitForWindowExposed(&f));
+
+ QWindow g;
+ QWindow h;
+ QWindow i(&g);
+ i.setVisible(true);
+ h.setVisible(true);
+ QVERIFY(QTest::qWaitForWindowExposed(&h));
+ QVERIFY(!i.handle());
+ QVERIFY(!g.handle());
+ QVERIFY(h.handle());
+ i.setParent(&h);
+ QVERIFY2(i.handle(), "Making a visible but not created child window child of a created window should create it");
+ QVERIFY(QTest::qWaitForWindowExposed(&i));
+}
+
void tst_QWindow::mapGlobal()
{
QWindow a;
@@ -214,6 +324,19 @@ private:
QPlatformSurfaceEvent::SurfaceEventType m_surfaceventType;
};
+class ColoredWindow : public QRasterWindow {
+public:
+ explicit ColoredWindow(const QColor &color, QWindow *parent = 0) : QRasterWindow(parent), m_color(color) {}
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE
+ {
+ QPainter p(this);
+ p.fillRect(QRect(QPoint(0, 0), size()), m_color);
+ }
+
+private:
+ const QColor m_color;
+};
+
void tst_QWindow::eventOrderOnShow()
{
// Some platforms enforce minimum widths for windows, which can cause extra resize
@@ -249,12 +372,7 @@ void tst_QWindow::resizeEventAfterResize()
// Make sure we get a resizeEvent after calling resize
window.resize(m_testWindowSize);
-#if defined(Q_OS_BLACKBERRY) // "window" is the "root" window and will always be shown fullscreen
- // so we only expect one resize event
- QTRY_COMPARE(window.received(QEvent::Resize), 1);
-#else
QTRY_COMPARE(window.received(QEvent::Resize), 2);
-#endif
}
void tst_QWindow::positioning_data()
@@ -338,21 +456,15 @@ void tst_QWindow::positioning()
window.reset();
window.setWindowState(Qt::WindowFullScreen);
QCoreApplication::processEvents();
- // On BB10 the window is the root window and fullscreen, so nothing is resized.
-#if !defined(Q_OS_BLACKBERRY)
- QTRY_VERIFY(window.received(QEvent::Resize) > 0);
-#endif
+ QTRY_VERIFY(window.received(QEvent::Resize) > 0);
QTest::qWait(2000);
window.reset();
window.setWindowState(Qt::WindowNoState);
QCoreApplication::processEvents();
- // On BB10 the window is the root window and fullscreen, so nothing is resized.
-#if !defined(Q_OS_BLACKBERRY)
- QTRY_VERIFY(window.received(QEvent::Resize) > 0);
-#endif
+ QTRY_VERIFY(window.received(QEvent::Resize) > 0);
QTest::qWait(2000);
QTRY_COMPARE(originalPos, window.position());
@@ -415,6 +527,61 @@ void tst_QWindow::positioningDuringMinimized()
QTRY_COMPARE(window.geometry(), newGeometry);
}
+void tst_QWindow::childWindowPositioning_data()
+{
+ QTest::addColumn<bool>("showInsteadOfCreate");
+
+ QTest::newRow("create") << false;
+ QTest::newRow("show") << true;
+}
+
+void tst_QWindow::childWindowPositioning()
+{
+ const QPoint topLeftOrigin(0, 0);
+
+ ColoredWindow topLevelWindowFirst(Qt::green);
+ topLevelWindowFirst.setObjectName("topLevelWindowFirst");
+ ColoredWindow childWindowAfter(Qt::yellow, &topLevelWindowFirst);
+ childWindowAfter.setObjectName("childWindowAfter");
+
+ topLevelWindowFirst.setFramePosition(m_availableTopLeft);
+ childWindowAfter.setFramePosition(topLeftOrigin);
+
+ ColoredWindow topLevelWindowAfter(Qt::green);
+ topLevelWindowAfter.setObjectName("topLevelWindowAfter");
+ ColoredWindow childWindowFirst(Qt::yellow, &topLevelWindowAfter);
+ childWindowFirst.setObjectName("childWindowFirst");
+
+ topLevelWindowAfter.setFramePosition(m_availableTopLeft);
+ childWindowFirst.setFramePosition(topLeftOrigin);
+
+ QFETCH(bool, showInsteadOfCreate);
+
+ QWindow* windows[] = { &topLevelWindowFirst, &childWindowAfter, &childWindowFirst, &topLevelWindowAfter, 0 };
+ for (int i = 0; windows[i]; ++i) {
+ QWindow *window = windows[i];
+ if (showInsteadOfCreate) {
+ window->showNormal();
+ } else {
+ window->create();
+ }
+ }
+
+ if (showInsteadOfCreate) {
+ QVERIFY(QTest::qWaitForWindowExposed(&topLevelWindowFirst));
+ QVERIFY(QTest::qWaitForWindowExposed(&topLevelWindowAfter));
+ }
+
+ // Creation order shouldn't affect the geometry
+ // Use try compare since on X11 the window manager may still re-position the window after expose
+ QTRY_COMPARE(topLevelWindowFirst.geometry(), topLevelWindowAfter.geometry());
+ QTRY_COMPARE(childWindowAfter.geometry(), childWindowFirst.geometry());
+
+ // Creation order shouldn't affect the child ending up at 0,0
+ QCOMPARE(childWindowFirst.framePosition(), topLeftOrigin);
+ QCOMPARE(childWindowAfter.framePosition(), topLeftOrigin);
+}
+
// QTBUG-49709: Verify that the normal geometry is correctly restored
// when executing a sequence of window state changes. So far, Windows
// only where state changes have immediate effect.
@@ -1565,12 +1732,7 @@ void tst_QWindow::initialSize()
Window w;
w.setWidth(m_testWindowSize.width());
w.showNormal();
-#if defined(Q_OS_BLACKBERRY) // "window" is the "root" window and will always be shown fullscreen
- // so we only expect one resize event
- QTRY_COMPARE(w.width(), qGuiApp->primaryScreen()->availableGeometry().width());
-#else
QTRY_COMPARE(w.width(), m_testWindowSize.width());
-#endif
QTRY_VERIFY(w.height() > 0);
}
{
@@ -1579,12 +1741,7 @@ void tst_QWindow::initialSize()
w.resize(testSize);
w.showNormal();
-#if defined(Q_OS_BLACKBERRY) // "window" is the "root" window and will always be shown fullscreen
- // so we only expect one resize event
- const QSize expectedSize = QGuiApplication::primaryScreen()->availableGeometry().size();
-#else
const QSize expectedSize = testSize;
-#endif
QTRY_COMPARE(w.size(), expectedSize);
}
}
@@ -1732,19 +1889,6 @@ void tst_QWindow::modalWindowPosition()
QCOMPARE(window.geometry(), origGeo);
}
-class ColoredWindow : public QRasterWindow {
-public:
- explicit ColoredWindow(const QColor &color, QWindow *parent = 0) : QRasterWindow(parent), m_color(color) {}
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE
- {
- QPainter p(this);
- p.fillRect(QRect(QPoint(0, 0), size()), m_color);
- }
-
-private:
- const QColor m_color;
-};
-
static bool isNativeWindowVisible(const QWindow *window)
{
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)