aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qml/qmllint/data/FromRoot.qml17
-rw-r--r--tests/auto/qml/qmllint/data/FromRootDirectParent.qml14
-rw-r--r--tests/auto/qml/qmllint/data/IdFromOuterSpace.qml9
-rw-r--r--tests/auto/qml/qmllint/data/SignalHandler.qml5
-rw-r--r--tests/auto/qml/qmllint/data/WithStatement.qml13
-rw-r--r--tests/auto/qml/qmllint/main.cpp45
-rw-r--r--tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp2
-rw-r--r--tests/auto/quick/drawingmodes/tst_drawingmodes.cpp7
-rw-r--r--tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp1
-rw-r--r--tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp2
-rw-r--r--tests/auto/quick/qquickfontloader_static/tst_qquickfontloader_static.cpp4
-rw-r--r--tests/auto/quick/qquickimage/tst_qquickimage.cpp2
-rw-r--r--tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp4
-rw-r--r--tests/auto/quick/qquicktableview/tst_qquicktableview.cpp1
-rw-r--r--tests/auto/quick/rendernode/tst_rendernode.cpp14
-rw-r--r--tests/auto/quick/scenegraph/tst_scenegraph.cpp8
17 files changed, 128 insertions, 22 deletions
diff --git a/tests/auto/qml/qmllint/data/FromRoot.qml b/tests/auto/qml/qmllint/data/FromRoot.qml
new file mode 100644
index 0000000000..021c09285e
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/FromRoot.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int unqualified: 42
+
+ Item {
+ Item {
+ x: unqualified // user defined property from root
+ }
+
+ QtObject {
+ property int check: x // existing property from root
+ }
+ }
+
+}
diff --git a/tests/auto/qml/qmllint/data/FromRootDirectParent.qml b/tests/auto/qml/qmllint/data/FromRootDirectParent.qml
new file mode 100644
index 0000000000..c0bfd0f26b
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/FromRootDirectParent.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int unqualified: 42
+
+ Item {
+ x: unqualified // user defined property from root
+ }
+
+ QtObject {
+ property int check: x // existing property from root
+ }
+}
diff --git a/tests/auto/qml/qmllint/data/IdFromOuterSpace.qml b/tests/auto/qml/qmllint/data/IdFromOuterSpace.qml
new file mode 100644
index 0000000000..774a1cfc7c
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/IdFromOuterSpace.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Item {
+ x: alien.x
+
+ Component.onCompleted: {
+ console.log(alien);
+ }
+}
diff --git a/tests/auto/qml/qmllint/data/SignalHandler.qml b/tests/auto/qml/qmllint/data/SignalHandler.qml
new file mode 100644
index 0000000000..bdf503e3dc
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/SignalHandler.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+MouseArea {
+ onDoubleClicked: console.log(mouse);
+}
diff --git a/tests/auto/qml/qmllint/data/WithStatement.qml b/tests/auto/qml/qmllint/data/WithStatement.qml
new file mode 100644
index 0000000000..5641f21eeb
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/WithStatement.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Item {
+ Item {
+ id: target
+ property int test: 42
+ }
+ Component.onCompleted: {
+ with(target) {
+ console.log(test);
+ }
+ }
+}
diff --git a/tests/auto/qml/qmllint/main.cpp b/tests/auto/qml/qmllint/main.cpp
index eedbd7c2f2..038826790b 100644
--- a/tests/auto/qml/qmllint/main.cpp
+++ b/tests/auto/qml/qmllint/main.cpp
@@ -38,6 +38,8 @@ private Q_SLOTS:
void initTestCase();
void test();
void test_data();
+ void testUnqualified();
+ void testUnqualified_data();
private:
QString m_qmllintPath;
};
@@ -69,6 +71,49 @@ void TestQmllint::test_data()
QTest::newRow("Invalid_syntax_JS") << QStringLiteral("failure1.js") << false;
}
+void TestQmllint::testUnqualified()
+{
+ QFETCH(QString, filename);
+ QFETCH(QString, warningMessage);
+ QFETCH(int, warningLine);
+ QFETCH(int, warningColumn);
+ filename.prepend(QStringLiteral("data/"));
+ QStringList args;
+ args << QStringLiteral("-U") << filename;
+
+ QProcess process;
+ process.start(m_qmllintPath, args);
+ QVERIFY(process.waitForFinished());
+ QVERIFY(process.exitStatus() == QProcess::NormalExit);
+ QVERIFY(process.exitCode());
+ QString output = process.readAllStandardError();
+ QVERIFY(output.contains(QString::asprintf("Warning: unqualified access at %d:%d", warningLine, warningColumn)));
+ QVERIFY(output.contains(warningMessage));
+}
+
+void TestQmllint::testUnqualified_data()
+{
+ QTest::addColumn<QString>("filename");
+ QTest::addColumn<QString>("warningMessage");
+ QTest::addColumn<int>("warningLine");
+ QTest::addColumn<int>("warningColumn");
+
+ // check for false positive due to and warning about with statement
+ QTest::newRow("WithStatement") << QStringLiteral("WithStatement.qml") << QStringLiteral("with statements are strongly discouraged") << 10 << 25;
+ // id from nowhere (as with setContextProperty)
+ QTest::newRow("IdFromOuterSpaceDirect") << QStringLiteral("IdFromOuterSpace.qml") << "alien.x" << 4 << 8;
+ QTest::newRow("IdFromOuterSpaceAccess") << QStringLiteral("IdFromOuterSpace.qml") << "console.log(alien)" << 7 << 21;
+ // access property of root object
+ QTest::newRow("FromRootDirect") << QStringLiteral("FromRoot.qml") << QStringLiteral("x: root.unqualified") << 9 << 16; // new property
+ QTest::newRow("FromRootAccess") << QStringLiteral("FromRoot.qml") << QStringLiteral("property int check: root.x") << 13 << 33; // builtin property
+ // access property of root object from direct child
+ QTest::newRow("FromRootDirectParentDirect") << QStringLiteral("FromRootDirectParent.qml") << QStringLiteral("x: parent.unqualified") << 8 << 12;
+ QTest::newRow("FromRootDirectParentAccess") << QStringLiteral("FromRootDirectParent.qml") << QStringLiteral("property int check: parent.x") << 12 << 29;
+ // access injected name from signal
+ QTest::newRow("SignalHandler") << QStringLiteral("SignalHandler.qml") << QStringLiteral("onDoubleClicked: function(mouse) {...") << 4 << 34;
+
+}
+
void TestQmllint::test()
{
QFETCH(QString, filename);
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;