diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-12-18 08:37:31 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-12-18 08:37:31 +0100 |
commit | beb65dcd79f8c354dab7bb4a8d08157bd9d69329 (patch) | |
tree | 4632a0ff0df8462f8913f347042cf8378de03268 /tests/auto/gui/kernel | |
parent | 3fc1002489d5861d4f7cc2e1e8800881d6593c9d (diff) | |
parent | e3288f246b44ba2b6d90b90eb99ab61f496d8d57 (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
src/gui/painting/painting.pri
src/plugins/platforms/xcb/qxcbconnection.cpp
tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro
tests/auto/corelib/tools/qlocale/test/test.pro
tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
tools/configure/environment.cpp
Change-Id: I9c40f458b89b2c206de2d2c24e90b5f679c93495
Diffstat (limited to 'tests/auto/gui/kernel')
-rw-r--r-- | tests/auto/gui/kernel/qclipboard/qclipboard.pro | 2 | ||||
-rw-r--r-- | tests/auto/gui/kernel/qclipboard/test/test.pro | 2 | ||||
-rw-r--r-- | tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 67 |
3 files changed, 69 insertions, 2 deletions
diff --git a/tests/auto/gui/kernel/qclipboard/qclipboard.pro b/tests/auto/gui/kernel/qclipboard/qclipboard.pro index d97c58dea0..b9fd2080e7 100644 --- a/tests/auto/gui/kernel/qclipboard/qclipboard.pro +++ b/tests/auto/gui/kernel/qclipboard/qclipboard.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = copier paster +!winrt: SUBDIRS = copier paster test.depends += $$SUBDIRS SUBDIRS += test diff --git a/tests/auto/gui/kernel/qclipboard/test/test.pro b/tests/auto/gui/kernel/qclipboard/test/test.pro index 586404871f..f27c582de2 100644 --- a/tests/auto/gui/kernel/qclipboard/test/test.pro +++ b/tests/auto/gui/kernel/qclipboard/test/test.pro @@ -15,6 +15,6 @@ wince* { DEPLOYMENT += rsc reg_resource } -TEST_HELPER_INSTALLS = \ +!winrt: TEST_HELPER_INSTALLS = \ ../copier/copier \ ../paster/paster diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index aa7dced0ab..d764b88ef7 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -100,6 +100,8 @@ private slots: void windowsTransientChildren(); void requestUpdate(); void initTestCase(); + void stateChange_data(); + void stateChange(); void cleanup(); private: @@ -390,6 +392,18 @@ static inline bool qFuzzyCompareWindowPosition(const QPoint &p1, const QPoint p2 return (p1 - p2).manhattanLength() <= fuzz; } +static inline bool qFuzzyCompareWindowSize(const QSize &s1, const QSize &s2, int fuzz) +{ + const int manhattanLength = qAbs(s1.width() - s2.width()) + qAbs(s1.height() - s2.height()); + return manhattanLength <= fuzz; +} + +static inline bool qFuzzyCompareWindowGeometry(const QRect &r1, const QRect &r2, int fuzz) +{ + return qFuzzyCompareWindowPosition(r1.topLeft(), r2.topLeft(), fuzz) + && qFuzzyCompareWindowSize(r1.size(), r2.size(), fuzz); +} + static QString msgPointMismatch(const QPoint &p1, const QPoint p2) { QString result; @@ -397,6 +411,13 @@ static QString msgPointMismatch(const QPoint &p1, const QPoint p2) return result; } +static QString msgRectMismatch(const QRect &r1, const QRect &r2) +{ + QString result; + QDebug(&result) << r1 << "!=" << r2; + return result; +} + void tst_QWindow::positioning() { if (!QGuiApplicationPrivate::platformIntegration()->hasCapability( @@ -561,6 +582,52 @@ void tst_QWindow::childWindowPositioning() 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. + +typedef QList<Qt::WindowState> WindowStateList; + +Q_DECLARE_METATYPE(WindowStateList) + +void tst_QWindow::stateChange_data() +{ + QTest::addColumn<WindowStateList>("stateSequence"); + + QTest::newRow("normal->min->normal") << + (WindowStateList() << Qt::WindowMinimized << Qt::WindowNoState); + QTest::newRow("normal->maximized->normal") << + (WindowStateList() << Qt::WindowMaximized << Qt::WindowNoState); + QTest::newRow("normal->fullscreen->normal") << + (WindowStateList() << Qt::WindowFullScreen << Qt::WindowNoState); + QTest::newRow("normal->maximized->fullscreen->normal") << + (WindowStateList() << Qt::WindowMaximized << Qt::WindowFullScreen << Qt::WindowNoState); +} + +void tst_QWindow::stateChange() +{ + QFETCH(WindowStateList, stateSequence); + + if (QGuiApplication::platformName().compare(QLatin1String("windows"), Qt::CaseInsensitive)) + QSKIP("Windows-only test"); + + Window window; + window.setTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1Char(' ') + QLatin1String(QTest::currentDataTag())); + const QRect normalGeometry(m_availableTopLeft + QPoint(40, 40), m_testWindowSize); + window.setGeometry(normalGeometry); + // explicitly use non-fullscreen show. show() can be fullscreen on some platforms + window.showNormal(); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + foreach (Qt::WindowState state, stateSequence) { + window.setWindowState(state); + QCoreApplication::processEvents(); + } + const QRect geometry = window.geometry(); + const int fuzz = int(QHighDpiScaling::factor(&window)); + QVERIFY2(qFuzzyCompareWindowGeometry(geometry, normalGeometry, fuzz), + qPrintable(msgRectMismatch(geometry, normalGeometry))); +} + class PlatformWindowFilter : public QObject { Q_OBJECT |