Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev

This commit is contained in:
Frederik Gladhorn 2017-05-11 09:55:44 +00:00 committed by The Qt Project
commit 9eb00a3397
20 changed files with 521 additions and 452 deletions

View File

@ -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;

View File

@ -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))
}
}
}

View File

@ -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)

View File

@ -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
}
}

View File

@ -942,13 +942,14 @@ static QItemSelection mergeRowLengths(const QVector<QPair<QPersistentModelIndex,
const uint nextLength = rowLengths.at(i).second;
if ((nextLength == length)
&& (next.row() == br.row() + 1)
&& (next.column() == br.column())
&& (next.parent() == br.parent())) {
br = next;
} else {
break;
}
}
result.append(QItemSelectionRange(tl, br.sibling(br.row(), length - 1)));
result.append(QItemSelectionRange(tl, br.sibling(br.row(), br.column() + length - 1)));
}
return result;
}

View File

@ -860,7 +860,7 @@ bool QEventDispatcherWin32::unregisterTimers(QObject *object)
Q_D(QEventDispatcherWin32);
if (d->timerVec.isEmpty())
return false;
register WinTimerInfo *t;
WinTimerInfo *t;
for (int i=0; i<d->timerVec.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; i<d->timerVec.size(); i++) {
t = d->timerVec.at(i);
if (t && t->timerId == timerId) { // timer found

View File

@ -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);

View File

@ -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 <NSDraggingInfo>)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 <NSDraggingInfo>)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 <NSDraggingInfo>)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());

View File

@ -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);

View File

@ -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
}

View File

@ -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"

View File

@ -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<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));
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<bool, unsigned char>::value));
else
QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<bool, unsigned char>::value));
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));
if (sizeof(bool) > sizeof(short))
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, unsigned short>::value));
else
QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<bool, unsigned short>::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)));
if (sizeof(bool) > sizeof(int))
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, unsigned int>::value));
else
QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<bool, unsigned int>::value));
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)));
if (sizeof(bool) > sizeof(long))
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, unsigned long>::value));
else
QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<bool, unsigned long>::value));
FITS(short, short);
FITS(short, int);
FITS(short, long);
FITS(short, long long);
if (sizeof(bool) > sizeof(long long))
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, unsigned long long>::value));
else
QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<bool, unsigned long long>::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<short, char>::value));
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, unsigned char>::value));
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, signed char>::value));
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);
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned short, char>::value));
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned short, unsigned char>::value));
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned short, signed char>::value));
}
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)));
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));
FITS(int, int);
FITS(int, long);
FITS(int, long long);
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));
FITS(unsigned int, unsigned int);
FITS(unsigned int, unsigned long);
FITS(unsigned int, unsigned long long);
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));
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);
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));
}
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)));
QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<int, int>::value));
QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<int, long>::value));
QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<int, long long>::value));
FITS(long, long);
FITS(long, long long);
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));
FITS(unsigned long, unsigned long);
FITS(unsigned long, unsigned long long);
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));
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);
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));
}
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)));
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(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));
// (note that we know that sizeof(UnscopedEnum) <= sizeof(int)
FITS(UnscopedEnum, UnscopedEnum);
FITS(SignedUnscopedEnum, SignedUnscopedEnum);
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));
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, short>::value));
else
QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, 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, 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));
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<UnscopedEnum, unsigned char>::value));
else
QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned char>::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<UnscopedEnum, unsigned short>::value));
else
QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned short>::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<UnscopedEnum, unsigned int>::value));
QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned long>::value));
QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned long long>::value));
}
Q_STATIC_ASSERT(std::is_signed<typename std::underlying_type<SignedUnscopedEnum>::type>::value);
QVERIFY(std::is_signed<typename std::underlying_type<SignedUnscopedEnum>::type>::value);
if (sizeof(SignedUnscopedEnum) > sizeof(char))
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, signed char>::value));
else
QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, signed char>::value));
if (sizeof(SignedUnscopedEnum) > sizeof(short))
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, short>::value));
else
QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, short>::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 };
@ -7284,192 +7236,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));
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<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));
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<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));
FITS(ScopedEnumBackedBySChar, signed char);
FITS(ScopedEnumBackedBySChar, short);
FITS(ScopedEnumBackedBySChar, int);
FITS(ScopedEnumBackedBySChar, long);
FITS(ScopedEnumBackedBySChar, long long);
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));
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<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));
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));
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));
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<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));
}
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<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));
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<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));
}
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<ScopedEnumBackedByLong, int>::value));
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, int>::value));
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, int>::value));
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, int>::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<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));
}
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<ScopedEnumBackedByLongLong, long>::value));
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, long>::value));
NARROWS_IF(ScopedEnumBackedByLongLong, long, (sizeof(long long) > sizeof(long)));
NARROWS(ScopedEnumBackedByULongLong, long);
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned long>::value));
QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, unsigned long>::value));
}
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));
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<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));
NARROWS(ScopedEnumBackedByShort, unsigned char);
NARROWS(ScopedEnumBackedByShort, unsigned short);
NARROWS(ScopedEnumBackedByShort, unsigned int);
NARROWS(ScopedEnumBackedByShort, unsigned long);
NARROWS(ScopedEnumBackedByShort, unsigned long long);
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));
NARROWS(ScopedEnumBackedByInt, unsigned char);
NARROWS(ScopedEnumBackedByInt, unsigned short);
NARROWS(ScopedEnumBackedByInt, unsigned int);
NARROWS(ScopedEnumBackedByInt, unsigned long);
NARROWS(ScopedEnumBackedByInt, unsigned long long);
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));
NARROWS(ScopedEnumBackedByLong, unsigned char);
NARROWS(ScopedEnumBackedByLong, unsigned short);
NARROWS(ScopedEnumBackedByLong, unsigned int);
NARROWS(ScopedEnumBackedByLong, unsigned long);
NARROWS(ScopedEnumBackedByLong, unsigned long long);
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));
NARROWS(ScopedEnumBackedByLongLong, unsigned char);
NARROWS(ScopedEnumBackedByLongLong, unsigned short);
NARROWS(ScopedEnumBackedByLongLong, unsigned int);
NARROWS(ScopedEnumBackedByLongLong, unsigned long);
NARROWS(ScopedEnumBackedByLongLong, unsigned long long);
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));
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<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));
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<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));
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<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));
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<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(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 *);
QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QString, QString>::value));
QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QString &, QString &>::value));
QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<const QString &, const QString &>::value));
FITS(QString, QString);
FITS(QString &, QString &);
FITS(const QString &, const QString &);
QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QObject, QObject>::value));
QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QObject *, QObject *>::value));
QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<const QObject *, const QObject *>::value));
FITS(QObject, QObject);
FITS(QObject *, QObject *);
FITS(const QObject *, const QObject *);
QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<std::nullptr_t, std::nullptr_t>::value));
FITS(std::nullptr_t, std::nullptr_t);
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));
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

View File

@ -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>())

View File

@ -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.");

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -1,4 +1,2 @@
[quitOnLastWindowClosed]
osx-10.10
[touchEventPropagation]
xcb

View File

@ -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);

View File

@ -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;