diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-07-12 13:17:02 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-07-12 16:00:51 +0200 |
commit | 83f8d886cee0a40ac1ad5e43e597f309f602ad76 (patch) | |
tree | 9f8bf09cd21346bec5c87fca8538c02278eff34a /tests | |
parent | 392521048ce6ef43a127b3dba199eee58557b1f6 (diff) |
Fix some compiler warnings in tests
- Signedness of integer comparison
- Unused parameters and variables
- Ignored return values of QTest::qWaitForWindowExposed() (nodiscard)
- float to int conversions
Change-Id: Ibece620d3c980a5af3b7717486c841d8072ed8af
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests')
11 files changed, 25 insertions, 22 deletions
diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp index dc29363fcf..7e6a0f79f9 100644 --- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp +++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp @@ -428,7 +428,7 @@ void tst_qqmlconnections::noAcceleratedGlobalLookup() QVERIFY(c.isReady()); QScopedPointer<QObject> object(c.create()); const QVariant val = object->property("testEnum"); - QCOMPARE(val.type(), QMetaType::Int); + QCOMPARE(val.type(), int(QMetaType::Int)); QCOMPARE(val.toInt(), int(Proxy::EnumValue)); } diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp index 97ca3fa1de..eed0ade98d 100644 --- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp @@ -99,7 +99,7 @@ public: qmlRegisterModule(uri, 1, 0); } - void initializeEngine(QQmlEngine *engine, const char *uri) override + void initializeEngine(QQmlEngine *, const char *) override { initializeEngineEntered.lock(); leavingInitializeEngine.lock(); diff --git a/tests/auto/quick/drawingmodes/tst_drawingmodes.cpp b/tests/auto/quick/drawingmodes/tst_drawingmodes.cpp index f3825b350f..9bcc21c77d 100644 --- a/tests/auto/quick/drawingmodes/tst_drawingmodes.cpp +++ b/tests/auto/quick/drawingmodes/tst_drawingmodes.cpp @@ -385,9 +385,10 @@ bool tst_drawingmodes::isRunningOnRhi() const decided = true; QQuickView dummy; dummy.show(); - QTest::qWaitForWindowExposed(&dummy); - QSGRendererInterface::GraphicsApi api = dummy.rendererInterface()->graphicsApi(); - retval = QSGRendererInterface::isApiRhiBased(api); + if (QTest::qWaitForWindowExposed(&dummy)) { + QSGRendererInterface::GraphicsApi api = dummy.rendererInterface()->graphicsApi(); + retval = QSGRendererInterface::isApiRhiBased(api); + } dummy.hide(); } return retval; diff --git a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp index bf582b820b..58bc3d40b5 100644 --- a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp +++ b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp @@ -136,7 +136,6 @@ void tst_MptaInterop::touchDrag() // TODO touchesThenPinch_data with press/release sequences somehow: vectors of touchpoint IDs? or a string representation? void tst_MptaInterop::touchesThenPinch() { - const int dragThreshold = QGuiApplication::styleHints()->startDragDistance(); QScopedPointer<QQuickView> windowPtr; createView(windowPtr, "pinchDragMPTA.qml"); QQuickView * window = windowPtr.data(); diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp index c5fdb6c1b9..d1f6d67aa1 100644 --- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp +++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp @@ -338,7 +338,7 @@ void tst_QQuickAccessible::basicPropertiesTest() QCOMPARE(text2->rect().y(), item->rect().y() + 40); QCOMPARE(text2->role(), QAccessible::StaticText); QCOMPARE(item->indexOfChild(text2), 1); - QCOMPARE(text2->state().editable, 0); + QCOMPARE(text2->state().editable, 0u); QCOMPARE(text2->state().readOnly, 1); QCOMPARE(iface->indexOfChild(text2), -1); diff --git a/tests/auto/quick/qquickfontloader_static/tst_qquickfontloader_static.cpp b/tests/auto/quick/qquickfontloader_static/tst_qquickfontloader_static.cpp index c0f66bd709..7e848ef2fc 100644 --- a/tests/auto/quick/qquickfontloader_static/tst_qquickfontloader_static.cpp +++ b/tests/auto/quick/qquickfontloader_static/tst_qquickfontloader_static.cpp @@ -59,6 +59,8 @@ int main(int argc, char **argv) component.setData(qmltemplate, current); window.setContent(current, &component, component.create()); window.show(); - QTest::qWaitForWindowActive(&window); + if (!QTest::qWaitForWindowActive(&window)) + return EXIT_FAILURE; } + return 0; } diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index c722f2fc2c..34c18aa64b 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -1107,7 +1107,7 @@ class MyInterceptor : public QQmlAbstractUrlInterceptor { public: MyInterceptor(QUrl url) : QQmlAbstractUrlInterceptor(), m_url(url) {} - QUrl intercept(const QUrl &url, QQmlAbstractUrlInterceptor::DataType type) + QUrl intercept(const QUrl &url, QQmlAbstractUrlInterceptor::DataType) { if (url.scheme() == "interceptthis") return m_url; diff --git a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp index c79e665d94..9dc9ad53ea 100644 --- a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp +++ b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp @@ -669,7 +669,7 @@ public: emit finished(); } - QQuickTextureFactory *textureFactory() const + QQuickTextureFactory *textureFactory() const override { QImage image(50, 50, QImage::Format_RGB32); auto texture = QQuickTextureFactory::textureFactoryForImage(image); @@ -696,7 +696,7 @@ public: ~WaitingAsyncProvider() {} - QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) + QQuickImageResponse *requestImageResponse(const QString & /* id */, const QSize & /* requestedSize */) { auto response = new WaitingAsyncImageResponse(m_providerRemovedMutex, m_providerRemovedCond, m_providerRemoved, m_imageRequestedMutex, m_imageRequestedCondition, m_imageRequested); pool.start(response); diff --git a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp index fbe56abda5..19967efcd9 100644 --- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp +++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp @@ -50,7 +50,6 @@ using namespace QQuickViewTestUtil; using namespace QQuickVisualTestUtil; -static const char* kTableViewPropName = "tableView"; static const char* kDelegateObjectName = "tableViewDelegate"; static const char *kDelegatesCreatedCountProp = "delegatesCreatedCount"; static const char *kModelDataBindingProp = "modelDataBinding"; diff --git a/tests/auto/quick/rendernode/tst_rendernode.cpp b/tests/auto/quick/rendernode/tst_rendernode.cpp index d862e51dfa..6ca5231343 100644 --- a/tests/auto/quick/rendernode/tst_rendernode.cpp +++ b/tests/auto/quick/rendernode/tst_rendernode.cpp @@ -49,8 +49,7 @@ public: view.setResizeMode(QQuickView::SizeViewToRootObject); view.setSource(testFileUrl(fileName)); view.setVisible(true); - QTest::qWaitForWindowExposed(&view); - return view.grabWindow(); + return QTest::qWaitForWindowExposed(&view) ? view.grabWindow() : QImage(); } //It is important for platforms that only are able to show fullscreen windows @@ -225,6 +224,7 @@ void tst_rendernode::renderOrder() QSKIP("Render nodes not yet supported with QRhi"); QImage fb = runTest("RenderOrder.qml"); + QVERIFY(!fb.isNull()); const qreal scaleFactor = QGuiApplication::primaryScreen()->devicePixelRatio(); QCOMPARE(fb.width(), qRound(200 * scaleFactor)); @@ -257,6 +257,7 @@ void tst_rendernode::messUpState() QSKIP("Render nodes not yet supported with QRhi"); QImage fb = runTest("MessUpState.qml"); + QVERIFY(!fb.isNull()); int x1 = 0; int x2 = fb.width() / 2; int x3 = fb.width() - 1; @@ -318,7 +319,7 @@ void tst_rendernode::matrix() qmlRegisterType<StateRecordingRenderNodeItem>("RenderNode", 1, 0, "StateRecorder"); StateRecordingRenderNode::matrices.clear(); - runTest("matrix.qml"); + QVERIFY(!runTest("matrix.qml").isNull()); QMatrix4x4 noRotateOffset; noRotateOffset.translate(20, 20); @@ -371,9 +372,10 @@ bool tst_rendernode::isRunningOnRhi() const decided = true; QQuickView dummy; dummy.show(); - QTest::qWaitForWindowExposed(&dummy); - QSGRendererInterface::GraphicsApi api = dummy.rendererInterface()->graphicsApi(); - retval = QSGRendererInterface::isApiRhiBased(api); + if (QTest::qWaitForWindowExposed(&dummy)) { + QSGRendererInterface::GraphicsApi api = dummy.rendererInterface()->graphicsApi(); + retval = QSGRendererInterface::isApiRhiBased(api); + } dummy.hide(); } return retval; diff --git a/tests/auto/quick/scenegraph/tst_scenegraph.cpp b/tests/auto/quick/scenegraph/tst_scenegraph.cpp index c15f1e941e..3f605348c3 100644 --- a/tests/auto/quick/scenegraph/tst_scenegraph.cpp +++ b/tests/auto/quick/scenegraph/tst_scenegraph.cpp @@ -75,8 +75,8 @@ public: delete node; node = new QSGNode; - const int w = width(); - const int h = height(); + const int w = int(width()); + const int h = int(height()); QQuickWindow *win = window(); for (int y = 0; y < h; ++y) { for (int x = 0; x < w; ++x) { @@ -569,8 +569,8 @@ bool tst_SceneGraph::isRunningOnOpenGLDirectly() decided = true; QQuickView dummy; dummy.show(); - QTest::qWaitForWindowExposed(&dummy); - retval = dummy.rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL; + if (QTest::qWaitForWindowExposed(&dummy)) + retval = dummy.rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL; dummy.hide(); } return retval; |