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>
This commit is contained in:
parent
01f5f77c66
commit
ad36da8ff4
112
src/testlib/qtesthelpers_p.h
Normal file
112
src/testlib/qtesthelpers_p.h
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2017 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the QtTest module of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 3 requirements
|
||||||
|
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 2.0 or (at your option) the GNU General
|
||||||
|
** Public license version 3 or any later version approved by the KDE Free
|
||||||
|
** Qt Foundation. The licenses are as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||||
|
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QTESTHELPERS_P_H
|
||||||
|
#define QTESTHELPERS_P_H
|
||||||
|
|
||||||
|
//
|
||||||
|
// W A R N I N G
|
||||||
|
// -------------
|
||||||
|
//
|
||||||
|
// This file is not part of the Qt API. It exists purely as an
|
||||||
|
// implementation detail. This header file may change from version to
|
||||||
|
// version without notice, or even be removed.
|
||||||
|
//
|
||||||
|
// We mean it.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <QtCore/QFile>
|
||||||
|
#include <QtCore/QString>
|
||||||
|
#include <QtCore/QChar>
|
||||||
|
#include <QtCore/QPoint>
|
||||||
|
|
||||||
|
#ifdef QT_GUI_LIB
|
||||||
|
#include <QtGui/QGuiApplication>
|
||||||
|
#include <QtGui/QScreen>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef QT_WIDGETS_LIB
|
||||||
|
#include <QtWidgets/QWidget>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
namespace QTestPrivate {
|
||||||
|
|
||||||
|
static inline bool canHandleUnicodeFileNames()
|
||||||
|
{
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
// Check for UTF-8 by converting the Euro symbol (see tst_utf8)
|
||||||
|
return QFile::encodeName(QString(QChar(0x20AC))) == QByteArrayLiteral("\342\202\254");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef QT_WIDGETS_LIB
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! \internal
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
#endif // QT_WIDGETS_LIB
|
||||||
|
|
||||||
|
} // namespace QTestPrivate
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // QTESTHELPERS_P_H
|
@ -37,7 +37,8 @@ HEADERS = qbenchmark.h \
|
|||||||
qtestspontaneevent.h \
|
qtestspontaneevent.h \
|
||||||
qtestsystem.h \
|
qtestsystem.h \
|
||||||
qtesttouch.h \
|
qtesttouch.h \
|
||||||
qtestblacklist_p.h
|
qtestblacklist_p.h \
|
||||||
|
qtesthelpers_p.h
|
||||||
|
|
||||||
SOURCES = qtestcase.cpp \
|
SOURCES = qtestcase.cpp \
|
||||||
qtestlog.cpp \
|
qtestlog.cpp \
|
||||||
|
@ -4,4 +4,4 @@ SOURCES += tst_qtemporarydir.cpp
|
|||||||
INCLUDEPATH += ../../../../shared/
|
INCLUDEPATH += ../../../../shared/
|
||||||
HEADERS += ../../../../shared/emulationdetector.h
|
HEADERS += ../../../../shared/emulationdetector.h
|
||||||
|
|
||||||
QT = core testlib
|
QT = core testlib testlib-private
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include <qdir.h>
|
#include <qdir.h>
|
||||||
#include <qset.h>
|
#include <qset.h>
|
||||||
#include <qtextcodec.h>
|
#include <qtextcodec.h>
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
@ -112,16 +113,6 @@ void tst_QTemporaryDir::getSetCheck()
|
|||||||
QCOMPARE(true, obj1.autoRemove());
|
QCOMPARE(true, obj1.autoRemove());
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool canHandleUnicodeFileNames()
|
|
||||||
{
|
|
||||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
// Check for UTF-8 by converting the Euro symbol (see tst_utf8)
|
|
||||||
return QFile::encodeName(QString(QChar(0x20AC))) == QByteArrayLiteral("\342\202\254");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString hanTestText()
|
static QString hanTestText()
|
||||||
{
|
{
|
||||||
QString text;
|
QString text;
|
||||||
@ -160,7 +151,7 @@ void tst_QTemporaryDir::fileTemplate_data()
|
|||||||
QTest::newRow("constructor with XXXX suffix") << "qt_XXXXXX_XXXX" << "qt_";
|
QTest::newRow("constructor with XXXX suffix") << "qt_XXXXXX_XXXX" << "qt_";
|
||||||
QTest::newRow("constructor with XXXX prefix") << "qt_XXXX" << "qt_";
|
QTest::newRow("constructor with XXXX prefix") << "qt_XXXX" << "qt_";
|
||||||
QTest::newRow("constructor with XXXXX prefix") << "qt_XXXXX" << "qt_";
|
QTest::newRow("constructor with XXXXX prefix") << "qt_XXXXX" << "qt_";
|
||||||
if (canHandleUnicodeFileNames()) {
|
if (QTestPrivate::canHandleUnicodeFileNames()) {
|
||||||
// Test Umlauts (contained in Latin1)
|
// Test Umlauts (contained in Latin1)
|
||||||
QString prefix = "qt_" + umlautTestText();
|
QString prefix = "qt_" + umlautTestText();
|
||||||
QTest::newRow("Umlauts") << (prefix + "XXXXXX") << prefix;
|
QTest::newRow("Umlauts") << (prefix + "XXXXXX") << prefix;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qtemporaryfile
|
TARGET = tst_qtemporaryfile
|
||||||
QT = core testlib
|
QT = core testlib testlib-private
|
||||||
SOURCES = tst_qtemporaryfile.cpp
|
SOURCES = tst_qtemporaryfile.cpp
|
||||||
TESTDATA += tst_qtemporaryfile.cpp
|
TESTDATA += tst_qtemporaryfile.cpp
|
||||||
RESOURCES += qtemporaryfile.qrc
|
RESOURCES += qtemporaryfile.qrc
|
||||||
|
@ -36,6 +36,8 @@
|
|||||||
#include <qset.h>
|
#include <qset.h>
|
||||||
#include <qtextcodec.h>
|
#include <qtextcodec.h>
|
||||||
|
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
@ -141,16 +143,6 @@ void tst_QTemporaryFile::getSetCheck()
|
|||||||
QCOMPARE(true, obj1.autoRemove());
|
QCOMPARE(true, obj1.autoRemove());
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool canHandleUnicodeFileNames()
|
|
||||||
{
|
|
||||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
// Check for UTF-8 by converting the Euro symbol (see tst_utf8)
|
|
||||||
return QFile::encodeName(QString(QChar(0x20AC))) == QByteArrayLiteral("\342\202\254");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString hanTestText()
|
static QString hanTestText()
|
||||||
{
|
{
|
||||||
QString text;
|
QString text;
|
||||||
@ -199,7 +191,7 @@ void tst_QTemporaryFile::fileTemplate_data()
|
|||||||
QTest::newRow("set template, with xxx") << "" << "qt_" << ".xxx" << "qt_XXXXXX.xxx";
|
QTest::newRow("set template, with xxx") << "" << "qt_" << ".xxx" << "qt_XXXXXX.xxx";
|
||||||
QTest::newRow("set template, with >6 X's") << "" << "qt_" << ".xxx" << "qt_XXXXXXXXXXXXXX.xxx";
|
QTest::newRow("set template, with >6 X's") << "" << "qt_" << ".xxx" << "qt_XXXXXXXXXXXXXX.xxx";
|
||||||
QTest::newRow("set template, with >6 X's, no suffix") << "" << "qt_" << "" << "qt_XXXXXXXXXXXXXX";
|
QTest::newRow("set template, with >6 X's, no suffix") << "" << "qt_" << "" << "qt_XXXXXXXXXXXXXX";
|
||||||
if (canHandleUnicodeFileNames()) {
|
if (QTestPrivate::canHandleUnicodeFileNames()) {
|
||||||
// Test Umlauts (contained in Latin1)
|
// Test Umlauts (contained in Latin1)
|
||||||
QString prefix = "qt_" + umlautTestText();
|
QString prefix = "qt_" + umlautTestText();
|
||||||
QTest::newRow("Umlauts") << (prefix + "XXXXXX") << prefix << QString() << QString();
|
QTest::newRow("Umlauts") << (prefix + "XXXXXX") << prefix << QString() << QString();
|
||||||
@ -761,7 +753,7 @@ void tst_QTemporaryFile::QTBUG_4796_data()
|
|||||||
QTest::newRow("XXXXXXbla") << QString() << QString("bla") << true;
|
QTest::newRow("XXXXXXbla") << QString() << QString("bla") << true;
|
||||||
QTest::newRow("does-not-exist/qt_temp.XXXXXX") << QString("does-not-exist/qt_temp") << QString() << false;
|
QTest::newRow("does-not-exist/qt_temp.XXXXXX") << QString("does-not-exist/qt_temp") << QString() << false;
|
||||||
|
|
||||||
if (canHandleUnicodeFileNames()) {
|
if (QTestPrivate::canHandleUnicodeFileNames()) {
|
||||||
QTest::newRow("XXXXXX<unicode>") << QString() << unicode << true;
|
QTest::newRow("XXXXXX<unicode>") << QString() << unicode << true;
|
||||||
QTest::newRow("<unicode>XXXXXX") << unicode << QString() << true;
|
QTest::newRow("<unicode>XXXXXX") << unicode << QString() << true;
|
||||||
QTest::newRow("<unicode>XXXXXX<unicode>") << unicode << unicode << true;
|
QTest::newRow("<unicode>XXXXXX<unicode>") << unicode << unicode << true;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qaccessibility
|
TARGET = tst_qaccessibility
|
||||||
requires(qtConfig(accessibility))
|
requires(qtConfig(accessibility))
|
||||||
QT += testlib core-private gui-private widgets-private
|
QT += testlib core-private gui-private widgets-private testlib-private
|
||||||
SOURCES += tst_qaccessibility.cpp
|
SOURCES += tst_qaccessibility.cpp
|
||||||
HEADERS += accessiblewidgets.h
|
HEADERS += accessiblewidgets.h
|
||||||
|
|
||||||
|
@ -59,15 +59,9 @@
|
|||||||
|
|
||||||
#include "accessiblewidgets.h"
|
#include "accessiblewidgets.h"
|
||||||
|
|
||||||
// Make a widget frameless to prevent size constraints of title bars
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
// from interfering (Windows).
|
|
||||||
static inline void setFrameless(QWidget *w)
|
using namespace QTestPrivate;
|
||||||
{
|
|
||||||
Qt::WindowFlags flags = w->windowFlags();
|
|
||||||
flags |= Qt::FramelessWindowHint;
|
|
||||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
|
||||||
w->setWindowFlags(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface,
|
static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface,
|
||||||
int index, const QRect &domain)
|
int index, const QRect &domain)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qgraphicsitem
|
TARGET = tst_qgraphicsitem
|
||||||
QT += widgets widgets-private testlib
|
QT += widgets widgets-private testlib testlib-private
|
||||||
QT += core-private gui-private
|
QT += core-private gui-private
|
||||||
SOURCES += tst_qgraphicsitem.cpp
|
SOURCES += tst_qgraphicsitem.cpp
|
||||||
DEFINES += QT_NO_CAST_TO_ASCII
|
DEFINES += QT_NO_CAST_TO_ASCII
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
|
|
||||||
#include <private/qgraphicsitem_p.h>
|
#include <private/qgraphicsitem_p.h>
|
||||||
#include <private/qgraphicsview_p.h>
|
#include <private/qgraphicsview_p.h>
|
||||||
@ -127,17 +128,6 @@ static void sendKeyClick(QGraphicsScene *scene, Qt::Key key)
|
|||||||
sendKeyRelease(scene, 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
|
class EventSpy : public QGraphicsWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -4211,7 +4201,7 @@ void tst_QGraphicsItem::cursor()
|
|||||||
|
|
||||||
QWidget topLevel;
|
QWidget topLevel;
|
||||||
topLevel.resize(250, 150);
|
topLevel.resize(250, 150);
|
||||||
centerOnScreen(&topLevel);
|
QTestPrivate::centerOnScreen(&topLevel);
|
||||||
QGraphicsView view(&scene,&topLevel);
|
QGraphicsView view(&scene,&topLevel);
|
||||||
view.setFixedSize(200, 100);
|
view.setFixedSize(200, 100);
|
||||||
topLevel.show();
|
topLevel.show();
|
||||||
|
@ -3,7 +3,7 @@ testcase.timeout = 500 # this test is slow
|
|||||||
TARGET = tst_qgraphicsview
|
TARGET = tst_qgraphicsview
|
||||||
|
|
||||||
QT += widgets widgets-private testlib
|
QT += widgets widgets-private testlib
|
||||||
QT += core-private gui-private
|
QT += core-private gui-private testlib-private
|
||||||
|
|
||||||
SOURCES += tst_qgraphicsview.cpp tst_qgraphicsview_2.cpp
|
SOURCES += tst_qgraphicsview.cpp tst_qgraphicsview_2.cpp
|
||||||
HEADERS += tst_qgraphicsview.h
|
HEADERS += tst_qgraphicsview.h
|
||||||
|
@ -61,6 +61,10 @@
|
|||||||
|
|
||||||
#include "tst_qgraphicsview.h"
|
#include "tst_qgraphicsview.h"
|
||||||
|
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
|
|
||||||
|
using namespace QTestPrivate;
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(ExpectedValueDescription)
|
Q_DECLARE_METATYPE(ExpectedValueDescription)
|
||||||
Q_DECLARE_METATYPE(QList<int>)
|
Q_DECLARE_METATYPE(QList<int>)
|
||||||
Q_DECLARE_METATYPE(QList<QRectF>)
|
Q_DECLARE_METATYPE(QList<QRectF>)
|
||||||
@ -130,14 +134,6 @@ class FriendlyGraphicsScene : public QGraphicsScene
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
class tst_QGraphicsView : public QObject
|
class tst_QGraphicsView : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qabstractitemview
|
TARGET = tst_qabstractitemview
|
||||||
QT += widgets testlib
|
QT += widgets testlib testlib-private
|
||||||
SOURCES += tst_qabstractitemview.cpp
|
SOURCES += tst_qabstractitemview.cpp
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
|
|
||||||
#include <qabstractitemview.h>
|
#include <qabstractitemview.h>
|
||||||
#include <qstandarditemmodel.h>
|
#include <qstandarditemmodel.h>
|
||||||
@ -57,19 +58,7 @@
|
|||||||
|
|
||||||
Q_DECLARE_METATYPE(Qt::ItemFlags);
|
Q_DECLARE_METATYPE(Qt::ItemFlags);
|
||||||
|
|
||||||
static inline void setFrameless(QWidget *w)
|
using namespace QTestPrivate;
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move cursor out of widget area to avoid undesired interaction on Mac.
|
// Move cursor out of widget area to avoid undesired interaction on Mac.
|
||||||
static inline void moveCursorAway(const QWidget *topLevel)
|
static inline void moveCursorAway(const QWidget *topLevel)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
QT += widgets widgets-private
|
QT += widgets widgets-private
|
||||||
QT += gui-private core-private testlib
|
QT += gui-private core-private testlib testlib-private
|
||||||
|
|
||||||
SOURCES += tst_qcolumnview.cpp
|
SOURCES += tst_qcolumnview.cpp
|
||||||
HEADERS += ../../../../shared/fakedirmodel.h
|
HEADERS += ../../../../shared/fakedirmodel.h
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "../../../../shared/fakedirmodel.h"
|
#include "../../../../shared/fakedirmodel.h"
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
#include <qitemdelegate.h>
|
#include <qitemdelegate.h>
|
||||||
#include <qcolumnview.h>
|
#include <qcolumnview.h>
|
||||||
#include <private/qcolumnviewgrip_p.h>
|
#include <private/qcolumnviewgrip_p.h>
|
||||||
@ -369,12 +370,6 @@ void tst_QColumnView::scrollTo_data()
|
|||||||
QTest::newRow("reverse") << true << false;
|
QTest::newRow("reverse") << true << false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void centerOnScreen(QWidget *w)
|
|
||||||
{
|
|
||||||
const QPoint offset = QPoint(w->width() / 2, w->height() / 2);
|
|
||||||
w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
void tst_QColumnView::scrollTo()
|
void tst_QColumnView::scrollTo()
|
||||||
{
|
{
|
||||||
QFETCH(bool, reverse);
|
QFETCH(bool, reverse);
|
||||||
@ -386,7 +381,7 @@ void tst_QColumnView::scrollTo()
|
|||||||
view.resize(200, 200);
|
view.resize(200, 200);
|
||||||
topLevel.show();
|
topLevel.show();
|
||||||
topLevel.activateWindow();
|
topLevel.activateWindow();
|
||||||
centerOnScreen(&topLevel);
|
QTestPrivate::centerOnScreen(&topLevel);
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&topLevel));
|
QVERIFY(QTest::qWaitForWindowActive(&topLevel));
|
||||||
|
|
||||||
view.scrollTo(QModelIndex(), QAbstractItemView::EnsureVisible);
|
view.scrollTo(QModelIndex(), QAbstractItemView::EnsureVisible);
|
||||||
@ -1004,7 +999,7 @@ void tst_QColumnView::dynamicModelChanges()
|
|||||||
ColumnView view;
|
ColumnView view;
|
||||||
view.setModel(&model);
|
view.setModel(&model);
|
||||||
view.setItemDelegate(&delegate);
|
view.setItemDelegate(&delegate);
|
||||||
centerOnScreen(&view);
|
QTestPrivate::centerOnScreen(&view);
|
||||||
view.show();
|
view.show();
|
||||||
|
|
||||||
QStandardItem *item = new QStandardItem(QLatin1String("item"));
|
QStandardItem *item = new QStandardItem(QLatin1String("item"));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qlistview
|
TARGET = tst_qlistview
|
||||||
QT += widgets gui-private widgets-private core-private testlib
|
QT += widgets gui-private widgets-private core-private testlib testlib-private
|
||||||
SOURCES += tst_qlistview.cpp
|
SOURCES += tst_qlistview.cpp
|
||||||
win32:!winrt: LIBS += -luser32
|
win32:!winrt: LIBS += -luser32
|
||||||
linux*: CONFIG += insignificant_test # Crashes
|
linux*: CONFIG += insignificant_test # Crashes
|
||||||
|
@ -46,6 +46,10 @@
|
|||||||
#include <QtWidgets/QStyleFactory>
|
#include <QtWidgets/QStyleFactory>
|
||||||
#include <QtWidgets/QVBoxLayout>
|
#include <QtWidgets/QVBoxLayout>
|
||||||
|
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
|
|
||||||
|
using namespace QTestPrivate;
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <QtGui/QGuiApplication>
|
# include <QtGui/QGuiApplication>
|
||||||
@ -64,16 +68,6 @@ Q_DECLARE_METATYPE(QAbstractItemView::ScrollMode)
|
|||||||
Q_DECLARE_METATYPE(QMargins)
|
Q_DECLARE_METATYPE(QMargins)
|
||||||
Q_DECLARE_METATYPE(QSize)
|
Q_DECLARE_METATYPE(QSize)
|
||||||
|
|
||||||
// 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 QStringList generateList(const QString &prefix, int size)
|
static QStringList generateList(const QString &prefix, int size)
|
||||||
{
|
{
|
||||||
QStringList result;
|
QStringList result;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qtableview
|
TARGET = tst_qtableview
|
||||||
QT += widgets widgets-private testlib
|
QT += widgets widgets-private testlib
|
||||||
QT += core-private gui-private
|
QT += core-private gui-private testlib-private
|
||||||
|
|
||||||
SOURCES += tst_qtableview.cpp
|
SOURCES += tst_qtableview.cpp
|
||||||
|
@ -35,6 +35,10 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
|
|
||||||
|
using namespace QTestPrivate;
|
||||||
|
|
||||||
#ifdef QT_BUILD_INTERNAL
|
#ifdef QT_BUILD_INTERNAL
|
||||||
#define VERIFY_SPANS_CONSISTENCY(TEST_VIEW_) \
|
#define VERIFY_SPANS_CONSISTENCY(TEST_VIEW_) \
|
||||||
QVERIFY(static_cast<QTableViewPrivate*>(QObjectPrivate::get(TEST_VIEW_))->spans.checkConsistency())
|
QVERIFY(static_cast<QTableViewPrivate*>(QObjectPrivate::get(TEST_VIEW_))->spans.checkConsistency())
|
||||||
@ -46,16 +50,6 @@ typedef QList<int> IntList;
|
|||||||
|
|
||||||
typedef QList<bool> BoolList;
|
typedef QList<bool> BoolList;
|
||||||
|
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
class tst_QTableView : public QObject
|
class tst_QTableView : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qtreeview
|
TARGET = tst_qtreeview
|
||||||
QT += widgets testlib
|
QT += widgets testlib
|
||||||
QT += widgets-private gui-private core-private
|
QT += widgets-private gui-private core-private testlib-private
|
||||||
SOURCES += tst_qtreeview.cpp
|
SOURCES += tst_qtreeview.cpp
|
||||||
HEADERS += ../../../../shared/fakedirmodel.h
|
HEADERS += ../../../../shared/fakedirmodel.h
|
||||||
|
@ -33,6 +33,10 @@
|
|||||||
#include <QtWidgets/QtWidgets>
|
#include <QtWidgets/QtWidgets>
|
||||||
#include <private/qtreeview_p.h>
|
#include <private/qtreeview_p.h>
|
||||||
|
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
|
|
||||||
|
using namespace QTestPrivate;
|
||||||
|
|
||||||
#ifndef QT_NO_DRAGANDDROP
|
#ifndef QT_NO_DRAGANDDROP
|
||||||
Q_DECLARE_METATYPE(QAbstractItemView::DragDropMode)
|
Q_DECLARE_METATYPE(QAbstractItemView::DragDropMode)
|
||||||
#endif
|
#endif
|
||||||
@ -57,16 +61,6 @@ static void initStandardTreeModel(QStandardItemModel *model)
|
|||||||
model->insertRow(2, item);
|
model->insertRow(2, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
class tst_QTreeView : public QObject
|
class tst_QTreeView : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qboxlayout
|
TARGET = tst_qboxlayout
|
||||||
QT += widgets testlib
|
QT += widgets testlib testlib-private
|
||||||
SOURCES += tst_qboxlayout.cpp
|
SOURCES += tst_qboxlayout.cpp
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,13 +31,9 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
|
|
||||||
static inline void setFrameless(QWidget *w)
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
{
|
|
||||||
Qt::WindowFlags flags = w->windowFlags();
|
using namespace QTestPrivate;
|
||||||
flags |= Qt::FramelessWindowHint;
|
|
||||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
|
||||||
w->setWindowFlags(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
class tst_QBoxLayout : public QObject
|
class tst_QBoxLayout : public QObject
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qformlayout
|
TARGET = tst_qformlayout
|
||||||
QT += widgets testlib
|
QT += widgets testlib testlib-private
|
||||||
SOURCES += tst_qformlayout.cpp
|
SOURCES += tst_qformlayout.cpp
|
||||||
|
@ -41,20 +41,16 @@
|
|||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
|
|
||||||
|
using namespace QTestPrivate;
|
||||||
|
|
||||||
#include <qformlayout.h>
|
#include <qformlayout.h>
|
||||||
|
|
||||||
// ItemRole has enumerators for numerical values 0..2, thus the only
|
// ItemRole has enumerators for numerical values 0..2, thus the only
|
||||||
// valid numerical values for storing into an ItemRole variable are 0..3:
|
// valid numerical values for storing into an ItemRole variable are 0..3:
|
||||||
Q_CONSTEXPR QFormLayout::ItemRole invalidRole = QFormLayout::ItemRole(3);
|
Q_CONSTEXPR QFormLayout::ItemRole invalidRole = QFormLayout::ItemRole(3);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct QFormLayoutTakeRowResultHolder {
|
struct QFormLayoutTakeRowResultHolder {
|
||||||
QFormLayoutTakeRowResultHolder(QFormLayout::TakeRowResult result) Q_DECL_NOTHROW
|
QFormLayoutTakeRowResultHolder(QFormLayout::TakeRowResult result) Q_DECL_NOTHROW
|
||||||
: labelItem(result.labelItem),
|
: labelItem(result.labelItem),
|
||||||
|
@ -2,7 +2,7 @@ CONFIG += testcase
|
|||||||
TARGET = tst_qgridlayout
|
TARGET = tst_qgridlayout
|
||||||
|
|
||||||
QT += widgets widgets-private testlib
|
QT += widgets widgets-private testlib
|
||||||
QT += core-private gui-private
|
QT += core-private gui-private testlib-private
|
||||||
|
|
||||||
SOURCES += tst_qgridlayout.cpp
|
SOURCES += tst_qgridlayout.cpp
|
||||||
FORMS += sortdialog.ui
|
FORMS += sortdialog.ui
|
||||||
|
@ -41,15 +41,9 @@
|
|||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
|
||||||
// Make a widget frameless to prevent size constraints of title bars
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
// from interfering (Windows).
|
|
||||||
static inline void setFrameless(QWidget *w)
|
using namespace QTestPrivate;
|
||||||
{
|
|
||||||
Qt::WindowFlags flags = w->windowFlags();
|
|
||||||
flags |= Qt::FramelessWindowHint;
|
|
||||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
|
||||||
w->setWindowFlags(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
class tst_QGridLayout : public QObject
|
class tst_QGridLayout : public QObject
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qlayout
|
TARGET = tst_qlayout
|
||||||
|
|
||||||
QT += widgets widgets-private testlib
|
QT += widgets widgets-private testlib testlib-private
|
||||||
|
|
||||||
SOURCES += tst_qlayout.cpp
|
SOURCES += tst_qlayout.cpp
|
||||||
TESTDATA += baseline/*
|
TESTDATA += baseline/*
|
||||||
|
@ -44,13 +44,9 @@
|
|||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
#include <private/qlayoutengine_p.h>
|
#include <private/qlayoutengine_p.h>
|
||||||
|
|
||||||
static inline void setFrameless(QWidget *w)
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
{
|
|
||||||
Qt::WindowFlags flags = w->windowFlags();
|
using namespace QTestPrivate;
|
||||||
flags |= Qt::FramelessWindowHint;
|
|
||||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
|
||||||
w->setWindowFlags(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
class tst_QLayout : public QObject
|
class tst_QLayout : public QObject
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@ CONFIG += testcase
|
|||||||
testcase.timeout = 600 # this test is slow
|
testcase.timeout = 600 # this test is slow
|
||||||
TARGET = tst_qwidget
|
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
|
SOURCES += tst_qwidget.cpp
|
||||||
RESOURCES = qwidget.qrc
|
RESOURCES = qwidget.qrc
|
||||||
|
@ -72,6 +72,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QtTest/QTest>
|
#include <QtTest/QTest>
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
|
|
||||||
|
using namespace QTestPrivate;
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||||
# include <QtCore/qt_windows.h>
|
# include <QtCore/qt_windows.h>
|
||||||
@ -108,22 +111,6 @@ bool macHasAccessToWindowsServer()
|
|||||||
}
|
}
|
||||||
#endif
|
#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)
|
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||||
static inline void setWindowsAnimationsEnabled(bool enabled)
|
static inline void setWindowsAnimationsEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qwidget_window
|
TARGET = tst_qwidget_window
|
||||||
QT += widgets testlib core-private gui-private
|
QT += widgets testlib core-private gui-private testlib-private
|
||||||
SOURCES += tst_qwidget_window.cpp
|
SOURCES += tst_qwidget_window.cpp
|
||||||
|
@ -45,13 +45,9 @@
|
|||||||
#include <qtoolbar.h>
|
#include <qtoolbar.h>
|
||||||
#include <private/qwindow_p.h>
|
#include <private/qwindow_p.h>
|
||||||
|
|
||||||
static inline void setFrameless(QWidget *w)
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
{
|
|
||||||
Qt::WindowFlags flags = w->windowFlags();
|
using namespace QTestPrivate;
|
||||||
flags |= Qt::FramelessWindowHint;
|
|
||||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
|
||||||
w->setWindowFlags(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
class tst_QWidget_window : public QObject
|
class tst_QWidget_window : public QObject
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qwidgetaction
|
TARGET = tst_qwidgetaction
|
||||||
QT += widgets testlib
|
QT += widgets testlib testlib-private
|
||||||
SOURCES += tst_qwidgetaction.cpp
|
SOURCES += tst_qwidgetaction.cpp
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,13 +38,9 @@
|
|||||||
#include <qmainwindow.h>
|
#include <qmainwindow.h>
|
||||||
#include <qmenubar.h>
|
#include <qmenubar.h>
|
||||||
|
|
||||||
static inline void setFrameless(QWidget *w)
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
{
|
|
||||||
Qt::WindowFlags flags = w->windowFlags();
|
using namespace QTestPrivate;
|
||||||
flags |= Qt::FramelessWindowHint;
|
|
||||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
|
||||||
w->setWindowFlags(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
class tst_QWidgetAction : public QObject
|
class tst_QWidgetAction : public QObject
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qstyle
|
TARGET = tst_qstyle
|
||||||
QT += widgets testlib
|
QT += widgets testlib testlib-private
|
||||||
SOURCES += tst_qstyle.cpp
|
SOURCES += tst_qstyle.cpp
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
@ -60,15 +60,9 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
// Make a widget frameless to prevent size constraints of title bars
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
// from interfering (Windows).
|
|
||||||
static inline void setFrameless(QWidget *w)
|
using namespace QTestPrivate;
|
||||||
{
|
|
||||||
Qt::WindowFlags flags = w->windowFlags();
|
|
||||||
flags |= Qt::FramelessWindowHint;
|
|
||||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
|
||||||
w->setWindowFlags(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
class tst_QStyle : public QObject
|
class tst_QStyle : public QObject
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qstylesheetstyle
|
TARGET = tst_qstylesheetstyle
|
||||||
QT += widgets widgets-private gui-private testlib
|
QT += widgets widgets-private gui-private testlib testlib-private
|
||||||
|
|
||||||
SOURCES += tst_qstylesheetstyle.cpp
|
SOURCES += tst_qstylesheetstyle.cpp
|
||||||
RESOURCES += resources.qrc
|
RESOURCES += resources.qrc
|
||||||
|
@ -33,12 +33,9 @@
|
|||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
|
|
||||||
#include <private/qstylesheetstyle_p.h>
|
#include <private/qstylesheetstyle_p.h>
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
|
|
||||||
static inline void centerOnScreen(QWidget *w)
|
using namespace QTestPrivate;
|
||||||
{
|
|
||||||
const QPoint offset = QPoint(w->width() / 2, w->height() / 2);
|
|
||||||
w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
class tst_QStyleSheetStyle : public QObject
|
class tst_QStyleSheetStyle : public QObject
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
TARGET = tst_qcompleter
|
TARGET = tst_qcompleter
|
||||||
QT += widgets testlib
|
QT += widgets testlib testlib-private
|
||||||
|
|
||||||
SOURCES += tst_qcompleter.cpp
|
SOURCES += tst_qcompleter.cpp
|
||||||
|
@ -34,15 +34,11 @@
|
|||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
|
|
||||||
#include "../../../../shared/filesystem.h"
|
#include "../../../../shared/filesystem.h"
|
||||||
|
|
||||||
static inline void setFrameless(QWidget *w)
|
using namespace QTestPrivate;
|
||||||
{
|
|
||||||
Qt::WindowFlags flags = w->windowFlags();
|
|
||||||
flags |= Qt::FramelessWindowHint;
|
|
||||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
|
||||||
w->setWindowFlags(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
class CsvCompleter : public QCompleter
|
class CsvCompleter : public QCompleter
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qabstractslider
|
TARGET = tst_qabstractslider
|
||||||
QT += widgets testlib
|
QT += widgets testlib testlib-private
|
||||||
SOURCES += tst_qabstractslider.cpp
|
SOURCES += tst_qabstractslider.cpp
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,17 +36,13 @@
|
|||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
|
|
||||||
|
using namespace QTestPrivate;
|
||||||
|
|
||||||
// defined to be 120 by the wheel mouse vendors according to the docs
|
// defined to be 120 by the wheel mouse vendors according to the docs
|
||||||
#define WHEEL_DELTA 120
|
#define WHEEL_DELTA 120
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Slider : public QAbstractSlider
|
class Slider : public QAbstractSlider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qabstractspinbox
|
TARGET = tst_qabstractspinbox
|
||||||
QT += widgets gui-private core-private testlib
|
QT += widgets gui-private core-private testlib testlib-private
|
||||||
SOURCES += tst_qabstractspinbox.cpp
|
SOURCES += tst_qabstractspinbox.cpp
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
|
|
||||||
#include <qcoreapplication.h>
|
#include <qcoreapplication.h>
|
||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
@ -38,16 +39,6 @@
|
|||||||
#include "../../../shared/platforminputcontext.h"
|
#include "../../../shared/platforminputcontext.h"
|
||||||
#include <private/qinputmethod_p.h>
|
#include <private/qinputmethod_p.h>
|
||||||
|
|
||||||
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 tst_QAbstractSpinBox : public QObject
|
class tst_QAbstractSpinBox : public QObject
|
||||||
{
|
{
|
||||||
@ -182,7 +173,7 @@ void tst_QAbstractSpinBox::inputMethodUpdate()
|
|||||||
QSpinBox *testWidget = &box;
|
QSpinBox *testWidget = &box;
|
||||||
testWidget->setRange(0, 1);
|
testWidget->setRange(0, 1);
|
||||||
|
|
||||||
centerOnScreen(testWidget);
|
QTestPrivate::centerOnScreen(testWidget);
|
||||||
testWidget->clear();
|
testWidget->clear();
|
||||||
testWidget->show();
|
testWidget->show();
|
||||||
QVERIFY(QTest::qWaitForWindowExposed(testWidget));
|
QVERIFY(QTest::qWaitForWindowExposed(testWidget));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qcombobox
|
TARGET = tst_qcombobox
|
||||||
QT += widgets widgets-private gui-private core-private testlib
|
QT += widgets widgets-private gui-private core-private testlib testlib-private
|
||||||
SOURCES += tst_qcombobox.cpp
|
SOURCES += tst_qcombobox.cpp
|
||||||
|
@ -67,13 +67,9 @@
|
|||||||
#include "../../../shared/platforminputcontext.h"
|
#include "../../../shared/platforminputcontext.h"
|
||||||
#include <private/qinputmethod_p.h>
|
#include <private/qinputmethod_p.h>
|
||||||
|
|
||||||
static inline void setFrameless(QWidget *w)
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
{
|
|
||||||
Qt::WindowFlags flags = w->windowFlags();
|
using namespace QTestPrivate;
|
||||||
flags |= Qt::FramelessWindowHint;
|
|
||||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
|
||||||
w->setWindowFlags(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
class tst_QComboBox : public QObject
|
class tst_QComboBox : public QObject
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qlineedit
|
TARGET = tst_qlineedit
|
||||||
QT += gui-private core-private widgets widgets-private testlib
|
QT += gui-private core-private widgets widgets-private testlib testlib-private
|
||||||
SOURCES += tst_qlineedit.cpp
|
SOURCES += tst_qlineedit.cpp
|
||||||
|
|
||||||
osx: LIBS += -framework AppKit
|
osx: LIBS += -framework AppKit
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
#include "qlineedit.h"
|
#include "qlineedit.h"
|
||||||
#include "qapplication.h"
|
#include "qapplication.h"
|
||||||
#include "qstringlist.h"
|
#include "qstringlist.h"
|
||||||
@ -74,16 +75,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
class QPainter;
|
class QPainter;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
static inline void centerOnScreen(QWidget *w, const QSize &size)
|
using namespace QTestPrivate;
|
||||||
{
|
|
||||||
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 StyleOptionTestStyle : public QCommonStyle
|
class StyleOptionTestStyle : public QCommonStyle
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qmenu
|
TARGET = tst_qmenu
|
||||||
QT += gui-private widgets testlib
|
QT += gui-private widgets testlib testlib-private
|
||||||
SOURCES += tst_qmenu.cpp
|
SOURCES += tst_qmenu.cpp
|
||||||
macx:{
|
macx:{
|
||||||
OBJECTIVE_SOURCES += tst_qmenu_mac.mm
|
OBJECTIVE_SOURCES += tst_qmenu_mac.mm
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
@ -48,15 +49,11 @@
|
|||||||
|
|
||||||
#include <qpa/qplatformtheme.h>
|
#include <qpa/qplatformtheme.h>
|
||||||
|
|
||||||
|
using namespace QTestPrivate;
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Qt::Key);
|
Q_DECLARE_METATYPE(Qt::Key);
|
||||||
Q_DECLARE_METATYPE(Qt::KeyboardModifiers);
|
Q_DECLARE_METATYPE(Qt::KeyboardModifiers);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct MenuMetrics {
|
struct MenuMetrics {
|
||||||
int fw;
|
int fw;
|
||||||
int hmargin;
|
int hmargin;
|
||||||
@ -71,11 +68,6 @@ struct MenuMetrics {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void centerOnScreen(QWidget *w)
|
|
||||||
{
|
|
||||||
centerOnScreen(w, w->geometry().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
class tst_QMenu : public QObject
|
class tst_QMenu : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qmenubar
|
TARGET = tst_qmenubar
|
||||||
QT += widgets testlib
|
QT += widgets testlib testlib-private
|
||||||
SOURCES += tst_qmenubar.cpp
|
SOURCES += tst_qmenubar.cpp
|
||||||
|
|
||||||
macos: {
|
macos: {
|
||||||
|
@ -48,6 +48,10 @@ QT_FORWARD_DECLARE_CLASS(QMainWindow)
|
|||||||
|
|
||||||
#include <qmenubar.h>
|
#include <qmenubar.h>
|
||||||
|
|
||||||
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
|
|
||||||
|
using namespace QTestPrivate;
|
||||||
|
|
||||||
// Helper to calculate the action position in window coordinates
|
// Helper to calculate the action position in window coordinates
|
||||||
static inline QPoint widgetToWindowPos(const QWidget *w, const QPoint &pos)
|
static inline QPoint widgetToWindowPos(const QWidget *w, const QPoint &pos)
|
||||||
{
|
{
|
||||||
@ -73,12 +77,6 @@ class Menu : public QMenu
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void centerOnScreen(QWidget *w)
|
|
||||||
{
|
|
||||||
const QPoint offset = QPoint(w->width() / 2, w->height() / 2);
|
|
||||||
w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct TestMenu
|
struct TestMenu
|
||||||
{
|
{
|
||||||
QList<QMenu *> menus;
|
QList<QMenu *> menus;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qscrollbar
|
TARGET = tst_qscrollbar
|
||||||
QT += widgets testlib
|
QT += widgets testlib testlib-private
|
||||||
SOURCES += tst_qscrollbar.cpp
|
SOURCES += tst_qscrollbar.cpp
|
||||||
|
@ -33,16 +33,9 @@
|
|||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
|
||||||
static inline void centerOnScreen(QWidget *w, const QSize &size)
|
#include <QtTest/private/qtesthelpers_p.h>
|
||||||
{
|
|
||||||
const QPoint offset = QPoint(size.width() / 2, size.height() / 2);
|
|
||||||
w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void centerOnScreen(QWidget *w)
|
using namespace QTestPrivate;
|
||||||
{
|
|
||||||
centerOnScreen(w, w->geometry().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
class tst_QScrollBar : public QObject
|
class tst_QScrollBar : public QObject
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user