diff options
Diffstat (limited to 'tests/auto/gui')
11 files changed, 93 insertions, 36 deletions
diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp index 2f5537adfe..a07f45ef1d 100644 --- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -130,6 +130,8 @@ private slots: void getMimeDataWithInvalidModelIndex(); void supportedDragDropActions(); + void taskQTBUG_45114_setItemData(); + private: QAbstractItemModel *m_model; QPersistentModelIndex persistent; @@ -1701,5 +1703,65 @@ void tst_QStandardItemModel::supportedDragDropActions() QCOMPARE(model.supportedDropActions(), Qt::CopyAction | Qt::MoveAction); } +void tst_QStandardItemModel::taskQTBUG_45114_setItemData() +{ + QStandardItemModel model; + QSignalSpy spy(&model, &QStandardItemModel::itemChanged); + + QStandardItem *item = new QStandardItem("item"); + item->setData(1, Qt::UserRole + 1); + item->setData(2, Qt::UserRole + 2); + model.appendRow(item); + + QModelIndex index = item->index(); + QCOMPARE(model.itemData(index).size(), 3); + + QCOMPARE(spy.count(), 0); + + QMap<int, QVariant> roles; + + roles.insert(Qt::UserRole + 1, 1); + roles.insert(Qt::UserRole + 2, 2); + model.setItemData(index, roles); + + QCOMPARE(spy.count(), 0); + + roles.insert(Qt::UserRole + 1, 1); + roles.insert(Qt::UserRole + 2, 2); + roles.insert(Qt::UserRole + 3, QVariant()); + model.setItemData(index, roles); + + QCOMPARE(spy.count(), 0); + + roles.clear(); + roles.insert(Qt::UserRole + 1, 10); + roles.insert(Qt::UserRole + 3, 12); + model.setItemData(index, roles); + + QCOMPARE(spy.count(), 1); + QMap<int, QVariant> itemRoles = model.itemData(index); + + QCOMPARE(itemRoles.size(), 4); + QCOMPARE(itemRoles[Qt::UserRole + 1].toInt(), 10); + QCOMPARE(itemRoles[Qt::UserRole + 2].toInt(), 2); + QCOMPARE(itemRoles[Qt::UserRole + 3].toInt(), 12); + + roles.clear(); + roles.insert(Qt::UserRole + 3, 1); + model.setItemData(index, roles); + + QCOMPARE(spy.count(), 2); + + roles.clear(); + roles.insert(Qt::UserRole + 3, QVariant()); + model.setItemData(index, roles); + + QCOMPARE(spy.count(), 3); + + itemRoles = model.itemData(index); + QCOMPARE(itemRoles.size(), 3); + QVERIFY(!itemRoles.keys().contains(Qt::UserRole + 3)); +} + QTEST_MAIN(tst_QStandardItemModel) #include "tst_qstandarditemmodel.moc" diff --git a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp index d882dc3888..f74ae00bff 100644 --- a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp +++ b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp @@ -74,17 +74,17 @@ public: initCount = resizeCount = paintCount = 0; } - void initializeGL() Q_DECL_OVERRIDE { + void initializeGL() override { ++initCount; } - void resizeGL(int w, int h) Q_DECL_OVERRIDE { + void resizeGL(int w, int h) override { ++resizeCount; QCOMPARE(w, size().width()); QCOMPARE(h, size().height()); } - void paintGL() Q_DECL_OVERRIDE { + void paintGL() override { ++paintCount; QOpenGLContext *ctx = QOpenGLContext::currentContext(); @@ -144,7 +144,7 @@ void tst_QOpenGLWindow::basic() class PainterWindow : public QOpenGLWindow { public: - void paintGL() Q_DECL_OVERRIDE { + void paintGL() override { QOpenGLContext *ctx = QOpenGLContext::currentContext(); QVERIFY(ctx); QCOMPARE(ctx, context()); @@ -183,7 +183,7 @@ public: PartialPainterWindow(QOpenGLWindow::UpdateBehavior u) : QOpenGLWindow(u), x(0) { } - void paintGL() Q_DECL_OVERRIDE { + void paintGL() override { ++paintCount; QPainter p(this); @@ -244,7 +244,7 @@ public: Error } m_state; - void paintUnderGL() Q_DECL_OVERRIDE { + void paintUnderGL() override { if (m_state == None || m_state == PaintOver) m_state = PaintUnder; else @@ -255,7 +255,7 @@ public: QCOMPARE(fbo, GLuint(0)); } - void paintGL() Q_DECL_OVERRIDE { + void paintGL() override { if (m_state == PaintUnder) m_state = Paint; else @@ -268,7 +268,7 @@ public: QCOMPARE(fbo, defaultFramebufferObject()); } - void paintOverGL() Q_DECL_OVERRIDE { + void paintOverGL() override { if (m_state == Paint) m_state = PaintOver; else diff --git a/tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp b/tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp index 3421622fe3..ffc440ac2d 100644 --- a/tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp +++ b/tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp @@ -54,7 +54,7 @@ class PainterWindow : public QRasterWindow public: void reset() { paintCount = 0; } - void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE { + void paintEvent(QPaintEvent*) override { ++paintCount; QPainter p(this); p.fillRect(QRect(0, 0, 100, 100), Qt::blue); diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp index ec143896ab..706c66ef14 100644 --- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp @@ -48,7 +48,7 @@ public: ulong timestamp; QTouchDevice *deviceFromEvent; - explicit tst_QTouchEventWidget(QWidget *parent = Q_NULLPTR) : QWidget(parent) + explicit tst_QTouchEventWidget(QWidget *parent = nullptr) : QWidget(parent) { reset(); } @@ -63,7 +63,7 @@ public: deleteInTouchBegin = deleteInTouchUpdate = deleteInTouchEnd = false; } - bool event(QEvent *event) Q_DECL_OVERRIDE + bool event(QEvent *event) override { switch (event->type()) { case QEvent::TouchBegin: @@ -117,7 +117,7 @@ public: bool deleteInTouchBegin, deleteInTouchUpdate, deleteInTouchEnd; tst_QTouchEventGraphicsItem **weakpointer; - explicit tst_QTouchEventGraphicsItem(QGraphicsItem *parent = Q_NULLPTR) + explicit tst_QTouchEventGraphicsItem(QGraphicsItem *parent = nullptr) : QGraphicsItem(parent), weakpointer(0) { reset(); @@ -140,13 +140,13 @@ public: deleteInTouchBegin = deleteInTouchUpdate = deleteInTouchEnd = false; } - QRectF boundingRect() const Q_DECL_OVERRIDE { return QRectF(0, 0, 10, 10); } - void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE + QRectF boundingRect() const override { return QRectF(0, 0, 10, 10); } + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override { painter->fillRect(QRectF(QPointF(0, 0), boundingRect().size()), Qt::yellow); } - bool sceneEvent(QEvent *event) Q_DECL_OVERRIDE + bool sceneEvent(QEvent *event) override { switch (event->type()) { case QEvent::TouchBegin: @@ -1628,7 +1628,7 @@ class WindowTouchEventFilter : public QObject { Q_OBJECT public: - bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE; + bool eventFilter(QObject *obj, QEvent *event) override; struct TouchInfo { QList<QTouchEvent::TouchPoint> points; QEvent::Type lastSeenType; diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 039d095ce6..a365d21d36 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -352,7 +352,7 @@ private: class ColoredWindow : public QRasterWindow { public: explicit ColoredWindow(const QColor &color, QWindow *parent = 0) : QRasterWindow(parent), m_color(color) {} - void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE + void paintEvent(QPaintEvent *) override { QPainter p(this); p.fillRect(QRect(QPoint(0, 0), size()), m_color); @@ -702,7 +702,7 @@ class PlatformWindowFilter : public QObject public: PlatformWindowFilter(QObject *parent = 0) : QObject(parent) - , m_window(Q_NULLPTR) + , m_window(nullptr) , m_alwaysExisted(true) {} @@ -714,7 +714,7 @@ public: // If they are, the native platform surface should always exist when we // receive a QPlatformSurfaceEvent if (e->type() == QEvent::PlatformSurface && o == m_window) { - m_alwaysExisted &= (m_window->handle() != Q_NULLPTR); + m_alwaysExisted &= (m_window->handle() != nullptr); } return false; } @@ -741,7 +741,7 @@ void tst_QWindow::platformSurface() QTRY_COMPARE(window.received(QEvent::PlatformSurface), 1); QTRY_COMPARE(window.surfaceEventType(), QPlatformSurfaceEvent::SurfaceCreated); - QTRY_VERIFY(window.handle() != Q_NULLPTR); + QTRY_VERIFY(window.handle() != nullptr); window.destroy(); QTRY_COMPARE(window.received(QEvent::PlatformSurface), 2); diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp index 6809aea086..67d30d7c9a 100644 --- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp +++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp @@ -1423,9 +1423,6 @@ void tst_QColor::achromaticHslHue() #if 0 // Used to be included in Qt4 for Q_WS_X11 void tst_QColor::setallowX11ColorNames() { -#if defined(Q_OS_IRIX) - QSKIP("This fails due to the gamma settings in the SGI X server"); -#endif RGBData x11RgbTbl[] = { // a few standard X11 color names { "DodgerBlue1", qRgb(30, 144, 255) }, diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 779783d5ec..c0f5fc5f59 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -2826,7 +2826,7 @@ void tst_QPainter::monoImages() } } -#if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_CC_MSVC) && !defined(Q_OS_SOLARIS) && !defined(__UCLIBC__) +#if !defined(Q_OS_AIX) && !defined(Q_CC_MSVC) && !defined(Q_OS_SOLARIS) && !defined(__UCLIBC__) #include <fenv.h> static const QString fpeExceptionString(int exception) diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp index 82b3657b56..5b1af9b6c9 100644 --- a/tests/auto/gui/qopengl/tst_qopengl.cpp +++ b/tests/auto/gui/qopengl/tst_qopengl.cpp @@ -1593,7 +1593,7 @@ void tst_QOpenGL::defaultQGLCurrentBuffer() ctx->makeCurrent(surface.data()); // Bind default FBO on the current context, and record what's the current QGL FBO. It should - // be Q_NULLPTR because the default platform OpenGL FBO is not backed by a + // be nullptr because the default platform OpenGL FBO is not backed by a // QOpenGLFramebufferObject. QOpenGLFramebufferObject::bindDefault(); QOpenGLFramebufferObject *defaultQFBO = QOpenGLContextPrivate::get(ctx.data())->qgl_current_fbo; diff --git a/tests/auto/gui/qvulkan/tst_qvulkan.cpp b/tests/auto/gui/qvulkan/tst_qvulkan.cpp index cc4bc43f92..c80c3fed97 100644 --- a/tests/auto/gui/qvulkan/tst_qvulkan.cpp +++ b/tests/auto/gui/qvulkan/tst_qvulkan.cpp @@ -166,7 +166,7 @@ static void waitForUnexposed(QWindow *w) if (remaining <= 0) break; QCoreApplication::processEvents(QEventLoop::AllEvents, remaining); - QCoreApplication::sendPostedEvents(Q_NULLPTR, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QTest::qSleep(10); } } diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp index dbe5bf7cc6..2a53f5d633 100644 --- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp @@ -87,10 +87,8 @@ void tst_QCssParser::scanner_data() #if defined(Q_OS_ANDROID) || defined(Q_OS_WINRT) QDir d(":/"); -#elif !defined(Q_OS_IRIX) - QDir d(SRCDIR); #else - QDir d(QDir::current()); + QDir d(SRCDIR); #endif d.cd("testdata"); d.cd("scanner"); diff --git a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp index f4e3356ad0..9ade3b554e 100644 --- a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp @@ -862,19 +862,19 @@ void tst_QStaticText::textDocumentColor() class TestPaintEngine: public QPaintEngine { public: - void drawTextItem(const QPointF &p, const QTextItem &) Q_DECL_OVERRIDE + void drawTextItem(const QPointF &p, const QTextItem &) override { differentVerticalPositions.insert(qRound(p.y())); } - void updateState(const QPaintEngineState &) Q_DECL_OVERRIDE {} + void updateState(const QPaintEngineState &) override {} - void drawPolygon(const QPointF *, int , PolygonDrawMode ) Q_DECL_OVERRIDE {} + void drawPolygon(const QPointF *, int , PolygonDrawMode ) override {} - bool begin(QPaintDevice *) Q_DECL_OVERRIDE { return true; } - bool end() Q_DECL_OVERRIDE { return true; } - void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) Q_DECL_OVERRIDE {} - Type type() const Q_DECL_OVERRIDE + bool begin(QPaintDevice *) override { return true; } + bool end() override { return true; } + void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) override {} + Type type() const override { return User; } |