From ad36da8ff416501e249beb098e5b84eaa2fba43d Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Mon, 30 Oct 2017 13:45:18 +0100 Subject: 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 --- .../graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp') diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 96827022a8..0fc1a643b4 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -28,6 +28,7 @@ #include +#include #include #include @@ -127,17 +128,6 @@ static void sendKeyClick(QGraphicsScene *scene, Qt::Key key) sendKeyRelease(scene, key); } -static inline void centerOnScreen(QWidget *w, const QSize &size) -{ - const QPoint offset = QPoint(size.width() / 2, size.height() / 2); - w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); -} - -static inline void centerOnScreen(QWidget *w) -{ - centerOnScreen(w, w->geometry().size()); -} - class EventSpy : public QGraphicsWidget { Q_OBJECT @@ -4211,7 +4201,7 @@ void tst_QGraphicsItem::cursor() QWidget topLevel; topLevel.resize(250, 150); - centerOnScreen(&topLevel); + QTestPrivate::centerOnScreen(&topLevel); QGraphicsView view(&scene,&topLevel); view.setFixedSize(200, 100); topLevel.show(); -- cgit v1.2.3