diff options
Diffstat (limited to 'tests/auto/corelib')
16 files changed, 159 insertions, 93 deletions
diff --git a/tests/auto/corelib/animation/qpauseanimation/BLACKLIST b/tests/auto/corelib/animation/qpauseanimation/BLACKLIST index 53372ce9ae..33cd53d788 100644 --- a/tests/auto/corelib/animation/qpauseanimation/BLACKLIST +++ b/tests/auto/corelib/animation/qpauseanimation/BLACKLIST @@ -1,9 +1,5 @@ [pauseAndPropertyAnimations] -osx-10.12 -osx-10.14 -osx-10.13 +osx [multipleSequentialGroups] -osx-10.12 -osx-10.14 -osx-10.13 +osx diff --git a/tests/auto/corelib/io/qfilesystemwatcher/BLACKLIST b/tests/auto/corelib/io/qfilesystemwatcher/BLACKLIST index 9b210b0d5f..457499591d 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/BLACKLIST +++ b/tests/auto/corelib/io/qfilesystemwatcher/BLACKLIST @@ -1,9 +1,7 @@ # QTBUG-33574 QTBUG-30943 [signalsEmittedAfterFileMoved] -windows-10 msvc-2017 -windows-10 msvc-2019 -windows-10 msvc-2015 windows-7sp1 +windows-10 [watchFileAndItsDirectory:native backend-testfile] osx windows diff --git a/tests/auto/corelib/io/qprocess/BLACKLIST b/tests/auto/corelib/io/qprocess/BLACKLIST index aa9fdab64d..682bcbc60c 100644 --- a/tests/auto/corelib/io/qprocess/BLACKLIST +++ b/tests/auto/corelib/io/qprocess/BLACKLIST @@ -2,6 +2,5 @@ redhatenterpriselinuxworkstation-6.6 # QTBUG-48455 [fileWriterProcess] -windows-10 msvc-2015 windows-10 msvc-2017 diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp index 3a4493474b..f305edb2c5 100644 --- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -1830,7 +1830,7 @@ void ListenerObject::slotAboutToBeReset() void ListenerObject::slotReset() { - foreach (const QModelIndex &idx, m_persistentIndexes) { + for (const auto &idx : qAsConst(m_persistentIndexes)) { QVERIFY(!idx.isValid()); } } diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp index f78f5bc138..c74101928a 100644 --- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -32,6 +32,9 @@ #include <algorithm> +Q_DECLARE_METATYPE(QItemSelectionModel::SelectionFlag) +Q_DECLARE_METATYPE(Qt::SortOrder) + class tst_QItemSelectionModel : public QObject { Q_OBJECT @@ -1463,7 +1466,7 @@ void tst_QItemSelectionModel::persistentselections() QFETCH(IntList, insertColumns); QFETCH(IntList, deleteRows); QFETCH(IntList, deleteColumns); - QFETCH(PairList, expectedList); + QFETCH(const PairList, expectedList); // make sure the model is sane (5x5) QCOMPARE(model->rowCount(QModelIndex()), 5); @@ -1504,7 +1507,7 @@ void tst_QItemSelectionModel::persistentselections() // check that the selected items are the correct number and indexes QModelIndexList selectedList = selection->selectedIndexes(); QCOMPARE(selectedList.count(), expectedList.count()); - foreach(IntPair pair, expectedList) { + for (const auto &pair : expectedList) { QModelIndex index = model->index(pair.first, pair.second, QModelIndex()); QVERIFY(selectedList.contains(index)); } @@ -1679,7 +1682,7 @@ void tst_QItemSelectionModel::modelLayoutChanged_data() { QTest::addColumn<IntListList>("items"); QTest::addColumn<IntPairPairList>("initialSelectedRanges"); - QTest::addColumn<int>("sortOrder"); + QTest::addColumn<Qt::SortOrder>("sortOrder"); QTest::addColumn<int>("sortColumn"); QTest::addColumn<IntPairPairList>("expectedSelectedRanges"); @@ -1689,7 +1692,7 @@ void tst_QItemSelectionModel::modelLayoutChanged_data() << (IntList() << 3 << 2 << 1 << 0)) << (IntPairPairList() << IntPairPair(IntPair(0, 0), IntPair(3, 1))) - << int(Qt::DescendingOrder) + << Qt::DescendingOrder << 0 << (IntPairPairList() << IntPairPair(IntPair(0, 0), IntPair(3, 1))); @@ -1699,7 +1702,7 @@ void tst_QItemSelectionModel::modelLayoutChanged_data() << (IntList() << 3 << 2 << 1 << 0)) << (IntPairPairList() << IntPairPair(IntPair(0, 0), IntPair(1, 1))) - << int(Qt::DescendingOrder) + << Qt::DescendingOrder << 0 << (IntPairPairList() << IntPairPair(IntPair(2, 0), IntPair(3, 1))); @@ -1709,7 +1712,7 @@ void tst_QItemSelectionModel::modelLayoutChanged_data() << (IntList() << 3 << 2 << 1 << 0)) << (IntPairPairList() << IntPairPair(IntPair(1, 0), IntPair(2, 1))) - << int(Qt::DescendingOrder) + << Qt::DescendingOrder << 0 << (IntPairPairList() << IntPairPair(IntPair(1, 0), IntPair(2, 1))); @@ -1720,7 +1723,7 @@ void tst_QItemSelectionModel::modelLayoutChanged_data() << (IntPairPairList() << IntPairPair(IntPair(1, 0), IntPair(1, 1)) << IntPairPair(IntPair(3, 0), IntPair(3, 1))) - << int(Qt::AscendingOrder) + << Qt::AscendingOrder << 0 << (IntPairPairList() << IntPairPair(IntPair(0, 0), IntPair(0, 1)) @@ -1730,8 +1733,8 @@ void tst_QItemSelectionModel::modelLayoutChanged_data() void tst_QItemSelectionModel::modelLayoutChanged() { QFETCH(IntListList, items); - QFETCH(IntPairPairList, initialSelectedRanges); - QFETCH(int, sortOrder); + QFETCH(const IntPairPairList, initialSelectedRanges); + QFETCH(Qt::SortOrder, sortOrder); QFETCH(int, sortColumn); QFETCH(IntPairPairList, expectedSelectedRanges); @@ -1746,9 +1749,9 @@ void tst_QItemSelectionModel::modelLayoutChanged() // select initial ranges QItemSelectionModel selectionModel(&model); - foreach (IntPairPair range, initialSelectedRanges) { - IntPair tl = range.first; - IntPair br = range.second; + for (const auto &range : initialSelectedRanges) { + const auto &tl = range.first; + const auto &br = range.second; QItemSelection selection( model.index(tl.first, tl.second), model.index(br.first, br.second)); @@ -1756,7 +1759,7 @@ void tst_QItemSelectionModel::modelLayoutChanged() } // sort the model - model.sort(sortColumn, Qt::SortOrder(sortOrder)); + model.sort(sortColumn, sortOrder); // verify that selection is as expected QItemSelection selection = selectionModel.selection(); @@ -2126,43 +2129,43 @@ void tst_QItemSelectionModel::merge_data() { QTest::addColumn<QItemSelection>("init"); QTest::addColumn<QItemSelection>("other"); - QTest::addColumn<int>("command"); + QTest::addColumn<QItemSelectionModel::SelectionFlag>("command"); QTest::addColumn<QItemSelection>("result"); QTest::newRow("Simple select") << QItemSelection() << QItemSelection(model->index(2, 1) , model->index(3, 4)) - << int(QItemSelectionModel::Select) + << QItemSelectionModel::Select << QItemSelection(model->index(2, 1) , model->index(3, 4)); QTest::newRow("Simple deselect") << QItemSelection(model->index(2, 1) , model->index(3, 4)) << QItemSelection(model->index(2, 1) , model->index(3, 4)) - << int(QItemSelectionModel::Deselect) + << QItemSelectionModel::Deselect << QItemSelection(); QTest::newRow("Simple Toggle deselect") << QItemSelection(model->index(2, 1) , model->index(3, 4)) << QItemSelection(model->index(2, 1) , model->index(3, 4)) - << int(QItemSelectionModel::Toggle) + << QItemSelectionModel::Toggle << QItemSelection(); QTest::newRow("Simple Toggle select") << QItemSelection() << QItemSelection(model->index(2, 1) , model->index(3, 4)) - << int(QItemSelectionModel::Toggle) + << QItemSelectionModel::Toggle << QItemSelection(model->index(2, 1) , model->index(3, 4)); QTest::newRow("Add select") << QItemSelection(model->index(2, 1) , model->index(3, 3)) << QItemSelection(model->index(2, 2) , model->index(3, 4)) - << int(QItemSelectionModel::Select) + << QItemSelectionModel::Select << QItemSelection(model->index(2, 1) , model->index(3, 4)); QTest::newRow("Deselect") << QItemSelection(model->index(2, 1) , model->index(3, 4)) << QItemSelection(model->index(2, 2) , model->index(3, 4)) - << int(QItemSelectionModel::Deselect) + << QItemSelectionModel::Deselect << QItemSelection(model->index(2, 1) , model->index(3, 1)); QItemSelection r1(model->index(2, 1) , model->index(3, 1)); @@ -2170,7 +2173,7 @@ void tst_QItemSelectionModel::merge_data() QTest::newRow("Toggle") << QItemSelection(model->index(2, 1) , model->index(3, 3)) << QItemSelection(model->index(2, 2) , model->index(3, 4)) - << int(QItemSelectionModel::Toggle) + << QItemSelectionModel::Toggle << r1; } @@ -2178,15 +2181,18 @@ void tst_QItemSelectionModel::merge() { QFETCH(QItemSelection, init); QFETCH(QItemSelection, other); - QFETCH(int, command); + QFETCH(QItemSelectionModel::SelectionFlag, command); QFETCH(QItemSelection, result); - init.merge(other, QItemSelectionModel::SelectionFlags(command)); + init.merge(other, command); - foreach(const QModelIndex &idx, init.indexes()) - QVERIFY(result.contains(idx)); - foreach(const QModelIndex &idx, result.indexes()) - QVERIFY(init.contains(idx)); + auto verify = [](const QModelIndexList &a, const QItemSelection &b) + { + for (const QModelIndex &idx : a) + QVERIFY(b.contains(idx)); + }; + verify(init.indexes(), result); + verify(result.indexes(), init); } void tst_QItemSelectionModel::isRowSelected() @@ -2267,13 +2273,12 @@ void tst_QItemSelectionModel::layoutChangedWithAllSelected1() proxy.setFilterRegularExpression(QRegularExpression("f")); QCOMPARE(proxy.rowCount(), 2); - QList<QPersistentModelIndex> indexList; - indexList << proxy.index(0,0) << proxy.index(1,0); - selection.select( QItemSelection(indexList.first(), indexList.last()), QItemSelectionModel::Select); + const QList<QPersistentModelIndex> indexList({proxy.index(0,0), proxy.index(1,0)}); + selection.select(QItemSelection(indexList.first(), indexList.last()), QItemSelectionModel::Select); //let's check the selection hasn't changed QCOMPARE(selection.selectedIndexes().count(), indexList.count()); - foreach(QPersistentModelIndex index, indexList) + for (const auto &index : indexList) QVERIFY(selection.isSelected(index)); proxy.setFilterRegularExpression(QRegularExpression()); @@ -2281,7 +2286,7 @@ void tst_QItemSelectionModel::layoutChangedWithAllSelected1() //let's check the selection hasn't changed QCOMPARE(selection.selectedIndexes().count(), indexList.count()); - foreach(QPersistentModelIndex index, indexList) + for (const auto &index : indexList) QVERIFY(selection.isSelected(index)); } @@ -2321,9 +2326,8 @@ void tst_QItemSelectionModel::layoutChangedWithAllSelected2() selection.select( QItemSelection(proxy.index(0,0), proxy.index(proxy.rowCount() - 1, proxy.columnCount() - 1)), QItemSelectionModel::Select); - QList<QPersistentModelIndex> indexList; - foreach(const QModelIndex &id, selection.selectedIndexes()) - indexList << id; + const auto selIndexes = selection.selectedIndexes(); + const QList<QPersistentModelIndex> indexList(selIndexes.begin(), selIndexes.end()); proxy.filtering = false; proxy.invalidate(); @@ -2331,7 +2335,7 @@ void tst_QItemSelectionModel::layoutChangedWithAllSelected2() //let's check the selection hasn't changed QCOMPARE(selection.selectedIndexes().count(), indexList.count()); - foreach(QPersistentModelIndex index, indexList) + for (const auto &index : indexList) QVERIFY(selection.isSelected(index)); } @@ -2375,7 +2379,8 @@ public: public slots: void selectionChanged(const QItemSelection & /* selected */, const QItemSelection &deselected) { - foreach(const QModelIndex &index, deselected.indexes()) { + const auto deselIndexes = deselected.indexes(); + for (const auto &index : deselIndexes) { QVERIFY(!m_itemSelectionModel->selection().contains(index)); } QCOMPARE(m_itemSelectionModel->selection().size(), 2); @@ -2633,9 +2638,9 @@ private slots: void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) { - foreach(const QItemSelectionRange &range, selected) + for (const auto &range : selected) QVERIFY(range.isValid()); - foreach(const QItemSelectionRange &range, deselected) + for (const auto &range : deselected) QVERIFY(range.isValid()); } diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp index 0f7588a71a..624187349b 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp @@ -829,7 +829,7 @@ void tst_QSortFilterProxyModel::removeRows_data() void tst_QSortFilterProxyModel::removeRows() { - QFETCH(QStringList, initial); + QFETCH(const QStringList, initial); QFETCH(int, sortOrder); QFETCH(QString, filter); QFETCH(int, position); @@ -843,7 +843,7 @@ void tst_QSortFilterProxyModel::removeRows() proxy.setSourceModel(&model); // prepare model - foreach (QString s, initial) + for (const auto &s : initial) model.appendRow(new QStandardItem(s)); if (sortOrder != -1) @@ -3035,15 +3035,15 @@ void tst_QSortFilterProxyModel::removeRowsRecursive() QList<QPersistentModelIndex> sourceIndexes; QList<QPersistentModelIndex> proxyIndexes; - foreach (QStandardItem *item, items) { + for (const auto item : qAsConst(items)) { QModelIndex idx = item->index(); sourceIndexes << idx; proxyIndexes << proxy.mapFromSource(idx); } - foreach (const QPersistentModelIndex &pidx, sourceIndexes) + for (const auto &pidx : qAsConst(sourceIndexes)) QVERIFY(pidx.isValid()); - foreach (const QPersistentModelIndex &pidx, proxyIndexes) + for (const auto &pidx : qAsConst(proxyIndexes)) QVERIFY(pidx.isValid()); QList<QStandardItem*> itemRow = pItem1->takeRow(0); @@ -3051,9 +3051,9 @@ void tst_QSortFilterProxyModel::removeRowsRecursive() QCOMPARE(itemRow.count(), 1); QCOMPARE(itemRow.first(), pItem11); - foreach (const QPersistentModelIndex &pidx, sourceIndexes) + for (const auto &pidx : qAsConst(sourceIndexes)) QVERIFY(!pidx.isValid()); - foreach (const QPersistentModelIndex &pidx, proxyIndexes) + for (const auto &pidx : qAsConst(proxyIndexes)) QVERIFY(!pidx.isValid()); delete pItem11; @@ -3280,10 +3280,8 @@ void tst_QSortFilterProxyModel::testMultipleProxiesWithSelection() static bool isValid(const QItemSelection &selection) { - foreach (const QItemSelectionRange &range, selection) - if (!range.isValid()) - return false; - return true; + return std::all_of(selection.begin(), selection.end(), + [](const QItemSelectionRange &range) { return range.isValid(); }); } void tst_QSortFilterProxyModel::mapSelectionFromSource() @@ -3737,14 +3735,16 @@ void tst_QSortFilterProxyModel::testParentLayoutChanged() QVERIFY(beforeParents.first() == proxy.mapFromSource(model.indexFromItem(model.invisibleRootItem()->child(1)))); - QList<QPersistentModelIndex> proxy2BeforeList = proxy2ParentsAboutToBeChangedSpy.first().first().value<QList<QPersistentModelIndex> >(); - QList<QPersistentModelIndex> proxy2AfterList = proxy2ParentsChangedSpy.first().first().value<QList<QPersistentModelIndex> >(); + const QList<QPersistentModelIndex> proxy2BeforeList = + proxy2ParentsAboutToBeChangedSpy.first().first().value<QList<QPersistentModelIndex> >(); + const QList<QPersistentModelIndex> proxy2AfterList = + proxy2ParentsChangedSpy.first().first().value<QList<QPersistentModelIndex> >(); QCOMPARE(proxy2BeforeList.size(), beforeParents.size()); QCOMPARE(proxy2AfterList.size(), afterParents.size()); - foreach (const QPersistentModelIndex &idx, proxy2BeforeList) + for (const QPersistentModelIndex &idx : proxy2BeforeList) QVERIFY(beforeParents.contains(proxy2.mapToSource(idx))); - foreach (const QPersistentModelIndex &idx, proxy2AfterList) + for (const QPersistentModelIndex &idx : proxy2AfterList) QVERIFY(afterParents.contains(proxy2.mapToSource(idx))); } diff --git a/tests/auto/corelib/kernel/qelapsedtimer/BLACKLIST b/tests/auto/corelib/kernel/qelapsedtimer/BLACKLIST index 4c9fe53c14..569880e1db 100644 --- a/tests/auto/corelib/kernel/qelapsedtimer/BLACKLIST +++ b/tests/auto/corelib/kernel/qelapsedtimer/BLACKLIST @@ -1,4 +1,3 @@ [elapsed] -windows-10 msvc-2015 osx-10.13 -windows-10 msvc-2017 +windows-10 diff --git a/tests/auto/corelib/kernel/qsocketnotifier/BLACKLIST b/tests/auto/corelib/kernel/qsocketnotifier/BLACKLIST index f3b7fc97b1..f2e5e78592 100644 --- a/tests/auto/corelib/kernel/qsocketnotifier/BLACKLIST +++ b/tests/auto/corelib/kernel/qsocketnotifier/BLACKLIST @@ -1,4 +1,3 @@ [unexpectedDisconnection] -osx-10.12 -windows-10 msvc-2015 windows-7sp1 +windows-10 msvc-2015 diff --git a/tests/auto/corelib/kernel/qtimer/BLACKLIST b/tests/auto/corelib/kernel/qtimer/BLACKLIST deleted file mode 100644 index dc8b8987e5..0000000000 --- a/tests/auto/corelib/kernel/qtimer/BLACKLIST +++ /dev/null @@ -1,9 +0,0 @@ -[remainingTime] -osx-10.12 -osx-10.14 -osx-10.13 -windows-10 msvc-2017 -[basic_chrono] -osx-10.14 -osx-10.13 - diff --git a/tests/auto/corelib/serialization/qtextstream/BLACKLIST b/tests/auto/corelib/serialization/qtextstream/BLACKLIST index b8c1b742f4..674569e204 100644 --- a/tests/auto/corelib/serialization/qtextstream/BLACKLIST +++ b/tests/auto/corelib/serialization/qtextstream/BLACKLIST @@ -1,4 +1,3 @@ [stillOpenWhenAtEnd] -windows-10 msvc-2017 -winrt windows-7sp1 +winrt diff --git a/tests/auto/corelib/thread/qsemaphore/BLACKLIST b/tests/auto/corelib/thread/qsemaphore/BLACKLIST index f61f4c1a3b..d7af5c420b 100644 --- a/tests/auto/corelib/thread/qsemaphore/BLACKLIST +++ b/tests/auto/corelib/thread/qsemaphore/BLACKLIST @@ -1,6 +1,5 @@ [tryAcquireWithTimeout] -osx-10.12 -osx-10.13 +osx [tryAcquireWithTimeout:0.2s] windows osx-10.12 diff --git a/tests/auto/corelib/thread/qthread/BLACKLIST b/tests/auto/corelib/thread/qthread/BLACKLIST index 87538a1048..c683154da1 100644 --- a/tests/auto/corelib/thread/qthread/BLACKLIST +++ b/tests/auto/corelib/thread/qthread/BLACKLIST @@ -1,7 +1,5 @@ [wait3_slowDestructor] -windows-10 msvc-2015 -windows-7sp1 -windows-10 msvc-2017 +windows-10 [sleep] windows-7sp1 diff --git a/tests/auto/corelib/thread/qthreadpool/BLACKLIST b/tests/auto/corelib/thread/qthreadpool/BLACKLIST index e4f2fcd822..b8c1f3bf3f 100644 --- a/tests/auto/corelib/thread/qthreadpool/BLACKLIST +++ b/tests/auto/corelib/thread/qthreadpool/BLACKLIST @@ -1,7 +1,4 @@ [expiryTimeoutRace] -rhel-7.6 opensuse-leap -osx-10.13 -ubuntu-18.04 -osx-10.12 -opensuse-42.3 +ubuntu +rhel diff --git a/tests/auto/corelib/tools/qsize/tst_qsize.cpp b/tests/auto/corelib/tools/qsize/tst_qsize.cpp index 385ff18ce5..6824bad9c8 100644 --- a/tests/auto/corelib/tools/qsize/tst_qsize.cpp +++ b/tests/auto/corelib/tools/qsize/tst_qsize.cpp @@ -29,6 +29,7 @@ #include <QtTest/QtTest> #include <qsize.h> +Q_DECLARE_METATYPE(QMargins) class tst_QSize : public QObject { @@ -43,6 +44,9 @@ private slots: void boundedTo_data(); void boundedTo(); + void grownOrShrunkBy_data(); + void grownOrShrunkBy(); + void transpose_data(); void transpose(); }; @@ -186,6 +190,46 @@ void tst_QSize::boundedTo() QCOMPARE( input1.boundedTo(input2), expected); } +void tst_QSize::grownOrShrunkBy_data() +{ + QTest::addColumn<QSize>("input"); + QTest::addColumn<QMargins>("margins"); + QTest::addColumn<QSize>("grown"); + QTest::addColumn<QSize>("shrunk"); + + auto row = [](QSize i, QMargins m, QSize g, QSize s) { + QTest::addRow("{%d,%d}/{%d,%d,%d,%d}", i.width(), i.height(), + m.left(), m.top(), m.right(), m.bottom()) + << i << m << g << s; + }; + + const QSize zero = {0, 0}; + const QSize some = {100, 200}; + const QMargins zeroMargins = {}; + const QMargins negative = {-1, -2, -3, -4}; + const QMargins positive = { 1, 2, 3, 4}; + + row(zero, zeroMargins, zero, zero); + row(zero, negative, {-4, -6}, { 4, 6}); + row(zero, positive, { 4, 6}, {-4, -6}); + row(some, zeroMargins, some, some); + row(some, negative, { 96, 194}, {104, 206}); + row(some, positive, {104, 206}, { 96, 194}); +} + +void tst_QSize::grownOrShrunkBy() +{ + QFETCH(const QSize, input); + QFETCH(const QMargins, margins); + QFETCH(const QSize, grown); + QFETCH(const QSize, shrunk); + + QCOMPARE(input.grownBy(margins), grown); + QCOMPARE(input.shrunkBy(margins), shrunk); + QCOMPARE(grown.shrunkBy(margins), input); + QCOMPARE(shrunk.grownBy(margins), input); +} + void tst_QSize::transpose_data() { QTest::addColumn<QSize>("input1"); diff --git a/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp b/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp index 42801d63a9..bbffa74a62 100644 --- a/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp +++ b/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp @@ -29,6 +29,7 @@ #include <QtTest/QtTest> #include <qsize.h> +Q_DECLARE_METATYPE(QMarginsF) class tst_QSizeF : public QObject { @@ -45,6 +46,9 @@ private slots: void boundedTo_data(); void boundedTo(); + void grownOrShrunkBy_data(); + void grownOrShrunkBy(); + void transpose_data(); void transpose(); }; @@ -152,6 +156,46 @@ void tst_QSizeF::boundedTo() { QCOMPARE( input1.boundedTo(input2), expected); } +void tst_QSizeF::grownOrShrunkBy_data() +{ + QTest::addColumn<QSizeF>("input"); + QTest::addColumn<QMarginsF>("margins"); + QTest::addColumn<QSizeF>("grown"); + QTest::addColumn<QSizeF>("shrunk"); + + auto row = [](QSizeF i, QMarginsF m, QSizeF g, QSizeF s) { + QTest::addRow("{%g,%g}/{%g,%g,%g,%g}", i.width(), i.height(), + m.left(), m.top(), m.right(), m.bottom()) + << i << m << g << s; + }; + + const QSizeF zero = {0, 0}; + const QSizeF some = {100, 200}; + const QMarginsF zeroMargins = {}; + const QMarginsF negative = {-1, -2, -3, -4}; + const QMarginsF positive = { 1, 2, 3, 4}; + + row(zero, zeroMargins, zero, zero); + row(zero, negative, {-4, -6}, { 4, 6}); + row(zero, positive, { 4, 6}, {-4, -6}); + row(some, zeroMargins, some, some); + row(some, negative, { 96, 194}, {104, 206}); + row(some, positive, {104, 206}, { 96, 194}); +} + +void tst_QSizeF::grownOrShrunkBy() +{ + QFETCH(const QSizeF, input); + QFETCH(const QMarginsF, margins); + QFETCH(const QSizeF, grown); + QFETCH(const QSizeF, shrunk); + + QCOMPARE(input.grownBy(margins), grown); + QCOMPARE(input.shrunkBy(margins), shrunk); + QCOMPARE(grown.shrunkBy(margins), input); + QCOMPARE(shrunk.grownBy(margins), input); +} + void tst_QSizeF::transpose_data() { QTest::addColumn<QSizeF>("input1"); QTest::addColumn<QSizeF>("expected"); diff --git a/tests/auto/corelib/tools/qtimeline/BLACKLIST b/tests/auto/corelib/tools/qtimeline/BLACKLIST index b60cab31fa..9794b0059f 100644 --- a/tests/auto/corelib/tools/qtimeline/BLACKLIST +++ b/tests/auto/corelib/tools/qtimeline/BLACKLIST @@ -1,8 +1,6 @@ [interpolation] -osx-10.12 windows-10 msvc-2015 -osx-10.13 -windows-7sp1 +osx [frameRate] osx-10.12 osx-10.13 |