diff --git a/examples/widgets/graphicsview/boxes/3rdparty/fbm.c b/examples/widgets/graphicsview/boxes/3rdparty/fbm.c index 98eb87a33b..3eebaabfba 100644 --- a/examples/widgets/graphicsview/boxes/3rdparty/fbm.c +++ b/examples/widgets/graphicsview/boxes/3rdparty/fbm.c @@ -106,7 +106,7 @@ float noise3(float vec[3]) { int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11; float rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v; - register int i, j; + int i, j; if (start) { start = 0; diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 966c43108c..5cbc0d4bfd 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -1919,8 +1919,10 @@ qtConfCheckErrors() for (k, $${currentConfig}.features._KEYS_) { pp = $$eval($${currentConfig}.features.$${k}.purpose) !isEmpty(pp) { + pfx = $$eval($${currentConfig}.features.$${k}.section) + !isEmpty(pfx): pfx = "$$pfx: " all_ft += $$qtConfPadCols($$k, ".......................", \ - $$section(pp, $$escape_expand(\\n), 0, 0)) + $$pfx$$section(pp, $$escape_expand(\\n), 0, 0)) } } } diff --git a/mkspecs/features/winrt/default_pre.prf b/mkspecs/features/winrt/default_pre.prf index 8b9c1d7663..966d24f091 100644 --- a/mkspecs/features/winrt/default_pre.prf +++ b/mkspecs/features/winrt/default_pre.prf @@ -9,6 +9,6 @@ CONFIG(debug, debug|release): \ else: \ QMAKE_LIBS = ucrt.lib vcruntime.lib $$QMAKE_LIBS -equals(TEMPLATE, "vcapp"): CONFIG += windeployqt +equals(TEMPLATE, "vcapp"):!static: CONFIG += windeployqt load(default_pre) diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index 5fd9edc552..b1d920c6ee 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -204,6 +204,8 @@ void QDirIteratorPrivate::pushDirectory(const QFileInfo &fileInfo) QFileSystemIterator *it = new QFileSystemIterator(fileInfo.d_ptr->fileEntry, filters, nameFilters, iteratorFlags); nativeIterators << it; +#else + qWarning("Qt was built with -no-feature-filesystemiterator: no files/plugins will be found!"); #endif } } diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp index 6c7101d41f..7714aa5e46 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.cpp +++ b/src/corelib/itemmodels/qitemselectionmodel.cpp @@ -942,13 +942,14 @@ static QItemSelection mergeRowLengths(const QVectortimerVec.isEmpty()) return false; - register WinTimerInfo *t; + WinTimerInfo *t; for (int i=0; itimerVec.size(); i++) { t = d->timerVec.at(i); if (t && t->obj == object) { // object found @@ -957,7 +957,7 @@ int QEventDispatcherWin32::remainingTime(int timerId) quint64 currentTime = qt_msectime(); - register WinTimerInfo *t; + WinTimerInfo *t; for (int i=0; itimerVec.size(); i++) { t = d->timerVec.at(i); if (t && t->timerId == timerId) { // timer found diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp index 555f1ba0ef..44ab637da8 100644 --- a/src/network/access/qhttp2protocolhandler.cpp +++ b/src/network/access/qhttp2protocolhandler.cpp @@ -528,7 +528,7 @@ void QHttp2ProtocolHandler::handleDATA() auto &stream = activeStreams[streamID]; if (qint32(inboundFrame.payloadSize()) > stream.recvWindow) { - finishStreamWithError(stream, QNetworkReply::ProtocolInvalidOperationError, + finishStreamWithError(stream, QNetworkReply::ProtocolFailure, QLatin1String("flow control error")); sendRST_STREAM(streamID, FLOW_CONTROL_ERROR); markAsReset(streamID); @@ -834,7 +834,7 @@ void QHttp2ProtocolHandler::handleWINDOW_UPDATE() } auto &stream = activeStreams[streamID]; if (!valid || sum_will_overflow(stream.sendWindow, delta)) { - finishStreamWithError(stream, QNetworkReply::ProtocolInvalidOperationError, + finishStreamWithError(stream, QNetworkReply::ProtocolFailure, QLatin1String("invalid WINDOW_UPDATE delta")); sendRST_STREAM(streamID, PROTOCOL_ERROR); markAsReset(streamID); @@ -888,7 +888,7 @@ void QHttp2ProtocolHandler::handleContinuedHEADERS() // We can receive HEADERS on streams initiated by our requests // (these streams are in halfClosedLocal state) or remote-reserved // streams from a server's PUSH_PROMISE. - finishStreamWithError(stream, QNetworkReply::ProtocolInvalidOperationError, + finishStreamWithError(stream, QNetworkReply::ProtocolFailure, QLatin1String("HEADERS on invalid stream")); sendRST_STREAM(streamID, CANCEL); markAsReset(streamID); @@ -977,7 +977,7 @@ bool QHttp2ProtocolHandler::acceptSetting(Http2::Settings identifier, quint32 ne for (auto id : brokenStreams) { auto &stream = activeStreams[id]; - finishStreamWithError(stream, QNetworkReply::ProtocolInvalidOperationError, + finishStreamWithError(stream, QNetworkReply::ProtocolFailure, QLatin1String("SETTINGS window overflow")); sendRST_STREAM(id, PROTOCOL_ERROR); markAsReset(id); diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 08e4930584..bb30330dfd 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -237,7 +237,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (void)viewDidMoveToSuperview { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; if (!(m_platformWindow->m_viewIsToBeEmbedded)) @@ -260,7 +260,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (QWindow *)topLevelWindow { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return nullptr; QWindow *focusWindow = m_platformWindow->window(); @@ -278,7 +278,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (void)updateGeometry { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; QRect geometry; @@ -437,8 +437,11 @@ static bool _q_dontOverrideCtrlLMB = false; } } -- (void) drawRect:(NSRect)dirtyRect +- (void)drawRect:(NSRect)dirtyRect { + if (!m_platformWindow) + return; + qCDebug(lcQpaCocoaWindow) << "[QNSView drawRect:]" << m_platformWindow->window() << QRectF::fromCGRect(NSRectToCGRect(dirtyRect)); #ifndef QT_NO_OPENGL @@ -627,7 +630,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (void)handleMouseEvent:(NSEvent *)theEvent { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; // Tablet events may come in via the mouse event handlers, @@ -644,7 +647,7 @@ static bool _q_dontOverrideCtrlLMB = false; else m_platformWindow->m_forwardWindow.clear(); } - if (targetView->m_platformWindow.isNull()) + if (!targetView.platformWindow) return; // Popups implicitly grap mouse events; forward to the active popup if there is one @@ -670,7 +673,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (void)handleFrameStrutMouseEvent:(NSEvent *)theEvent { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; // get m_buttons in sync @@ -955,7 +958,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (void)mouseMovedImpl:(NSEvent *)theEvent { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; if ([self isTransparentForUserInput]) @@ -989,7 +992,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (void)mouseEnteredImpl:(NSEvent *)theEvent { Q_UNUSED(theEvent) - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; m_platformWindow->m_windowUnderMouse = true; @@ -1011,7 +1014,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (void)mouseExitedImpl:(NSEvent *)theEvent { Q_UNUSED(theEvent); - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; m_platformWindow->m_windowUnderMouse = false; @@ -1040,7 +1043,7 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash) - (bool)handleTabletEvent: (NSEvent *)theEvent { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return false; NSEventType eventType = [theEvent type]; @@ -1200,7 +1203,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (bool)shouldSendSingleTouch { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return true; // QtWidgets expects single-point touch events, QtDeclarative does not. @@ -1210,7 +1213,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)touchesBeganWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; const NSTimeInterval timestamp = [event timestamp]; @@ -1221,7 +1224,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)touchesMovedWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; const NSTimeInterval timestamp = [event timestamp]; @@ -1232,7 +1235,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)touchesEndedWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; const NSTimeInterval timestamp = [event timestamp]; @@ -1243,7 +1246,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)touchesCancelledWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; const NSTimeInterval timestamp = [event timestamp]; @@ -1273,7 +1276,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) } - (void)magnifyWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; if ([self handleGestureAsBeginEnd:event]) @@ -1290,7 +1293,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)smartMagnifyWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; static bool zoomIn = true; @@ -1306,7 +1309,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)rotateWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; if ([self handleGestureAsBeginEnd:event]) @@ -1322,7 +1325,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)swipeWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; qCDebug(lcQpaGestures) << "swipeWithEvent" << [event deltaX] << [event deltaY]; @@ -1347,7 +1350,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)beginGestureWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; const NSTimeInterval timestamp = [event timestamp]; @@ -1361,7 +1364,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)endGestureWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; qCDebug(lcQpaGestures) << "endGestureWithEvent"; @@ -1377,7 +1380,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) #ifndef QT_NO_WHEELEVENT - (void)scrollWheel:(NSEvent *)theEvent { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; if ([self isTransparentForUserInput]) @@ -1879,6 +1882,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (NSArray*)validAttributesForMarkedText { + if (!m_platformWindow) + return nil; + if (m_platformWindow->window() != QGuiApplication::focusWindow()) return nil; @@ -2050,7 +2056,7 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin // Sends drag update to Qt, return the action - (NSDragOperation)handleDrag:(id )sender { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return NSDragOperationNone; NSPoint windowPoint = [self convertPoint: [sender draggingLocation] fromView: nil]; @@ -2080,7 +2086,7 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin - (void)draggingExited:(id )sender { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; QWindow *target = findEventTargetWindow(m_platformWindow->window()); @@ -2097,7 +2103,7 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin // called on drop, send the drop to Qt and return if it was accepted. - (BOOL)performDragOperation:(id )sender { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return false; QWindow *target = findEventTargetWindow(m_platformWindow->window()); @@ -2131,7 +2137,7 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin Q_UNUSED(session); Q_UNUSED(operation); - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; QWindow *target = findEventTargetWindow(m_platformWindow->window()); diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 79ae4c004b..818bff2693 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1695,6 +1695,16 @@ static inline bool dwmIsCompositionEnabled() return SUCCEEDED(DwmIsCompositionEnabled(&dWmCompositionEnabled)) && dWmCompositionEnabled == TRUE; } +static inline bool isSoftwareGl() +{ +#if QT_CONFIG(dynamicgl) + return QOpenGLStaticContext::opengl32.moduleIsNotOpengl32() + && QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL; +#else + return false; +#endif // dynamicgl +} + bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message, WPARAM, LPARAM) { @@ -1706,15 +1716,10 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message, return false; PAINTSTRUCT ps; -#if QT_CONFIG(dynamicgl) - // QTBUG-58178: GL software rendering needs InvalidateRect() to suppress - // artifacts while resizing. - if (testFlag(OpenGLSurface) - && QOpenGLStaticContext::opengl32.moduleIsNotOpengl32() - && QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) { + // GL software rendering (QTBUG-58178) and Windows 7/Aero off with some AMD cards + // (QTBUG-60527) need InvalidateRect() to suppress artifacts while resizing. + if (testFlag(OpenGLSurface) && (isSoftwareGl() || !dwmIsCompositionEnabled())) InvalidateRect(hwnd, 0, false); - } -#endif // dynamicgl BeginPaint(hwnd, &ps); 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; + using IntPairList = QList; + using IntPairPair = std::pair; + using IntPairPairList = QList; + + QTest::addColumn("rangesToSelect"); + QTest::addColumn("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; + using IntPairList = QList; + using IntPairPair = std::pair; + using IntPairPairList = QList; + + 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 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/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 89d6be6c7a..3a52c684d0 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -6968,309 +6968,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::type>::value) + +#define NARROWS_IF(x, y, test) Q_STATIC_ASSERT((QtPrivate::AreArgumentsNarrowedBase::value) == (test)) +#define FITS_IF(x, y, test) Q_STATIC_ASSERT((QtPrivate::AreArgumentsNarrowedBase::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::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(float, bool); + NARROWS(double, bool); + NARROWS(long double, bool); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(float, char); + NARROWS(double, char); + NARROWS(long double, char); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(float, short); + NARROWS(double, short); + NARROWS(long double, short); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(float, int); + NARROWS(double, int); + NARROWS(long double, int); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(float, long); + NARROWS(double, long); + NARROWS(long double, long); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::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::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - } - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::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::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS_IF(long double, double, (sizeof(long double) > sizeof(double))); + FITS(double, long double); // integral to floating point - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(bool, float); + NARROWS(bool, double); + NARROWS(bool, long double); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(char, float); + NARROWS(char, double); + NARROWS(char, long double); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(short, float); + NARROWS(short, double); + NARROWS(short, long double); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(int, float); + NARROWS(int, double); + NARROWS(int, long double); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(long, float); + NARROWS(long, double); + NARROWS(long, long double); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(long long, float); + NARROWS(long long, double); + NARROWS(long long, long double); // enum to floating point - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(UnscopedEnum, float); + NARROWS(UnscopedEnum, double); + NARROWS(UnscopedEnum, long double); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(SignedUnscopedEnum, float); + NARROWS(SignedUnscopedEnum, double); + NARROWS(SignedUnscopedEnum, long double); // integral to smaller integral - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::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); - if (sizeof(bool) > sizeof(char)) - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - else - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS_IF(bool, unsigned char, (sizeof(bool) > sizeof(char) || std::is_signed::value)); + NARROWS_IF(bool, unsigned short, (sizeof(bool) > sizeof(short) || std::is_signed::value)); + NARROWS_IF(bool, unsigned int, (sizeof(bool) > sizeof(int) || std::is_signed::value)); + NARROWS_IF(bool, unsigned long, (sizeof(bool) > sizeof(long) || std::is_signed::value)); + NARROWS_IF(bool, unsigned long long, (sizeof(bool) > sizeof(long long) || std::is_signed::value)); - if (sizeof(bool) > sizeof(short)) - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - else - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS_IF(short, char, (sizeof(short) > sizeof(char) || std::is_unsigned::value)); + NARROWS_IF(short, unsigned char, (sizeof(short) > sizeof(char))); + NARROWS_IF(short, signed char, (sizeof(short) > sizeof(char))); - if (sizeof(bool) > sizeof(int)) - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - else - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS_IF(unsigned short, char, (sizeof(short) > sizeof(char) || std::is_signed::value)); + NARROWS_IF(unsigned short, unsigned char, (sizeof(short) > sizeof(char))); + NARROWS_IF(unsigned short, signed char, (sizeof(short) > sizeof(char))); - if (sizeof(bool) > sizeof(long)) - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - else - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); + FITS(short, short); + FITS(short, int); + FITS(short, long); + FITS(short, long long); - if (sizeof(bool) > sizeof(long long)) - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - else - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); + FITS(unsigned short, unsigned short); + FITS(unsigned short, unsigned int); + FITS(unsigned short, unsigned long); + FITS(unsigned short, unsigned long long); - if (sizeof(short) > sizeof(char)) { - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS_IF(int, char, (sizeof(int) > sizeof(char) || std::is_unsigned::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); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - } + NARROWS_IF(unsigned int, char, (sizeof(int) > sizeof(char) || std::is_signed::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))); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + FITS(int, int); + FITS(int, long); + FITS(int, long long); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + FITS(unsigned int, unsigned int); + FITS(unsigned int, unsigned long); + FITS(unsigned int, unsigned long long); - if (sizeof(int) > sizeof(short)) { - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS_IF(long, char, (sizeof(long) > sizeof(char) || std::is_unsigned::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); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - } + NARROWS_IF(unsigned long, char, (sizeof(long) > sizeof(char) || std::is_signed::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))); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + FITS(long, long); + FITS(long, long long); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + FITS(unsigned long, unsigned long); + FITS(unsigned long, unsigned long long); - if (sizeof(long) > sizeof(int)) { - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS_IF(long long, char, (sizeof(long long) > sizeof(char) || std::is_unsigned::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); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - } + NARROWS_IF(unsigned long long, char, (sizeof(long long) > sizeof(char) || std::is_signed::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))); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - - if (sizeof(long long) > sizeof(long)) { - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - } - - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + 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::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::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::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::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::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(short, unsigned short); + NARROWS(short, unsigned int); + NARROWS(short, unsigned long); + NARROWS(short, unsigned long long); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(unsigned short, short); + FITS(unsigned short, int); + FITS(unsigned short, long); + FITS(unsigned short, long long); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(int, unsigned int); + NARROWS(int, unsigned long); + NARROWS(int, unsigned long long); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QCOMPARE((QtPrivate::AreArgumentsNarrowedBase::value), sizeof(int) >= sizeof(long)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(unsigned int, int); + NARROWS_IF(unsigned int, long, (sizeof(int) >= sizeof(long))); + FITS(unsigned int, long long); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(long, unsigned long); + NARROWS(long, unsigned long long); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QCOMPARE((QtPrivate::AreArgumentsNarrowedBase::value), sizeof(long) >= sizeof(long long)); + NARROWS(unsigned long, long); + NARROWS_IF(unsigned long, long long, (sizeof(long) >= sizeof(long long))); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(long long, unsigned long long); + NARROWS(unsigned long long, long long); // enum to smaller integral - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + // (note that we know that sizeof(UnscopedEnum) <= sizeof(int) + FITS(UnscopedEnum, UnscopedEnum); + FITS(SignedUnscopedEnum, SignedUnscopedEnum); - if (std::is_signed::type>::value) { - if (sizeof(UnscopedEnum) > sizeof(char)) - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - else - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS_IF(UnscopedEnum, char, ((sizeof(UnscopedEnum) > sizeof(char)) || (sizeof(UnscopedEnum) == sizeof(char) && IS_UNSCOPED_ENUM_SIGNED == std::is_signed::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::value)); - else - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::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::value)); - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); - } else { - if (sizeof(UnscopedEnum) > sizeof(bool)) - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - else - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS_IF(UnscopedEnum, int, (sizeof(UnscopedEnum) == sizeof(int) && !IS_UNSCOPED_ENUM_SIGNED)); + NARROWS_IF(UnscopedEnum, unsigned int, IS_UNSCOPED_ENUM_SIGNED); - if (sizeof(UnscopedEnum) > sizeof(char)) - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - else - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS_IF(UnscopedEnum, long, (sizeof(UnscopedEnum) == sizeof(long) && !IS_UNSCOPED_ENUM_SIGNED)); + NARROWS_IF(UnscopedEnum, unsigned long, IS_UNSCOPED_ENUM_SIGNED); - if (sizeof(UnscopedEnum) > sizeof(short)) - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - else - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::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); - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); - } + Q_STATIC_ASSERT(std::is_signed::type>::value); - QVERIFY(std::is_signed::type>::value); - - if (sizeof(SignedUnscopedEnum) > sizeof(char)) - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - else - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); - - if (sizeof(SignedUnscopedEnum) > sizeof(short)) - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - else - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); - - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase::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 }; @@ -7284,192 +7236,190 @@ void tst_QObject::checkArgumentsForNarrowing() enum class ScopedEnumBackedByLongLong : long long { A }; enum class ScopedEnumBackedByULongLong : unsigned long long { A }; - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::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); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + 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); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + FITS(ScopedEnumBackedBySChar, signed char); + FITS(ScopedEnumBackedBySChar, short); + FITS(ScopedEnumBackedBySChar, int); + FITS(ScopedEnumBackedBySChar, long); + FITS(ScopedEnumBackedBySChar, long long); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + FITS(ScopedEnumBackedByUChar, unsigned char); + FITS(ScopedEnumBackedByUChar, unsigned short); + FITS(ScopedEnumBackedByUChar, unsigned int); + FITS(ScopedEnumBackedByUChar, unsigned long); + FITS(ScopedEnumBackedByUChar, unsigned long long); - if (sizeof(short) > sizeof(char)) { - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS_IF(ScopedEnumBackedByShort, char, (sizeof(short) > sizeof(char) || std::is_unsigned::value)); + NARROWS_IF(ScopedEnumBackedByUShort, char, (sizeof(short) > sizeof(char) || std::is_signed::value)); + NARROWS_IF(ScopedEnumBackedByInt, char, (sizeof(int) > sizeof(char) || std::is_unsigned::value)); + NARROWS_IF(ScopedEnumBackedByUInt, char, (sizeof(int) > sizeof(char) || std::is_signed::value)); + NARROWS_IF(ScopedEnumBackedByLong, char, (sizeof(long) > sizeof(char) || std::is_unsigned::value)); + NARROWS_IF(ScopedEnumBackedByULong, char, (sizeof(long) > sizeof(char) || std::is_signed::value)); + NARROWS_IF(ScopedEnumBackedByLongLong, char, (sizeof(long long) > sizeof(char) || std::is_unsigned::value)); + NARROWS_IF(ScopedEnumBackedByULongLong, char, (sizeof(long long) > sizeof(char) || std::is_signed::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::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); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - } + 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))); - if (sizeof(int) > sizeof(short)) { - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + 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); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - } + 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))); - if (sizeof(long) > sizeof(int)) { - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS_IF(ScopedEnumBackedByLong, int, (sizeof(long) > sizeof(int))); + NARROWS(ScopedEnumBackedByULong, int); + NARROWS_IF(ScopedEnumBackedByLongLong, int, (sizeof(long long) > sizeof(int))); + NARROWS(ScopedEnumBackedByULongLong, int); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - } + 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))); - if (sizeof(long long) > sizeof(long)) { - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS_IF(ScopedEnumBackedByLongLong, long, (sizeof(long long) > sizeof(long))); + NARROWS(ScopedEnumBackedByULongLong, long); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - } + NARROWS(ScopedEnumBackedByLongLong, unsigned long); + NARROWS_IF(ScopedEnumBackedByULongLong, unsigned long, (sizeof(long long) > sizeof(long))); // different signedness of the underlying type - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::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); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(ScopedEnumBackedByShort, unsigned char); + NARROWS(ScopedEnumBackedByShort, unsigned short); + NARROWS(ScopedEnumBackedByShort, unsigned int); + NARROWS(ScopedEnumBackedByShort, unsigned long); + NARROWS(ScopedEnumBackedByShort, unsigned long long); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(ScopedEnumBackedByInt, unsigned char); + NARROWS(ScopedEnumBackedByInt, unsigned short); + NARROWS(ScopedEnumBackedByInt, unsigned int); + NARROWS(ScopedEnumBackedByInt, unsigned long); + NARROWS(ScopedEnumBackedByInt, unsigned long long); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(ScopedEnumBackedByLong, unsigned char); + NARROWS(ScopedEnumBackedByLong, unsigned short); + NARROWS(ScopedEnumBackedByLong, unsigned int); + NARROWS(ScopedEnumBackedByLong, unsigned long); + NARROWS(ScopedEnumBackedByLong, unsigned long long); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(ScopedEnumBackedByLongLong, unsigned char); + NARROWS(ScopedEnumBackedByLongLong, unsigned short); + NARROWS(ScopedEnumBackedByLongLong, unsigned int); + NARROWS(ScopedEnumBackedByLongLong, unsigned long); + NARROWS(ScopedEnumBackedByLongLong, unsigned long long); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + 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))); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + 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))); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(ScopedEnumBackedByUInt, signed char); + NARROWS(ScopedEnumBackedByUInt, short); + NARROWS(ScopedEnumBackedByUInt, int); + FITS_IF(ScopedEnumBackedByUInt, long, (sizeof(ScopedEnumBackedByUInt) < sizeof(long))); + FITS(ScopedEnumBackedByUInt, long long); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QCOMPARE((QtPrivate::AreArgumentsNarrowedBase::value), sizeof(ScopedEnumBackedByUInt) >= sizeof(long)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + NARROWS(ScopedEnumBackedByULong, signed char); + NARROWS(ScopedEnumBackedByULong, short); + NARROWS(ScopedEnumBackedByULong, int); + NARROWS(ScopedEnumBackedByULong, long); + FITS_IF(ScopedEnumBackedByULong, long long, (sizeof(ScopedEnumBackedByULong) < sizeof(long long))); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QCOMPARE((QtPrivate::AreArgumentsNarrowedBase::value), sizeof(ScopedEnumBackedByULong) >= sizeof(long long)); - - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + 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::value)); + FITS(void *, void *); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + FITS(QString, QString); + FITS(QString &, QString &); + FITS(const QString &, const QString &); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + FITS(QObject, QObject); + FITS(QObject *, QObject *); + FITS(const QObject *, const QObject *); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + FITS(std::nullptr_t, std::nullptr_t); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + FITS(QString, QObject); + FITS(QString, QVariant); + FITS(QString, void *); + FITS(QString, long long); + FITS(bool, const QObject *&); + FITS(int (*)(bool), void (QObject::*)()); + +#undef IS_UNSCOPED_ENUM_SIGNED + +#undef NARROWS_IF +#undef FITS_IF +#undef NARROWS +#undef FITS } // Test for QtPrivate::HasQ_OBJECT_Macro 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(arg, v2); default: - register int id = v2.userType(); + int id = v2.userType(); if (id == qMetaTypeId()) return compare(arg, v2); else if (id == qMetaTypeId()) 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 b7fe25059f..ed5b9fabb6 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -2959,6 +2959,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/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 6f313402b4..6abd3f6366 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/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(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;