aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-22 12:33:52 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-22 16:00:22 +0200
commit1270a88cb3fa446ce2201d4204ff05b8b969f2ea (patch)
treeaa14ad6fc6cb3eb2740a7803c598a8297ac36be1 /tests/auto/quick
parent328759cdeb7b45eba5569b54ded35e38152ee0d0 (diff)
Fix compile warnings from tests
Use streaming operators for debug/warnings to avoid qsizehint/int conflicts. Don't ignore return values from [[no_discard]] functions. Don't copy elements from containers that return references. Remove unused variables. Change-Id: I7a0bef94a5e828bd8facee0c625ec48c3d1f1bdb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/quick')
-rw-r--r--tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp10
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp2
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp4
3 files changed, 9 insertions, 7 deletions
diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
index 2d7c374419..cde228f6c4 100644
--- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
+++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
@@ -117,11 +117,13 @@ void tst_QQuickAccessible::cleanup()
{
const EventList list = QTestAccessibility::events();
if (!list.isEmpty()) {
- qWarning("%d accessibility event(s) were not handled in testfunction '%s':", list.count(),
- QString(QTest::currentTestFunction()).toLatin1().constData());
+ qWarning().noquote() << list.count()
+ << "accessibility event(s) were not handled in testfunction '"
+ << QTest::currentTestFunction() << "':";
for (int i = 0; i < list.count(); ++i)
- qWarning(" %d: Object: %p Event: '%s' Child: %d", i + 1, list.at(i)->object(),
- qAccessibleEventString(list.at(i)->type()), list.at(i)->child());
+ qWarning().noquote() << " " << (i + 1) << ": Object: " << list.at(i)->object()
+ << "Event: '" << qAccessibleEventString(list.at(i)->type())
+ << "' Child: " << list.at(i)->child();
}
QTestAccessibility::clearEvents();
}
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index 9aed54b487..6c7c84c0cf 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -792,7 +792,7 @@ void tst_qquickflickable::resizeContent()
QSizeChangeListener sizeListener(fp->contentItem);
QMetaObject::invokeMethod(root, "resizeContent");
- for (const QSize sizeOnGeometryChanged : sizeListener) {
+ for (const QSize &sizeOnGeometryChanged : sizeListener) {
// Check that we have the correct size on all signals
QCOMPARE(sizeOnGeometryChanged, QSize(600, 600));
}
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 51a753c199..00cd06f3ae 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -5489,9 +5489,9 @@ void tst_QQuickListView::headerSnapToItem()
QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, startPos, 200); // Wait 200 ms before we release to avoid trigger a flick
// wait for the "fixup" animation to finish
- QTest::qWaitFor([&]()
+ QVERIFY(QTest::qWaitFor([&]()
{ return !listview->isMoving();}
- );
+ ));
QCOMPARE(listview->contentPosition(), expectedContentPosition);
QCOMPARE(listview->headerPosition(), expectedHeaderPosition);