diff options
author | Gatis Paeglis <gatis.paeglis@qt.io> | 2017-10-30 13:45:18 +0100 |
---|---|---|
committer | Gatis Paeglis <gatis.paeglis@qt.io> | 2017-11-04 20:11:22 +0000 |
commit | ad36da8ff416501e249beb098e5b84eaa2fba43d (patch) | |
tree | 48926e9edb976a5e804748a70ddb15d537e69e54 /tests/auto/widgets/kernel/qwidget | |
parent | 01f5f77c66dd6e4c15e0e0d8445e3560543e1973 (diff) |
testlib: start sharing common helper functions
... by moving them in QTestPrivate namespace (qtesthelpers_p.h). This
header file is a convenient staging area for helper APIs, eventually
some could be moved to public QTest API.
This header file utilizes the same pattern as other qtestlib header
files - wrapping functions with QT_${LIBNAME}_LIB to automatically
enable certain APIs based on what is in the projects dependencies,
e.g. QT += widgets.
Change-Id: Ic0266429939c1f3788912ad8b84fc6e0d5edd68b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/widgets/kernel/qwidget')
-rw-r--r-- | tests/auto/widgets/kernel/qwidget/qwidget.pro | 2 | ||||
-rw-r--r-- | tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 19 |
2 files changed, 4 insertions, 17 deletions
diff --git a/tests/auto/widgets/kernel/qwidget/qwidget.pro b/tests/auto/widgets/kernel/qwidget/qwidget.pro index 499ca65516..3e4e96760b 100644 --- a/tests/auto/widgets/kernel/qwidget/qwidget.pro +++ b/tests/auto/widgets/kernel/qwidget/qwidget.pro @@ -2,7 +2,7 @@ CONFIG += testcase testcase.timeout = 600 # this test is slow TARGET = tst_qwidget -QT += widgets core-private gui-private widgets-private testlib +QT += widgets core-private gui-private widgets-private testlib testlib-private SOURCES += tst_qwidget.cpp RESOURCES = qwidget.qrc diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index baecc43f2c..a7aa99d2a8 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -72,6 +72,9 @@ #endif #include <QtTest/QTest> +#include <QtTest/private/qtesthelpers_p.h> + +using namespace QTestPrivate; #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) # include <QtCore/qt_windows.h> @@ -108,22 +111,6 @@ bool macHasAccessToWindowsServer() } #endif -// Make a widget frameless to prevent size constraints of title bars -// from interfering (Windows). -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} - -static inline void centerOnScreen(QWidget *w) -{ - const QPoint offset = QPoint(w->width() / 2, w->height() / 2); - w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); -} - #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) static inline void setWindowsAnimationsEnabled(bool enabled) { |