diff options
3 files changed, 28 insertions, 35 deletions
diff --git a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp index 5717afab51..856672b957 100644 --- a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp +++ b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp @@ -25,15 +25,16 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#include <QComboBox> #include <QDataWidgetMapper> -#include <QStandardItemModel> #include <QLineEdit> -#include <QComboBox> +#include <QMetaType> +#include <QStandardItemModel> +#include <QSignalSpy> +#include <QTest> #include <QTextEdit> #include <QVBoxLayout> -#include <QTest> -#include <QSignalSpy> -#include <QMetaType> class tst_QDataWidgetMapper: public QObject { @@ -56,7 +57,7 @@ private slots: Q_DECLARE_METATYPE(QAbstractItemDelegate::EndEditHint) -static QStandardItemModel *testModel(QObject *parent = 0) +static QStandardItemModel *testModel(QObject *parent) { QStandardItemModel *model = new QStandardItemModel(10, 10, parent); @@ -84,7 +85,7 @@ void tst_QDataWidgetMapper::setModel() { // let the model go out of scope firstma QStandardItemModel model; mapper.setModel(&model); - QCOMPARE(mapper.model(), static_cast<QAbstractItemModel *>(&model)); + QCOMPARE(mapper.model(), &model); } QCOMPARE(mapper.model(), nullptr); @@ -273,7 +274,7 @@ void tst_QDataWidgetMapper::currentIndexChanged() QAbstractItemModel *model = testModel(&mapper); mapper.setModel(model); - QSignalSpy spy(&mapper, SIGNAL(currentIndexChanged(int))); + QSignalSpy spy(&mapper, &QDataWidgetMapper::currentIndexChanged); mapper.toFirst(); QCOMPARE(spy.count(), 1); @@ -405,13 +406,13 @@ void tst_QDataWidgetMapper::mappedWidgetAt() mapper.addMapping(&lineEdit1, 1); mapper.addMapping(&lineEdit2, 2); - QCOMPARE(mapper.mappedWidgetAt(1), static_cast<QWidget *>(&lineEdit1)); - QCOMPARE(mapper.mappedWidgetAt(2), static_cast<QWidget *>(&lineEdit2)); + QCOMPARE(mapper.mappedWidgetAt(1), &lineEdit1); + QCOMPARE(mapper.mappedWidgetAt(2), &lineEdit2); mapper.addMapping(&lineEdit2, 4242); QCOMPARE(mapper.mappedWidgetAt(2), nullptr); - QCOMPARE(mapper.mappedWidgetAt(4242), static_cast<QWidget *>(&lineEdit2)); + QCOMPARE(mapper.mappedWidgetAt(4242), &lineEdit2); } void tst_QDataWidgetMapper::textEditDoesntChangeFocusOnTab_qtbug3305() @@ -423,7 +424,8 @@ void tst_QDataWidgetMapper::textEditDoesntChangeFocusOnTab_qtbug3305() QAbstractItemModel *model = testModel(&mapper); mapper.setModel(model); - QSignalSpy closeEditorSpy(mapper.itemDelegate(), SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint))); + QSignalSpy closeEditorSpy(mapper.itemDelegate(), + &QAbstractItemDelegate::closeEditor); QVERIFY(closeEditorSpy.isValid()); QWidget container; diff --git a/tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.cpp b/tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.cpp index 6db1f78312..4824973576 100644 --- a/tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.cpp +++ b/tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.cpp @@ -27,16 +27,15 @@ ****************************************************************************/ -#include <QtTest/QtTest> -#include <qfileiconprovider.h> -#include <qfileinfo.h> +#include <QFileIconProvider> +#include <QFileInfo> +#include <QTest> class tst_QFileIconProvider : public QObject { Q_OBJECT private slots: - void qfileiconprovider_data(); void qfileiconprovider(); void iconType_data(); @@ -51,21 +50,10 @@ private slots: void taskQTBUG_46755_QFileIconEngine_crash(); }; -// Subclass that exposes the protected functions. -class SubQFileIconProvider : public QFileIconProvider -{ -public: - -}; - -void tst_QFileIconProvider::qfileiconprovider_data() -{ -} - void tst_QFileIconProvider::qfileiconprovider() { // don't crash - SubQFileIconProvider provider; + QFileIconProvider provider; } Q_DECLARE_METATYPE(QFileIconProvider::IconType) @@ -86,7 +74,7 @@ void tst_QFileIconProvider::iconType_data() void tst_QFileIconProvider::iconType() { QFETCH(QFileIconProvider::IconType, type); - SubQFileIconProvider provider; + QFileIconProvider provider; QVERIFY(!provider.icon(type).isNull()); } @@ -109,7 +97,7 @@ void tst_QFileIconProvider::iconInfo() if (setPath) QVERIFY(info.exists()); - SubQFileIconProvider provider; + QFileIconProvider provider; // we should always get an icon QVERIFY(!provider.icon(info).isNull()); } @@ -131,7 +119,7 @@ void tst_QFileIconProvider::type_data() void tst_QFileIconProvider::type() { QFETCH(QFileInfo, info); - SubQFileIconProvider provider; + QFileIconProvider provider; QVERIFY(!provider.type(info).isEmpty()); } @@ -144,7 +132,8 @@ static QIcon getIcon() void tst_QFileIconProvider::taskQTBUG_46755_QFileIconEngine_crash() { const QIcon &icon = getIcon(); - foreach (const QSize &size, icon.availableSizes()) + const auto sizes = icon.availableSizes(); + for (const QSize &size : sizes) icon.pixmap(size); // No crash, all good. diff --git a/tests/auto/widgets/itemviews/qitemeditorfactory/tst_qitemeditorfactory.cpp b/tests/auto/widgets/itemviews/qitemeditorfactory/tst_qitemeditorfactory.cpp index ae587279b2..ed4c543d0a 100644 --- a/tests/auto/widgets/itemviews/qitemeditorfactory/tst_qitemeditorfactory.cpp +++ b/tests/auto/widgets/itemviews/qitemeditorfactory/tst_qitemeditorfactory.cpp @@ -25,9 +25,11 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include <QtGui/QtGui> -#include <QtWidgets/QtWidgets> -#include <QtTest/QtTest> + + +#include <QDoubleSpinBox> +#include <QItemEditorFactory> +#include <QTest> class tst_QItemEditorFactory: public QObject { |