summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/global/qlogging/app/app.pro2
-rw-r--r--tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp74
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp13
-rw-r--r--tests/auto/corelib/kernel/qeventdispatcher/BLACKLIST2
-rw-r--r--tests/auto/corelib/kernel/qeventloop/BLACKLIST1
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp4
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp820
-rw-r--r--tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp4
-rw-r--r--tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp6
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp69
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp19
-rw-r--r--tests/auto/dbus/qdbusabstractadaptor/myobject.h5
-rw-r--r--tests/auto/dbus/qdbusmarshall/common.h2
-rw-r--r--tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp5
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp15
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp4
-rw-r--r--tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp61
-rw-r--r--tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp8
-rw-r--r--tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp15
-rw-r--r--tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h2
-rw-r--r--tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm19
-rw-r--r--tests/auto/printsupport/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp7
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp41
-rw-r--r--tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp21
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST3
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp6
-rw-r--r--tests/auto/widgets/kernel/qapplication/BLACKLIST2
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp2
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp4
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp11
30 files changed, 743 insertions, 504 deletions
diff --git a/tests/auto/corelib/global/qlogging/app/app.pro b/tests/auto/corelib/global/qlogging/app/app.pro
index 6fba1b6129..30751d89ec 100644
--- a/tests/auto/corelib/global/qlogging/app/app.pro
+++ b/tests/auto/corelib/global/qlogging/app/app.pro
@@ -13,5 +13,5 @@ DEFINES += QT_MESSAGELOGCONTEXT
gcc:!mingw:!haiku {
QMAKE_LFLAGS += -rdynamic
- contains(QT_ARCH, arm): QMAKE_CXXFLAGS += -funwind-tables
+ contains(QT_ARCH, arm): QMAKE_CXXFLAGS += -funwind-tables -fno-inline
}
diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
index fb3968c838..b05e3968ea 100644
--- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
@@ -92,6 +92,9 @@ private slots:
void QTBUG48402_data();
void QTBUG48402();
+ void QTBUG58851_data();
+ void QTBUG58851();
+
private:
QAbstractItemModel *model;
QItemSelectionModel *selection;
@@ -2848,5 +2851,76 @@ void tst_QItemSelectionModel::QTBUG48402()
QCOMPARE(QItemSelectionRange(helper.tl, helper.br), QItemSelectionRange(dtl, dbr));
}
+void tst_QItemSelectionModel::QTBUG58851_data()
+{
+ using IntPair = std::pair<int, int>;
+ using IntPairList = QList<IntPair>;
+ using IntPairPair = std::pair<IntPair, IntPair>;
+ using IntPairPairList = QList<IntPairPair>;
+
+ QTest::addColumn<IntPairPairList>("rangesToSelect");
+ QTest::addColumn<IntPairList>("expectedSelectedIndexesPairs");
+ QTest::newRow("Single index in > 0 column")
+ << (IntPairPairList() << IntPairPair(IntPair(0, 1), IntPair(0, 1)))
+ << (IntPairList() << IntPair(0, 1));
+ QTest::newRow("Rectangle in > 0 column")
+ << (IntPairPairList() << IntPairPair(IntPair(0, 1), IntPair(1, 2)))
+ << (IntPairList() << IntPair(0, 1) << IntPair(0, 2) << IntPair(1, 1) << IntPair(1, 2));
+ QTest::newRow("Diagonal in > 0 column")
+ << (IntPairPairList()
+ << IntPairPair(IntPair(0, 1), IntPair(0, 1))
+ << IntPairPair(IntPair(1, 2), IntPair(1, 2))
+ << IntPairPair(IntPair(2, 3), IntPair(2, 3)))
+ << (IntPairList()
+ << IntPair(0, 1)
+ << IntPair(1, 2)
+ << IntPair(2, 3));
+}
+
+void tst_QItemSelectionModel::QTBUG58851()
+{
+ using IntPair = std::pair<int, int>;
+ using IntPairList = QList<IntPair>;
+ using IntPairPair = std::pair<IntPair, IntPair>;
+ using IntPairPairList = QList<IntPairPair>;
+
+ QFETCH(IntPairPairList, rangesToSelect);
+ QFETCH(IntPairList, expectedSelectedIndexesPairs);
+
+ QStandardItemModel model(4, 4);
+ for (int row = 0; row < model.rowCount(); ++row) {
+ for (int column = 0; column < model.columnCount(); ++column) {
+ QStandardItem *item = new QStandardItem(QString("%0%1").arg(row).arg(column));
+ model.setItem(row, column, item);
+ }
+ }
+
+ QSortFilterProxyModel proxy;
+ proxy.setSourceModel(&model);
+ proxy.setSortRole(Qt::DisplayRole);
+
+ std::vector<QPersistentModelIndex> expectedSelectedIndexes;
+ for (const IntPair &index : expectedSelectedIndexesPairs)
+ expectedSelectedIndexes.emplace_back(proxy.index(index.first, index.second));
+
+ QItemSelectionModel selections(&proxy);
+ for (const IntPairPair &range : rangesToSelect) {
+ const IntPair &tl = range.first;
+ const IntPair &br = range.second;
+ selections.select(QItemSelection(proxy.index(tl.first, tl.second),
+ proxy.index(br.first, br.second)),
+ QItemSelectionModel::Select);
+ }
+
+ for (const QPersistentModelIndex &i : expectedSelectedIndexes) {
+ QVERIFY(selections.isSelected(i));
+ }
+ proxy.sort(1, Qt::DescendingOrder);
+ QCOMPARE(selections.selectedIndexes().count(), (int)expectedSelectedIndexes.size());
+ for (const QPersistentModelIndex &i : expectedSelectedIndexes) {
+ QVERIFY(selections.isSelected(i));
+ }
+}
+
QTEST_MAIN(tst_QItemSelectionModel)
#include "tst_qitemselectionmodel.moc"
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
index 31e76c4407..22f0d8ecaa 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
@@ -155,7 +155,9 @@ void tst_QCoreApplication::qAppName()
void tst_QCoreApplication::qAppVersion()
{
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WINRT)
+ const char appVersion[] = "1.0.0.0";
+#elif defined(Q_OS_WIN)
const char appVersion[] = "1.2.3.4";
#elif defined(Q_OS_DARWIN) || defined(Q_OS_ANDROID)
const char appVersion[] = "1.2.3";
@@ -946,9 +948,12 @@ void tst_QCoreApplication::addRemoveLibPaths()
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
TestApplication app(argc, argv);
- // Check that modifications stay alive across the creation of an application.
- QVERIFY(QCoreApplication::libraryPaths().contains(currentDir));
- QVERIFY(!QCoreApplication::libraryPaths().contains(paths[0]));
+ // If libraryPaths only contains currentDir, neither will be in libraryPaths now.
+ if (paths.length() != 1 && currentDir != paths[0]) {
+ // Check that modifications stay alive across the creation of an application.
+ QVERIFY(QCoreApplication::libraryPaths().contains(currentDir));
+ QVERIFY(!QCoreApplication::libraryPaths().contains(paths[0]));
+ }
QStringList replace;
replace << currentDir << paths[0];
diff --git a/tests/auto/corelib/kernel/qeventdispatcher/BLACKLIST b/tests/auto/corelib/kernel/qeventdispatcher/BLACKLIST
index 00be65751b..402d87b82f 100644
--- a/tests/auto/corelib/kernel/qeventdispatcher/BLACKLIST
+++ b/tests/auto/corelib/kernel/qeventdispatcher/BLACKLIST
@@ -1,4 +1,6 @@
[sendPostedEvents]
windows
+osx
[registerTimer]
windows
+osx
diff --git a/tests/auto/corelib/kernel/qeventloop/BLACKLIST b/tests/auto/corelib/kernel/qeventloop/BLACKLIST
index 6ea6314b0a..9f837aa197 100644
--- a/tests/auto/corelib/kernel/qeventloop/BLACKLIST
+++ b/tests/auto/corelib/kernel/qeventloop/BLACKLIST
@@ -1,2 +1,3 @@
[testQuitLock]
windows
+osx
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index b6106e8c9e..f9ddd59aaa 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -1721,10 +1721,10 @@ void tst_QMetaType::metaObject()
}
#define METATYPE_ID_FUNCTION(Type, MetaTypeId, Name) \
- case ::qMetaTypeId< Name >(): metaType = MetaTypeIdStruct<MetaTypeId>::Value;
+ case ::qMetaTypeId< Name >(): metaType = MetaTypeIdStruct<MetaTypeId>::Value; break;
#define REGISTER_METATYPE_FUNCTION(Type, MetaTypeId, Name) \
- case qRegisterMetaType< Name >(): metaType = RegisterMetaTypeStruct<MetaTypeId>::Value;
+ case qRegisterMetaType< Name >(): metaType = RegisterMetaTypeStruct<MetaTypeId>::Value; break;
template<int>
struct MetaTypeIdStruct
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index db6bdf0809..642d48d721 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -6926,309 +6926,261 @@ void tst_QObject::checkArgumentsForNarrowing()
enum UnscopedEnum {};
enum SignedUnscopedEnum { SignedUnscopedEnumV1 = -1, SignedUnscopedEnumV2 = 1 };
- QVERIFY(sizeof(UnscopedEnum) <= sizeof(int));
- QVERIFY(sizeof(SignedUnscopedEnum) <= sizeof(int));
+ // a constexpr would suffice, but MSVC2013 RTM doesn't support them...
+#define IS_UNSCOPED_ENUM_SIGNED (std::is_signed<typename std::underlying_type<UnscopedEnum>::type>::value)
+
+#define NARROWS_IF(x, y, test) Q_STATIC_ASSERT((QtPrivate::AreArgumentsNarrowedBase<x, y>::value) == (test))
+#define FITS_IF(x, y, test) Q_STATIC_ASSERT((QtPrivate::AreArgumentsNarrowedBase<x, y>::value) != (test))
+#define NARROWS(x, y) NARROWS_IF(x, y, true)
+#define FITS(x, y) FITS_IF(x, y, true)
+
+ Q_STATIC_ASSERT(sizeof(UnscopedEnum) <= sizeof(int));
+ Q_STATIC_ASSERT(sizeof(SignedUnscopedEnum) <= sizeof(int));
// floating point to integral
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<float, bool>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<double, bool>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long double, bool>::value));
+ NARROWS(float, bool);
+ NARROWS(double, bool);
+ NARROWS(long double, bool);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<float, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<double, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long double, char>::value));
+ NARROWS(float, char);
+ NARROWS(double, char);
+ NARROWS(long double, char);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<float, short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<double, short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long double, short>::value));
+ NARROWS(float, short);
+ NARROWS(double, short);
+ NARROWS(long double, short);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<float, int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<double, int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long double, int>::value));
+ NARROWS(float, int);
+ NARROWS(double, int);
+ NARROWS(long double, int);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<float, long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<double, long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long double, long>::value));
+ NARROWS(float, long);
+ NARROWS(double, long);
+ NARROWS(long double, long);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<float, long long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<double, long long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long double, long long>::value));
+ NARROWS(float, long long);
+ NARROWS(double, long long);
+ NARROWS(long double, long long);
// floating point to a smaller floating point
- if (sizeof(double) > sizeof(float)) {
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<double, float>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long double, float>::value));
- }
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<float, double>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<float, long double>::value));
+ NARROWS_IF(double, float, (sizeof(double) > sizeof(float)));
+ NARROWS_IF(long double, float, (sizeof(long double) > sizeof(float)));
+ FITS(float, double);
+ FITS(float, long double);
- if (sizeof(long double) > sizeof(double))
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long double, float>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<double, long double>::value));
+ NARROWS_IF(long double, double, (sizeof(long double) > sizeof(double)));
+ FITS(double, long double);
// integral to floating point
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, float>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, double>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, long double>::value));
+ NARROWS(bool, float);
+ NARROWS(bool, double);
+ NARROWS(bool, long double);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<char, float>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<char, double>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<char, long double>::value));
+ NARROWS(char, float);
+ NARROWS(char, double);
+ NARROWS(char, long double);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, float>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, double>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, long double>::value));
+ NARROWS(short, float);
+ NARROWS(short, double);
+ NARROWS(short, long double);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, float>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, double>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, long double>::value));
+ NARROWS(int, float);
+ NARROWS(int, double);
+ NARROWS(int, long double);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, float>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, double>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, long double>::value));
+ NARROWS(long, float);
+ NARROWS(long, double);
+ NARROWS(long, long double);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, float>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, double>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, long double>::value));
+ NARROWS(long long, float);
+ NARROWS(long long, double);
+ NARROWS(long long, long double);
// enum to floating point
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, float>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, double>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, long double>::value));
+ NARROWS(UnscopedEnum, float);
+ NARROWS(UnscopedEnum, double);
+ NARROWS(UnscopedEnum, long double);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, float>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, double>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, long double>::value));
+ NARROWS(SignedUnscopedEnum, float);
+ NARROWS(SignedUnscopedEnum, double);
+ NARROWS(SignedUnscopedEnum, long double);
// integral to smaller integral
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<bool, bool>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<char, char>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<signed char, signed char>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<signed char, short>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<signed char, int>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<signed char, long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<signed char, long long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned char, unsigned char>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned char, unsigned short>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned char, unsigned int>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned char, unsigned long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned char, unsigned long long>::value));
-
- if (sizeof(bool) > sizeof(char))
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, unsigned char>::value));
- else
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<bool, unsigned char>::value));
-
- if (sizeof(bool) > sizeof(short))
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, unsigned short>::value));
- else
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<bool, unsigned short>::value));
-
- if (sizeof(bool) > sizeof(int))
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, unsigned int>::value));
- else
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<bool, unsigned int>::value));
-
- if (sizeof(bool) > sizeof(long))
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, unsigned long>::value));
- else
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<bool, unsigned long>::value));
-
- if (sizeof(bool) > sizeof(long long))
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, unsigned long long>::value));
- else
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<bool, unsigned long long>::value));
-
- if (sizeof(short) > sizeof(char)) {
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, signed char>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned short, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned short, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned short, signed char>::value));
- }
-
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<short, short>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<short, int>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<short, long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<short, long long>::value));
-
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned short, unsigned short>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned short, unsigned int>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned short, unsigned long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned short, unsigned long long>::value));
-
- if (sizeof(int) > sizeof(short)) {
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, unsigned short>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned int, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned int, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned int, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned int, short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned int, unsigned short>::value));
- }
-
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<int, int>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<int, long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<int, long long>::value));
-
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned int, unsigned int>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned int, unsigned long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned int, unsigned long long>::value));
-
- if (sizeof(long) > sizeof(int)) {
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, unsigned int>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, unsigned int>::value));
- }
-
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<long, long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<long, long long>::value));
-
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned long, unsigned long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned long, unsigned long long>::value));
-
- if (sizeof(long long) > sizeof(long)) {
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, unsigned int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, unsigned long>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, unsigned int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, unsigned long>::value));
- }
-
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<long long, long long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned long long, unsigned long long>::value));
+ FITS(bool, bool);
+ FITS(char, char);
+ FITS(signed char, signed char);
+ FITS(signed char, short);
+ FITS(signed char, int);
+ FITS(signed char, long);
+ FITS(signed char, long long);
+ FITS(unsigned char, unsigned char);
+ FITS(unsigned char, unsigned short);
+ FITS(unsigned char, unsigned int);
+ FITS(unsigned char, unsigned long);
+ FITS(unsigned char, unsigned long long);
+
+ NARROWS_IF(bool, unsigned char, (sizeof(bool) > sizeof(char) || std::is_signed<bool>::value));
+ NARROWS_IF(bool, unsigned short, (sizeof(bool) > sizeof(short) || std::is_signed<bool>::value));
+ NARROWS_IF(bool, unsigned int, (sizeof(bool) > sizeof(int) || std::is_signed<bool>::value));
+ NARROWS_IF(bool, unsigned long, (sizeof(bool) > sizeof(long) || std::is_signed<bool>::value));
+ NARROWS_IF(bool, unsigned long long, (sizeof(bool) > sizeof(long long) || std::is_signed<bool>::value));
+
+ NARROWS_IF(short, char, (sizeof(short) > sizeof(char) || std::is_unsigned<char>::value));
+ NARROWS_IF(short, unsigned char, (sizeof(short) > sizeof(char)));
+ NARROWS_IF(short, signed char, (sizeof(short) > sizeof(char)));
+
+ NARROWS_IF(unsigned short, char, (sizeof(short) > sizeof(char) || std::is_signed<char>::value));
+ NARROWS_IF(unsigned short, unsigned char, (sizeof(short) > sizeof(char)));
+ NARROWS_IF(unsigned short, signed char, (sizeof(short) > sizeof(char)));
+
+ FITS(short, short);
+ FITS(short, int);
+ FITS(short, long);
+ FITS(short, long long);
+
+ FITS(unsigned short, unsigned short);
+ FITS(unsigned short, unsigned int);
+ FITS(unsigned short, unsigned long);
+ FITS(unsigned short, unsigned long long);
+
+ NARROWS_IF(int, char, (sizeof(int) > sizeof(char) || std::is_unsigned<char>::value));
+ NARROWS(int, unsigned char);
+ NARROWS_IF(int, signed char, (sizeof(int) > sizeof(char)));
+ NARROWS_IF(int, short, (sizeof(int) > sizeof(short)));
+ NARROWS(int, unsigned short);
+
+ NARROWS_IF(unsigned int, char, (sizeof(int) > sizeof(char) || std::is_signed<char>::value));
+ NARROWS_IF(unsigned int, unsigned char, (sizeof(int) > sizeof(char)));
+ NARROWS(unsigned int, signed char);
+ NARROWS(unsigned int, short);
+ NARROWS_IF(unsigned int, unsigned short, (sizeof(int) > sizeof(short)));
+
+ FITS(int, int);
+ FITS(int, long);
+ FITS(int, long long);
+
+ FITS(unsigned int, unsigned int);
+ FITS(unsigned int, unsigned long);
+ FITS(unsigned int, unsigned long long);
+
+ NARROWS_IF(long, char, (sizeof(long) > sizeof(char) || std::is_unsigned<char>::value));
+ NARROWS(long, unsigned char);
+ NARROWS_IF(long, signed char, (sizeof(long) > sizeof(char)));
+ NARROWS_IF(long, short, (sizeof(long) > sizeof(short)));
+ NARROWS(long, unsigned short);
+ NARROWS_IF(long, int, (sizeof(long) > sizeof(int)));
+ NARROWS(long, unsigned int);
+
+ NARROWS_IF(unsigned long, char, (sizeof(long) > sizeof(char) || std::is_signed<char>::value));
+ NARROWS_IF(unsigned long, unsigned char, (sizeof(long) > sizeof(char)));
+ NARROWS(unsigned long, signed char);
+ NARROWS(unsigned long, short);
+ NARROWS_IF(unsigned long, unsigned short, (sizeof(long) > sizeof(short)));
+ NARROWS(unsigned long, int);
+ NARROWS_IF(unsigned long, unsigned int, (sizeof(long) > sizeof(int)));
+
+ FITS(long, long);
+ FITS(long, long long);
+
+ FITS(unsigned long, unsigned long);
+ FITS(unsigned long, unsigned long long);
+
+ NARROWS_IF(long long, char, (sizeof(long long) > sizeof(char) || std::is_unsigned<char>::value));
+ NARROWS(long long, unsigned char);
+ NARROWS_IF(long long, signed char, (sizeof(long long) > sizeof(char)));
+ NARROWS_IF(long long, short, (sizeof(long long) > sizeof(short)));
+ NARROWS(long long, unsigned short);
+ NARROWS_IF(long long, int, (sizeof(long long) > sizeof(int)));
+ NARROWS(long long, unsigned int);
+ NARROWS_IF(long long, long, (sizeof(long long) > sizeof(long)));
+ NARROWS(long long, unsigned long);
+
+ NARROWS_IF(unsigned long long, char, (sizeof(long long) > sizeof(char) || std::is_signed<char>::value));
+ NARROWS_IF(unsigned long long, unsigned char, (sizeof(long long) > sizeof(char)));
+ NARROWS(unsigned long long, signed char);
+ NARROWS(unsigned long long, short);
+ NARROWS_IF(unsigned long long, unsigned short, (sizeof(long long) > sizeof(short)));
+ NARROWS(unsigned long long, int);
+ NARROWS_IF(unsigned long long, unsigned int, (sizeof(long long) > sizeof(int)));
+ NARROWS(unsigned long long, long);
+ NARROWS_IF(unsigned long long, unsigned long, (sizeof(long long) > sizeof(long)));
+
+ FITS(long long, long long);
+ FITS(unsigned long long, unsigned long long);
// integral to integral with different signedness. smaller ones tested above
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<signed char, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<signed char, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<signed char, unsigned int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<signed char, unsigned long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<signed char, unsigned long long>::value));
+ NARROWS(signed char, unsigned char);
+ NARROWS(signed char, unsigned short);
+ NARROWS(signed char, unsigned int);
+ NARROWS(signed char, unsigned long);
+ NARROWS(signed char, unsigned long long);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned char, signed char>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned char, short>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned char, int>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned char, long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned char, long long>::value));
+ NARROWS(unsigned char, signed char);
+ FITS(unsigned char, short);
+ FITS(unsigned char, int);
+ FITS(unsigned char, long);
+ FITS(unsigned char, long long);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, unsigned int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, unsigned long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, unsigned long long>::value));
+ NARROWS(short, unsigned short);
+ NARROWS(short, unsigned int);
+ NARROWS(short, unsigned long);
+ NARROWS(short, unsigned long long);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned short, short>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned short, int>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned short, long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned short, long long>::value));
+ NARROWS(unsigned short, short);
+ FITS(unsigned short, int);
+ FITS(unsigned short, long);
+ FITS(unsigned short, long long);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, unsigned int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, unsigned long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, unsigned long long>::value));
+ NARROWS(int, unsigned int);
+ NARROWS(int, unsigned long);
+ NARROWS(int, unsigned long long);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned int, int>::value));
- QCOMPARE((QtPrivate::AreArgumentsNarrowedBase<unsigned int, long>::value), sizeof(int) >= sizeof(long));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned int, long long>::value));
+ NARROWS(unsigned int, int);
+ NARROWS_IF(unsigned int, long, (sizeof(int) >= sizeof(long)));
+ FITS(unsigned int, long long);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, unsigned long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, unsigned long long>::value));
+ NARROWS(long, unsigned long);
+ NARROWS(long, unsigned long long);
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, long>::value));
- QCOMPARE((QtPrivate::AreArgumentsNarrowedBase<unsigned long, long long>::value), sizeof(long) >= sizeof(long long));
+ NARROWS(unsigned long, long);
+ NARROWS_IF(unsigned long, long long, (sizeof(long) >= sizeof(long long)));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, unsigned long long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, long long>::value));
+ NARROWS(long long, unsigned long long);
+ NARROWS(unsigned long long, long long);
// enum to smaller integral
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, UnscopedEnum>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, SignedUnscopedEnum>::value));
-
- if (std::is_signed<typename std::underlying_type<UnscopedEnum>::type>::value) {
- if (sizeof(UnscopedEnum) > sizeof(char))
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, signed char>::value));
- else
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, signed char>::value));
-
- if (sizeof(UnscopedEnum) > sizeof(short))
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, short>::value));
- else
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, short>::value));
-
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, int>::value));
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, long>::value));
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, long long>::value));
- } else {
- if (sizeof(UnscopedEnum) > sizeof(bool))
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, bool>::value));
- else
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, bool>::value));
+ // (note that we know that sizeof(UnscopedEnum) <= sizeof(int)
+ FITS(UnscopedEnum, UnscopedEnum);
+ FITS(SignedUnscopedEnum, SignedUnscopedEnum);
- if (sizeof(UnscopedEnum) > sizeof(char))
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned char>::value));
- else
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned char>::value));
+ NARROWS_IF(UnscopedEnum, char, ((sizeof(UnscopedEnum) > sizeof(char)) || (sizeof(UnscopedEnum) == sizeof(char) && IS_UNSCOPED_ENUM_SIGNED == std::is_signed<char>::value)));
+ NARROWS_IF(UnscopedEnum, signed char, ((sizeof(UnscopedEnum) > sizeof(char)) || (sizeof(UnscopedEnum) == sizeof(char) && !IS_UNSCOPED_ENUM_SIGNED)));
+ NARROWS_IF(UnscopedEnum, unsigned char, ((sizeof(UnscopedEnum) > sizeof(char)) || IS_UNSCOPED_ENUM_SIGNED));
- if (sizeof(UnscopedEnum) > sizeof(short))
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned short>::value));
- else
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned short>::value));
+ NARROWS_IF(UnscopedEnum, short, ((sizeof(UnscopedEnum) > sizeof(short)) || (sizeof(UnscopedEnum) == sizeof(short) && !IS_UNSCOPED_ENUM_SIGNED)));
+ NARROWS_IF(UnscopedEnum, unsigned short, ((sizeof(UnscopedEnum) > sizeof(short)) || IS_UNSCOPED_ENUM_SIGNED));
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned int>::value));
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned long>::value));
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned long long>::value));
- }
+ NARROWS_IF(UnscopedEnum, int, (sizeof(UnscopedEnum) == sizeof(int) && !IS_UNSCOPED_ENUM_SIGNED));
+ NARROWS_IF(UnscopedEnum, unsigned int, IS_UNSCOPED_ENUM_SIGNED);
- QVERIFY(std::is_signed<typename std::underlying_type<SignedUnscopedEnum>::type>::value);
+ NARROWS_IF(UnscopedEnum, long, (sizeof(UnscopedEnum) == sizeof(long) && !IS_UNSCOPED_ENUM_SIGNED));
+ NARROWS_IF(UnscopedEnum, unsigned long, IS_UNSCOPED_ENUM_SIGNED);
- if (sizeof(SignedUnscopedEnum) > sizeof(char))
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, signed char>::value));
- else
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, signed char>::value));
+ NARROWS_IF(UnscopedEnum, long long, (sizeof(UnscopedEnum) == sizeof(long long) && !IS_UNSCOPED_ENUM_SIGNED));
+ NARROWS_IF(UnscopedEnum, unsigned long long, IS_UNSCOPED_ENUM_SIGNED);
- if (sizeof(SignedUnscopedEnum) > sizeof(short))
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, short>::value));
- else
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, short>::value));
+ Q_STATIC_ASSERT(std::is_signed<typename std::underlying_type<SignedUnscopedEnum>::type>::value);
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, int>::value));
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, long>::value));
- QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, long long>::value));
+ NARROWS_IF(SignedUnscopedEnum, signed char, (sizeof(SignedUnscopedEnum) > sizeof(char)));
+ NARROWS_IF(SignedUnscopedEnum, short, (sizeof(SignedUnscopedEnum) > sizeof(short)));
+ FITS(SignedUnscopedEnum, int);
+ FITS(SignedUnscopedEnum, long);
+ FITS(SignedUnscopedEnum, long long);
enum class ScopedEnumBackedBySChar : signed char { A };
@@ -7242,192 +7194,190 @@ void tst_QObject::checkArgumentsForNarrowing()
enum class ScopedEnumBackedByLongLong : long long { A };
enum class ScopedEnumBackedByULongLong : unsigned long long { A };
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, ScopedEnumBackedBySChar>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, ScopedEnumBackedByUChar>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, ScopedEnumBackedByShort>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, ScopedEnumBackedByUShort>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, ScopedEnumBackedByInt>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, ScopedEnumBackedByUInt>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, ScopedEnumBackedByLong>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, ScopedEnumBackedByULong>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, ScopedEnumBackedByLongLong>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, ScopedEnumBackedByULongLong>::value));
-
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, signed char>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, unsigned char>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, short>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, unsigned short>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, int>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, unsigned int>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, unsigned long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, long long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, unsigned long long>::value));
-
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, signed char>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, short>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, int>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, long long>::value));
-
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, unsigned char>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, unsigned short>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, unsigned int>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, unsigned long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, unsigned long long>::value));
-
- if (sizeof(short) > sizeof(char)) {
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, char>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, signed char>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, unsigned char>::value));
- }
-
- if (sizeof(int) > sizeof(short)) {
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, short>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, unsigned short>::value));
- }
-
- if (sizeof(long) > sizeof(int)) {
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, int>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, unsigned int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, unsigned int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, unsigned int>::value));
- }
-
- if (sizeof(long long) > sizeof(long)) {
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, long>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, unsigned long>::value));
- }
+ FITS(ScopedEnumBackedBySChar, ScopedEnumBackedBySChar);
+ FITS(ScopedEnumBackedByUChar, ScopedEnumBackedByUChar);
+ FITS(ScopedEnumBackedByShort, ScopedEnumBackedByShort);
+ FITS(ScopedEnumBackedByUShort, ScopedEnumBackedByUShort);
+ FITS(ScopedEnumBackedByInt, ScopedEnumBackedByInt);
+ FITS(ScopedEnumBackedByUInt, ScopedEnumBackedByUInt);
+ FITS(ScopedEnumBackedByLong, ScopedEnumBackedByLong);
+ FITS(ScopedEnumBackedByULong, ScopedEnumBackedByULong);
+ FITS(ScopedEnumBackedByLongLong, ScopedEnumBackedByLongLong);
+ FITS(ScopedEnumBackedByULongLong, ScopedEnumBackedByULongLong);
+
+ FITS(ScopedEnumBackedBySChar, signed char);
+ FITS(ScopedEnumBackedByUChar, unsigned char);
+ FITS(ScopedEnumBackedByShort, short);
+ FITS(ScopedEnumBackedByUShort, unsigned short);
+ FITS(ScopedEnumBackedByInt, int);
+ FITS(ScopedEnumBackedByUInt, unsigned int);
+ FITS(ScopedEnumBackedByLong, long);
+ FITS(ScopedEnumBackedByULong, unsigned long);
+ FITS(ScopedEnumBackedByLongLong, long long);
+ FITS(ScopedEnumBackedByULongLong, unsigned long long);
+
+ FITS(ScopedEnumBackedBySChar, signed char);
+ FITS(ScopedEnumBackedBySChar, short);
+ FITS(ScopedEnumBackedBySChar, int);
+ FITS(ScopedEnumBackedBySChar, long);
+ FITS(ScopedEnumBackedBySChar, long long);
+
+ FITS(ScopedEnumBackedByUChar, unsigned char);
+ FITS(ScopedEnumBackedByUChar, unsigned short);
+ FITS(ScopedEnumBackedByUChar, unsigned int);
+ FITS(ScopedEnumBackedByUChar, unsigned long);
+ FITS(ScopedEnumBackedByUChar, unsigned long long);
+
+ NARROWS_IF(ScopedEnumBackedByShort, char, (sizeof(short) > sizeof(char) || std::is_unsigned<char>::value));
+ NARROWS_IF(ScopedEnumBackedByUShort, char, (sizeof(short) > sizeof(char) || std::is_signed<char>::value));
+ NARROWS_IF(ScopedEnumBackedByInt, char, (sizeof(int) > sizeof(char) || std::is_unsigned<char>::value));
+ NARROWS_IF(ScopedEnumBackedByUInt, char, (sizeof(int) > sizeof(char) || std::is_signed<char>::value));
+ NARROWS_IF(ScopedEnumBackedByLong, char, (sizeof(long) > sizeof(char) || std::is_unsigned<char>::value));
+ NARROWS_IF(ScopedEnumBackedByULong, char, (sizeof(long) > sizeof(char) || std::is_signed<char>::value));
+ NARROWS_IF(ScopedEnumBackedByLongLong, char, (sizeof(long long) > sizeof(char) || std::is_unsigned<char>::value));
+ NARROWS_IF(ScopedEnumBackedByULongLong, char, (sizeof(long long) > sizeof(char) || std::is_signed<char>::value));
+
+ NARROWS_IF(ScopedEnumBackedByShort, signed char, (sizeof(short) > sizeof(char)));
+ NARROWS(ScopedEnumBackedByUShort, signed char);
+ NARROWS_IF(ScopedEnumBackedByInt, signed char, (sizeof(int) > sizeof(char)));
+ NARROWS(ScopedEnumBackedByUInt, signed char);
+ NARROWS_IF(ScopedEnumBackedByLong, signed char, (sizeof(long) > sizeof(char)));
+ NARROWS(ScopedEnumBackedByULong, signed char);
+ NARROWS_IF(ScopedEnumBackedByLongLong, signed char, (sizeof(long long) > sizeof(char)));
+ NARROWS(ScopedEnumBackedByULongLong, signed char);
+
+ NARROWS(ScopedEnumBackedByShort, unsigned char);
+ NARROWS_IF(ScopedEnumBackedByUShort, unsigned char, (sizeof(short) > sizeof(char)));
+ NARROWS(ScopedEnumBackedByInt, unsigned char);
+ NARROWS_IF(ScopedEnumBackedByUInt, unsigned char, (sizeof(int) > sizeof(char)));
+ NARROWS(ScopedEnumBackedByLong, unsigned char);
+ NARROWS_IF(ScopedEnumBackedByULong, unsigned char, (sizeof(long) > sizeof(char)));
+ NARROWS(ScopedEnumBackedByLongLong, unsigned char);
+ NARROWS_IF(ScopedEnumBackedByULongLong, unsigned char, (sizeof(long long) > sizeof(char)));
+
+ NARROWS_IF(ScopedEnumBackedByInt, short, (sizeof(int) > sizeof(short)));
+ NARROWS(ScopedEnumBackedByUInt, short);
+ NARROWS_IF(ScopedEnumBackedByLong, short, (sizeof(long) > sizeof(short)));
+ NARROWS(ScopedEnumBackedByULong, short);
+ NARROWS_IF(ScopedEnumBackedByLongLong, short, (sizeof(long long) > sizeof(short)));
+ NARROWS(ScopedEnumBackedByULongLong, short);
+
+ NARROWS(ScopedEnumBackedByInt, unsigned short);
+ NARROWS_IF(ScopedEnumBackedByUInt, unsigned short, (sizeof(int) > sizeof(short)));
+ NARROWS(ScopedEnumBackedByLong, unsigned short);
+ NARROWS_IF(ScopedEnumBackedByULong, unsigned short, (sizeof(long) > sizeof(short)));
+ NARROWS(ScopedEnumBackedByLongLong, unsigned short);
+ NARROWS_IF(ScopedEnumBackedByULongLong, unsigned short, (sizeof(long long) > sizeof(short)));
+
+ NARROWS_IF(ScopedEnumBackedByLong, int, (sizeof(long) > sizeof(int)));
+ NARROWS(ScopedEnumBackedByULong, int);
+ NARROWS_IF(ScopedEnumBackedByLongLong, int, (sizeof(long long) > sizeof(int)));
+ NARROWS(ScopedEnumBackedByULongLong, int);
+
+ NARROWS(ScopedEnumBackedByLong, unsigned int);
+ NARROWS_IF(ScopedEnumBackedByULong, unsigned int, (sizeof(long) > sizeof(int)));
+ NARROWS(ScopedEnumBackedByLongLong, unsigned int);
+ NARROWS_IF(ScopedEnumBackedByULongLong, unsigned int, (sizeof(long long) > sizeof(int)));
+
+ NARROWS_IF(ScopedEnumBackedByLongLong, long, (sizeof(long long) > sizeof(long)));
+ NARROWS(ScopedEnumBackedByULongLong, long);
+
+ NARROWS(ScopedEnumBackedByLongLong, unsigned long);
+ NARROWS_IF(ScopedEnumBackedByULongLong, unsigned long, (sizeof(long long) > sizeof(long)));
// different signedness of the underlying type
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, unsigned int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, unsigned long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, unsigned long long>::value));
-
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, unsigned int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, unsigned long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, unsigned long long>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, unsigned int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, unsigned long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, unsigned long long>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, unsigned int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, unsigned long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, unsigned long long>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, unsigned int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, unsigned long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, unsigned long long>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned long long>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, signed char>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, short>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, int>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, long long>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, short>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, int>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, long long>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, int>::value));
- QCOMPARE((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, long>::value), sizeof(ScopedEnumBackedByUInt) >= sizeof(long));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, long long>::value));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, long>::value));
- QCOMPARE((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, long long>::value), sizeof(ScopedEnumBackedByULong) >= sizeof(long long));
-
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, signed char>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, short>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, int>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, long>::value));
- QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, long long>::value));
+ NARROWS(SignedUnscopedEnum, unsigned char);
+ NARROWS(SignedUnscopedEnum, unsigned short);
+ NARROWS(SignedUnscopedEnum, unsigned int);
+ NARROWS(SignedUnscopedEnum, unsigned long);
+ NARROWS(SignedUnscopedEnum, unsigned long long);
+
+ NARROWS(ScopedEnumBackedBySChar, unsigned char);
+ NARROWS(ScopedEnumBackedBySChar, unsigned short);
+ NARROWS(ScopedEnumBackedBySChar, unsigned int);
+ NARROWS(ScopedEnumBackedBySChar, unsigned long);
+ NARROWS(ScopedEnumBackedBySChar, unsigned long long);
+
+ NARROWS(ScopedEnumBackedByShort, unsigned char);
+ NARROWS(ScopedEnumBackedByShort, unsigned short);
+ NARROWS(ScopedEnumBackedByShort, unsigned int);
+ NARROWS(ScopedEnumBackedByShort, unsigned long);
+ NARROWS(ScopedEnumBackedByShort, unsigned long long);
+
+ NARROWS(ScopedEnumBackedByInt, unsigned char);
+ NARROWS(ScopedEnumBackedByInt, unsigned short);
+ NARROWS(ScopedEnumBackedByInt, unsigned int);
+ NARROWS(ScopedEnumBackedByInt, unsigned long);
+ NARROWS(ScopedEnumBackedByInt, unsigned long long);
+
+ NARROWS(ScopedEnumBackedByLong, unsigned char);
+ NARROWS(ScopedEnumBackedByLong, unsigned short);
+ NARROWS(ScopedEnumBackedByLong, unsigned int);
+ NARROWS(ScopedEnumBackedByLong, unsigned long);
+ NARROWS(ScopedEnumBackedByLong, unsigned long long);
+
+ NARROWS(ScopedEnumBackedByLongLong, unsigned char);
+ NARROWS(ScopedEnumBackedByLongLong, unsigned short);
+ NARROWS(ScopedEnumBackedByLongLong, unsigned int);
+ NARROWS(ScopedEnumBackedByLongLong, unsigned long);
+ NARROWS(ScopedEnumBackedByLongLong, unsigned long long);
+
+ NARROWS(ScopedEnumBackedByUChar, signed char);
+ FITS_IF(ScopedEnumBackedByUChar, short, (sizeof(char) < sizeof(short)));
+ FITS_IF(ScopedEnumBackedByUChar, int, (sizeof(char) < sizeof(int)));
+ FITS_IF(ScopedEnumBackedByUChar, long, (sizeof(char) < sizeof(long)));
+ FITS_IF(ScopedEnumBackedByUChar, long long, (sizeof(char) < sizeof(long long)));
+
+ NARROWS(ScopedEnumBackedByUShort, signed char);
+ NARROWS(ScopedEnumBackedByUShort, short);
+ FITS_IF(ScopedEnumBackedByUShort, int, (sizeof(short) < sizeof(int)));
+ FITS_IF(ScopedEnumBackedByUShort, long, (sizeof(short) < sizeof(long)));
+ FITS_IF(ScopedEnumBackedByUShort, long long, (sizeof(short) < sizeof(long long)));
+
+ NARROWS(ScopedEnumBackedByUInt, signed char);
+ NARROWS(ScopedEnumBackedByUInt, short);
+ NARROWS(ScopedEnumBackedByUInt, int);
+ FITS_IF(ScopedEnumBackedByUInt, long, (sizeof(ScopedEnumBackedByUInt) < sizeof(long)));
+ FITS(ScopedEnumBackedByUInt, long long);
+
+ NARROWS(ScopedEnumBackedByULong, signed char);
+ NARROWS(ScopedEnumBackedByULong, short);
+ NARROWS(ScopedEnumBackedByULong, int);
+ NARROWS(ScopedEnumBackedByULong, long);
+ FITS_IF(ScopedEnumBackedByULong, long long, (sizeof(ScopedEnumBackedByULong) < sizeof(long long)));
+
+ NARROWS(ScopedEnumBackedByULongLong, signed char);
+ NARROWS(ScopedEnumBackedByULongLong, short);
+ NARROWS(ScopedEnumBackedByULongLong, int);
+ NARROWS(ScopedEnumBackedByULongLong, long);
+ NARROWS(ScopedEnumBackedByULongLong, long long);
// other types which should be always unaffected
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<void *, void *>::value));
+ FITS(void *, void *);
+
+ FITS(QString, QString);
+ FITS(QString &, QString &);
+ FITS(const QString &, const QString &);
+
+ FITS(QObject, QObject);
+ FITS(QObject *, QObject *);
+ FITS(const QObject *, const QObject *);
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QString, QString>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QString &, QString &>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<const QString &, const QString &>::value));
+ FITS(std::nullptr_t, std::nullptr_t);
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QObject, QObject>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QObject *, QObject *>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<const QObject *, const QObject *>::value));
+ FITS(QString, QObject);
+ FITS(QString, QVariant);
+ FITS(QString, void *);
+ FITS(QString, long long);
+ FITS(bool, const QObject *&);
+ FITS(int (*)(bool), void (QObject::*)());
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<std::nullptr_t, std::nullptr_t>::value));
+#undef IS_UNSCOPED_ENUM_SIGNED
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QString, QObject>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QString, QVariant>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QString, void *>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QString, long long>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<bool, const QObject *&>::value));
- QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<int (*)(bool), void (QObject::*)()>::value));
+#undef NARROWS_IF
+#undef FITS_IF
+#undef NARROWS
+#undef FITS
}
// Test for QtPrivate::HasQ_OBJECT_Macro
diff --git a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
index a52b80170f..e3f45df27d 100644
--- a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
+++ b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
@@ -350,6 +350,9 @@ void tst_QSocketNotifier::async_writeDatagramSlot()
void tst_QSocketNotifier::asyncMultipleDatagram()
{
+#ifdef Q_OS_WINRT
+ QSKIP("WinRT does not allow connection to localhost", SkipAll);
+#else
m_asyncSender = new QUdpSocket;
m_asyncReceiver = new QUdpSocket;
@@ -379,6 +382,7 @@ void tst_QSocketNotifier::asyncMultipleDatagram()
delete m_asyncSender;
delete m_asyncReceiver;
+ #endif // !Q_OS_WINRT
}
QTEST_MAIN(tst_QSocketNotifier)
diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
index 3c2989831e..d2035a088e 100644
--- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
+++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
@@ -144,12 +144,10 @@ void tst_QTimer::timeout()
QCOMPARE(helper.count, 0);
- QTest::qWait(TIMEOUT_TIMEOUT);
- QVERIFY(helper.count > 0);
+ QTRY_VERIFY_WITH_TIMEOUT(helper.count > 0, TIMEOUT_TIMEOUT);
int oldCount = helper.count;
- QTest::qWait(TIMEOUT_TIMEOUT);
- QVERIFY(helper.count > oldCount);
+ QTRY_VERIFY_WITH_TIMEOUT(helper.count > oldCount, TIMEOUT_TIMEOUT);
}
void tst_QTimer::remainingTime()
diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
index 0c5f1a7afb..943b4316ff 100644
--- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp
+++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
@@ -51,7 +51,7 @@ private slots:
void contains(); // copied from tst_QMap
void qhash();
void take(); // copied from tst_QMap
- void operator_eq(); // copied from tst_QMap
+ void operator_eq(); // slightly modified from tst_QMap
void rehash_isnt_quadratic();
void dont_need_default_constructor();
void qmultihash_specific();
@@ -771,7 +771,7 @@ void tst_QHash::take()
QVERIFY(!map.contains(3));
}
-//copied from tst_QMap
+// slightly modified from tst_QMap
void tst_QHash::operator_eq()
{
{
@@ -848,6 +848,71 @@ void tst_QHash::operator_eq()
QVERIFY(a != b);
QVERIFY(!(a == b));
}
+
+ // unlike multi-maps, multi-hashes should be equal iff their contents are equal,
+ // regardless of insertion or iteration order
+
+ {
+ QHash<int, int> a;
+ QHash<int, int> b;
+
+ a.insertMulti(0, 0);
+ a.insertMulti(0, 1);
+
+ b.insertMulti(0, 1);
+ b.insertMulti(0, 0);
+
+ QVERIFY(a == b);
+ QVERIFY(!(a != b));
+ }
+
+ {
+ QHash<int, int> a;
+ QHash<int, int> b;
+
+ enum { Count = 100 };
+
+ for (int key = 0; key < Count; ++key) {
+ for (int value = 0; value < Count; ++value)
+ a.insertMulti(key, value);
+ }
+
+ for (int key = Count - 1; key >= 0; --key) {
+ for (int value = 0; value < Count; ++value)
+ b.insertMulti(key, value);
+ }
+
+ QVERIFY(a == b);
+ QVERIFY(!(a != b));
+ }
+
+ {
+ QHash<int, int> a;
+ QHash<int, int> b;
+
+ enum {
+ Count = 100,
+ KeyStep = 17, // coprime with Count
+ ValueStep = 23, // coprime with Count
+ };
+
+ for (int key = 0; key < Count; ++key) {
+ for (int value = 0; value < Count; ++value)
+ a.insertMulti(key, value);
+ }
+
+ // Generates two permutations of [0, Count) for the keys and values,
+ // so that b will be identical to a, just built in a very different order.
+
+ for (int k = 0; k < Count; ++k) {
+ const int key = (k * KeyStep) % Count;
+ for (int v = 0; v < Count; ++v)
+ b.insertMulti(key, (v * ValueStep) % Count);
+ }
+
+ QVERIFY(a == b);
+ QVERIFY(!(a != b));
+ }
}
void tst_QHash::compare()
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index 7850478602..442d4d089c 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -43,6 +43,10 @@
#include <stdlib.h>
#include <time.h>
+#ifdef Q_OS_UNIX
+#include <sys/resource.h>
+#endif
+
QT_BEGIN_NAMESPACE
namespace QtSharedPointer {
Q_CORE_EXPORT void internalSafetyCheckCleanCheck();
@@ -54,6 +58,7 @@ class tst_QSharedPointer: public QObject
Q_OBJECT
private slots:
+ void initTestCase();
void basics_data();
void basics();
void operators();
@@ -118,6 +123,20 @@ public:
}
};
+void tst_QSharedPointer::initTestCase()
+{
+#if defined(Q_OS_UNIX)
+ // The tests create a lot of threads, which require file descriptors. On systems like
+ // OS X low defaults such as 256 as the limit for the number of simultaneously
+ // open files is not sufficient.
+ struct rlimit numFiles;
+ if (getrlimit(RLIMIT_NOFILE, &numFiles) == 0 && numFiles.rlim_cur < 1024) {
+ numFiles.rlim_cur = qMin(rlim_t(1024), numFiles.rlim_max);
+ setrlimit(RLIMIT_NOFILE, &numFiles);
+ }
+#endif
+}
+
template<typename T> static inline
QtSharedPointer::ExternalRefCountData *refCountData(const QSharedPointer<T> &b)
{
diff --git a/tests/auto/dbus/qdbusabstractadaptor/myobject.h b/tests/auto/dbus/qdbusabstractadaptor/myobject.h
index 1d9b33ccd8..fe3f6f3dd2 100644
--- a/tests/auto/dbus/qdbusabstractadaptor/myobject.h
+++ b/tests/auto/dbus/qdbusabstractadaptor/myobject.h
@@ -242,10 +242,13 @@ public:
{
case 4:
if4 = new Interface4(this);
+ Q_FALLTHROUGH();
case 3:
if3 = new Interface3(this);
+ Q_FALLTHROUGH();
case 2:
if2 = new Interface2(this);
+ Q_FALLTHROUGH();
case 1:
if1 = new Interface1(this);
}
@@ -270,4 +273,4 @@ signals:
void nonScriptableSignalVoid();
};
-#endif // MYOBJECT_H \ No newline at end of file
+#endif // MYOBJECT_H
diff --git a/tests/auto/dbus/qdbusmarshall/common.h b/tests/auto/dbus/qdbusmarshall/common.h
index f37ba47508..44346cd6f2 100644
--- a/tests/auto/dbus/qdbusmarshall/common.h
+++ b/tests/auto/dbus/qdbusmarshall/common.h
@@ -437,7 +437,7 @@ bool compareToArgument(const QDBusArgument &arg, const QVariant &v2)
case QVariant::DateTime:
return compare<QDateTime>(arg, v2);
default:
- register int id = v2.userType();
+ int id = v2.userType();
if (id == qMetaTypeId<QDBusObjectPath>())
return compare<QDBusObjectPath>(arg, v2);
else if (id == qMetaTypeId<QDBusSignature>())
diff --git a/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp
index d024538ee0..509f8bd45f 100644
--- a/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp
+++ b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp
@@ -287,6 +287,11 @@ void tst_qinputmethod::inputMethodAccepted()
if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
+ if (!QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)
+ || !QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)) {
+ QSKIP("minimal/offscreen: This fails. Figure out why.");
+ }
+
if (!QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive))
QSKIP("XCB: depends on dedicated platform context.");
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 0196c7d72c..4cccf08086 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -1829,6 +1829,12 @@ void tst_QWindow::initialSize()
}
}
+static bool isPlatformOffscreenOrMinimal()
+{
+ return ((QGuiApplication::platformName() == QLatin1String("offscreen"))
+ || (QGuiApplication::platformName() == QLatin1String("minimal")));
+}
+
void tst_QWindow::modalDialog()
{
if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
@@ -1853,8 +1859,7 @@ void tst_QWindow::modalDialog()
QGuiApplication::sync();
QGuiApplication::processEvents();
- if (!QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)
- || !QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)) {
+ if (isPlatformOffscreenOrMinimal()) {
QWARN("Focus stays in normalWindow on offscreen/minimal platforms");
QTRY_COMPARE(QGuiApplication::focusWindow(), &normalWindow);
return;
@@ -1899,8 +1904,7 @@ void tst_QWindow::modalDialogClosingOneOfTwoModal()
QGuiApplication::sync();
QGuiApplication::processEvents();
- if (!QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)
- || !QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)) {
+ if (isPlatformOffscreenOrMinimal()) {
QWARN("Focus is lost when closing modal dialog on offscreen/minimal platforms");
QTRY_COMPARE(QGuiApplication::focusWindow(), nullptr);
return;
@@ -1994,6 +1998,9 @@ void tst_QWindow::modalWindowEnterEventOnHide_QTBUG35109()
if (QGuiApplication::platformName() == QLatin1String("cocoa"))
QSKIP("This test fails on OS X on CI");
+ if (isPlatformOffscreenOrMinimal())
+ QSKIP("Can't test window focusing on offscreen/minimal");
+
const QPoint center = QGuiApplication::primaryScreen()->availableGeometry().center();
const int childOffset = 16;
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 3562bc63f4..8db4489ec1 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -3004,6 +3004,10 @@ void fpe_steepSlopes()
void fpe_radialGradients()
{
+#if defined(Q_PROCESSOR_ARM)
+ QEXPECT_FAIL("", "Test fails for ARM (QTBUG-59961)", Continue);
+#endif
+
FpExceptionChecker checker(FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID | FE_DIVBYZERO);
QImage img(21, 21, QImage::Format_ARGB32_Premultiplied);
diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
index 98f63984b3..757e4d16e4 100644
--- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
+++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
@@ -99,6 +99,9 @@ private slots:
void translate();
void lineWithinBounds();
+
+ void intersectionEquality();
+ void intersectionPointOnEdge();
};
void tst_QPainterPath::cleanupTestCase()
@@ -1313,6 +1316,64 @@ void tst_QPainterPath::lineWithinBounds()
}
}
+void tst_QPainterPath::intersectionEquality()
+{
+ // Test case from QTBUG-17027
+ QPainterPath p1;
+ p1.moveTo(256.0000000000000000, 135.8384137532701743);
+ p1.lineTo(50.9999999999999715, 107.9999999999999857);
+ p1.lineTo(233.5425474228109123, 205.3560252921671462);
+ p1.lineTo(191.7771366877784373, 318.0257074407572304);
+ p1.lineTo(-48.2616272048215151, 229.0459803737862216);
+ p1.lineTo(0.0000000000000000, 98.8515898136580801);
+ p1.lineTo(0.0000000000000000, 0.0000000000000000);
+ p1.lineTo(256.0000000000000000, 0.0000000000000000);
+ p1.lineTo(256.0000000000000000, 135.8384137532701743);
+
+ QPainterPath p2;
+ p2.moveTo(1516.2703263523442274, 306.9795200262722119);
+ p2.lineTo(-1296.8426224886295585, -75.0331736542986931);
+ p2.lineTo(-1678.8553161692004778, 2738.0797751866753060);
+ p2.lineTo(1134.2576326717733081, 3120.0924688672457705);
+ p2.lineTo(1516.2703263523442274, 306.9795200262722119);
+
+ QPainterPath i1 = p1.intersected(p2);
+ QPainterPath i2 = p2.intersected(p1);
+ QVERIFY(i1 == i2 || i1.toReversed() == i2);
+
+ p1 = QPainterPath();
+ p1.moveTo(256.00000000, 135.83841375);
+ p1.lineTo(50.99999999, 107.99999999);
+ p1.lineTo(233.54254742, 205.35602529);
+ p1.lineTo(191.77713668, 318.02570744);
+ p1.lineTo(-48.26162720, 229.04598037);
+ p1.lineTo(0.00000000, 98.85158981);
+ p1.lineTo(0.00000000, 0.00000000);
+ p1.lineTo(256.00000000, 0.00000000);
+ p1.lineTo(256.00000000, 135.83841375);
+
+ p2 = QPainterPath();
+ p2.moveTo(1516.27032635, 306.97952002);
+ p2.lineTo(-1296.84262248, -75.03317365);
+ p2.lineTo(-1678.85531616, 2738.07977518);
+ p2.lineTo(1134.25763267, 3120.09246886);
+ p2.lineTo(1516.27032635, 306.97952002);
+
+ i1 = p1.intersected(p2);
+ i2 = p2.intersected(p1);
+ QVERIFY(i1 == i2 || i1.toReversed() == i2);
+}
+
+void tst_QPainterPath::intersectionPointOnEdge()
+{
+ // From QTBUG-31551
+ QPainterPath p; p.addRoundedRect(-10, 10, 40, 40, 10, 10);
+ QRectF r(0, 0, 100, 100);
+ QPainterPath rp; rp.addRect(r);
+ QVERIFY(!p.intersected(rp).isEmpty());
+ QVERIFY(p.intersects(rp));
+ QVERIFY(p.intersects(r));
+}
QTEST_APPLESS_MAIN(tst_QPainterPath)
diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
index 9a604e5d04..b476fdd334 100644
--- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
@@ -1553,9 +1553,17 @@ void tst_QUdpSocket::linkLocalIPv6()
//Windows preallocates link local addresses to interfaces that are down.
//These may or may not work depending on network driver
if (iface.flags() & QNetworkInterface::IsUp) {
+#if defined(Q_OS_WIN)
// Do not add the Teredo Tunneling Pseudo Interface on Windows.
if (iface.humanReadableName().contains("Teredo"))
continue;
+#elif defined(Q_OS_DARWIN)
+ // Do not add "utun" interfaces on macOS: nothing ever gets received
+ // (we don't know why)
+ if (iface.name().startsWith("utun"))
+ continue;
+#endif
+
foreach (QNetworkAddressEntry addressEntry, iface.addressEntries()) {
QHostAddress addr(addressEntry.ip());
if (!addr.scopeId().isEmpty() && addr.isInSubnet(localMask, 64)) {
diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp
index efa724b730..13c933aa14 100644
--- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp
+++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp
@@ -94,9 +94,6 @@ void tst_QAccessibilityMac::cleanup()
void tst_QAccessibilityMac::singleWidgetTest()
{
- if (!macNativeAccessibilityEnabled())
- return;
-
delete m_window;
m_window = 0;
@@ -105,9 +102,6 @@ void tst_QAccessibilityMac::singleWidgetTest()
void tst_QAccessibilityMac::lineEditTest()
{
- if (!macNativeAccessibilityEnabled())
- return;
-
QLineEdit *lineEdit = new QLineEdit(m_window);
lineEdit->setText("a11y test QLineEdit");
m_window->addWidget(lineEdit);
@@ -119,9 +113,6 @@ void tst_QAccessibilityMac::lineEditTest()
void tst_QAccessibilityMac::hierarchyTest()
{
- if (!macNativeAccessibilityEnabled())
- return;
-
QWidget *w = new QWidget(m_window);
m_window->addWidget(w);
@@ -141,17 +132,11 @@ void tst_QAccessibilityMac::hierarchyTest()
void tst_QAccessibilityMac::notificationsTest()
{
- if (!macNativeAccessibilityEnabled())
- return;
-
QVERIFY(notifications(m_window));
}
void tst_QAccessibilityMac::checkBoxTest()
{
- if (!macNativeAccessibilityEnabled())
- return;
-
QCheckBox *cb = new QCheckBox(m_window);
cb->setText("Great option");
m_window->addWidget(cb);
diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h
index 5f10513bb5..75b2d39a00 100644
--- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h
+++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h
@@ -33,8 +33,6 @@
QT_USE_NAMESPACE
-bool macNativeAccessibilityEnabled();
-bool trusted();
bool testLineEdit();
bool testHierarchy(QWidget *w);
bool singleWidget();
diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm
index fb030aa4be..e9407fd903 100644
--- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm
+++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm
@@ -42,19 +42,6 @@
QT_USE_NAMESPACE
-bool macNativeAccessibilityEnabled()
-{
- bool enabled = AXAPIEnabled();
- if (!enabled)
- qWarning() << "Accessibility is disabled (check System Preferences) skipping test.";
- return enabled;
-}
-
-bool trusted()
-{
- return AXIsProcessTrusted();
-}
-
struct AXErrorTag {
AXError err;
explicit AXErrorTag(AXError theErr) : err(theErr) {}
@@ -413,12 +400,6 @@ bool singleWidget()
bool testLineEdit()
{
-// not sure if this is needed. on my machine the calls succeed.
-// NSString *path = @"/Users/frederik/qt5/qtbase/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.app/Contents/MacOS/tst_qaccessibilitymac";
-// NSString *path = @"/Users/frederik/qt5/qtbase/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.app";
-// AXError e = AXMakeProcessTrusted((CFStringRef) path);
-// NSLog(@"error: %i", e);
-
TestAXObject *appObject = [TestAXObject getApplicationAXObject];
EXPECT(appObject);
diff --git a/tests/auto/printsupport/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp b/tests/auto/printsupport/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp
index 79c910cb5b..bb3624a51d 100644
--- a/tests/auto/printsupport/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp
+++ b/tests/auto/printsupport/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp
@@ -31,14 +31,17 @@
#include <qcoreapplication.h>
#include <qdebug.h>
+#include <QtPrintSupport/qtprintsupportglobal.h>
+#if QT_CONFIG(printdialog)
#include <qabstractprintdialog.h>
#include <qprinter.h>
+#endif
class tst_QAbstractPrintDialog : public QObject
{
Q_OBJECT
-#if defined(QT_NO_PRINTER) || defined(QT_NO_PRINTDIALOG)
+#if !QT_CONFIG(printdialog)
public slots:
void initTestCase();
#else
@@ -49,7 +52,7 @@ private slots:
#endif
};
-#if defined(QT_NO_PRINTER) || defined(QT_NO_PRINTDIALOG)
+#if !QT_CONFIG(printdialog)
void tst_QAbstractPrintDialog::initTestCase()
{
QSKIP("This test requires printing and print dialog support");
diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
index 44cb5a5bf8..05410f4a0f 100644
--- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
@@ -144,6 +144,7 @@ private slots:
#endif
void rejectModalDialogs();
void QTBUG49600_nativeIconProviderCrash();
+ void focusObjectDuringDestruction();
// NOTE: Please keep widgetlessNativeDialog() as the LAST test!
//
@@ -1463,18 +1464,15 @@ class DialogRejecter : public QObject
public:
DialogRejecter()
{
- QTimer *timer = new QTimer(this);
- timer->setInterval(1000);
- connect(timer, &QTimer::timeout, this, &DialogRejecter::rejectFileDialog);
- timer->start();
+ connect(qApp, &QApplication::focusChanged, this, &DialogRejecter::rejectFileDialog);
}
public slots:
- void rejectFileDialog()
+ virtual void rejectFileDialog()
{
if (QWidget *w = QApplication::activeModalWidget())
if (QDialog *d = qobject_cast<QDialog *>(w))
- d->reject();
+ QTest::keyClick(d, Qt::Key_Escape);
}
};
@@ -1514,5 +1512,36 @@ void tst_QFiledialog::QTBUG49600_nativeIconProviderCrash()
fd.iconProvider();
}
+class qtbug57193DialogRejecter : public DialogRejecter
+{
+public:
+ void rejectFileDialog() override
+ {
+ QCOMPARE(QGuiApplication::topLevelWindows().size(), 1);
+ const QWindow *window = QGuiApplication::topLevelWindows().constFirst();
+
+ const QFileDialog *fileDialog = qobject_cast<QFileDialog*>(QApplication::activeModalWidget());
+ QVERIFY(fileDialog);
+
+ // The problem in QTBUG-57193 was from a platform input context plugin that was
+ // connected to QWindow::focusObjectChanged(), and consequently accessed the focus
+ // object (the QFileDialog) that was in the process of being destroyed. This test
+ // checks that the QFileDialog is never set as the focus object after its destruction process begins.
+ connect(window, &QWindow::focusObjectChanged, [=](QObject *focusObject) {
+ QVERIFY(focusObject != fileDialog);
+ });
+ DialogRejecter::rejectFileDialog();
+ }
+};
+
+void tst_QFiledialog::focusObjectDuringDestruction()
+{
+ QTRY_VERIFY(QGuiApplication::topLevelWindows().isEmpty());
+
+ qtbug57193DialogRejecter dialogRejecter;
+
+ QFileDialog::getOpenFileName(nullptr, QString(), QString(), QString(), nullptr);
+}
+
QTEST_MAIN(tst_QFiledialog)
#include "tst_qfiledialog.moc"
diff --git a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp
index a1cb729849..4d289dcb02 100644
--- a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp
+++ b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp
@@ -52,6 +52,7 @@ private slots:
void boundingRect2();
void draw();
void opacity();
+ void nestedOpaqueOpacity();
void grayscale();
void colorize();
void drawPixmapItem();
@@ -407,6 +408,26 @@ void tst_QGraphicsEffect::opacity()
QCOMPARE(effect->m_opacity, qreal(0.5));
}
+void tst_QGraphicsEffect::nestedOpaqueOpacity()
+{
+ // QTBUG-60231: Nesting widgets with a QGraphicsEffect on a toplevel with
+ // QGraphicsOpacityEffect caused crashes due to constructing several
+ // QPainter instances on a device in the fast path for
+ // QGraphicsOpacityEffect::opacity=1
+ QWidget topLevel;
+ topLevel.setWindowTitle(QTest::currentTestFunction());
+ topLevel.resize(QApplication::desktop()->screenGeometry(&topLevel).size() / 8);
+ QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect;
+ opacityEffect->setOpacity(1);
+ topLevel.setGraphicsEffect(opacityEffect);
+ QWidget *child = new QWidget(&topLevel);
+ child->resize(topLevel.size() / 2);
+ QGraphicsDropShadowEffect *childEffect = new QGraphicsDropShadowEffect;
+ child->setGraphicsEffect(childEffect);
+ topLevel.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
+}
+
void tst_QGraphicsEffect::grayscale()
{
if (qApp->desktop()->depth() < 24)
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST
new file mode 100644
index 0000000000..c6f69a51a5
--- /dev/null
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST
@@ -0,0 +1,3 @@
+[removeItem]
+# QTBUG-60754, QTest::mouseMove is not always respected, or the CI moves the cursor
+osx-10.11 ci
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 76b25cdb52..1a96180c05 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -4804,8 +4804,12 @@ public:
void tst_QGraphicsView::hoverLeave()
{
- if (platformName == QStringLiteral("cocoa"))
+ if (platformName == QStringLiteral("cocoa")) {
QSKIP("Insignificant on OSX");
+ } else if (platformName == QStringLiteral("minimal")
+ || (platformName == QStringLiteral("offscreen"))) {
+ QSKIP("Fails in minimal/offscreen platforms if forwardMouseDoubleClick has been run");
+ }
const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry();
QGraphicsScene scene;
QGraphicsView view(&scene);
diff --git a/tests/auto/widgets/kernel/qapplication/BLACKLIST b/tests/auto/widgets/kernel/qapplication/BLACKLIST
index 6abb1d9988..f4a9cb6166 100644
--- a/tests/auto/widgets/kernel/qapplication/BLACKLIST
+++ b/tests/auto/widgets/kernel/qapplication/BLACKLIST
@@ -1,4 +1,2 @@
[quitOnLastWindowClosed]
osx-10.10
-[touchEventPropagation]
-xcb
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index 49095b9625..b98cc048c8 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -1987,7 +1987,7 @@ void tst_QApplication::touchEventPropagation()
window.show();
QVERIFY(QTest::qWaitForWindowExposed(&window));
const QPoint deviceGlobalPos =
- QHighDpi::toNativePixels(window.mapToGlobal(QPoint(50, 50)), window.windowHandle()->screen());
+ QHighDpi::toNativePixels(window.mapToGlobal(QPoint(50, 150)), window.windowHandle()->screen());
pressedTouchPoints[0].setScreenPos(deviceGlobalPos);
releasedTouchPoints[0].setScreenPos(deviceGlobalPos);
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index e68f0f57ef..0933dc991d 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -8526,8 +8526,8 @@ void tst_QWidget::translucentWidget()
else
#endif
widgetSnapshot = label.grab(QRect(QPoint(0, 0), label.size()));
- QImage actual = widgetSnapshot.toImage().convertToFormat(QImage::Format_RGB32);
- QImage expected = pm.toImage().convertToFormat(QImage::Format_RGB32);
+ const QImage actual = widgetSnapshot.toImage().convertToFormat(QImage::Format_RGB32);
+ const QImage expected = pm.toImage().scaled(label.devicePixelRatioF() * pm.size());
QCOMPARE(actual.size(),expected.size());
QCOMPARE(actual,expected);
}
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index 4d57b85f9a..9a0ca0565e 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -824,6 +824,12 @@ void tst_QMenuBar::check_escKey()
if (!QApplication::style()->inherits("QWindowsStyle"))
return;
+ if (!QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)
+ || !QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)) {
+ QWARN("Skipping menu button test on minimal/offscreen platforms");
+ return;
+ }
+
// If we press Down the popupmenu should be active again
QTest::keyClick(static_cast<QWidget *>(0), Qt::Key_Down );
QVERIFY( !menu.menus.at(0)->isActiveWindow() );
@@ -1196,6 +1202,11 @@ void tst_QMenuBar::task223138_triggered()
void tst_QMenuBar::task256322_highlight()
{
+ if (!QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)
+ || !QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)) {
+ QSKIP("Highlighting does not work correctly for minimal/offscreen platforms");
+ }
+
QMainWindow win;
win.menuBar()->setNativeMenuBar(false); //we can't check the geometry of native menubars
QMenu menu;