aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2012-12-19 16:18:52 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-20 15:44:48 +0100
commit920b949e5185258baabfb3f738b660b3c0f002e3 (patch)
tree702fa5cb06854a1c213e896fd38edbcf912d4731
parentad821a63bf4075f2b18ec9eaa6d58f8fd721269a (diff)
Fix compiler warnings in declarative tests.
- Unused variables - Missing enumeration values in switch - truncation from double to float - truncation from size_t to int - Missing initializers - Mix of operator & and bool | Change-Id: Ib212aeea41befef193f12300a1d9814a60f183af Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp2
-rw-r--r--tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp2
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp1
-rw-r--r--tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp14
-rw-r--r--tests/auto/qml/qqmllanguage/testtypes.h2
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp11
-rw-r--r--tests/auto/qml/qqmlqt/tst_qqmlqt.cpp16
-rw-r--r--tests/auto/quick/geometry/tst_geometry.cpp6
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp1
-rw-r--r--tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp2
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp3
-rw-r--r--tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp2
12 files changed, 31 insertions, 31 deletions
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
index 5848b42028..92f48f398f 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -85,7 +85,7 @@ private slots:
void reloadQmlWindow();
};
-void tst_QQmlInspector::startQmlsceneProcess(const char *qmlFile)
+void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */)
{
const QString argument = "-qmljsdebugger=port:" STR_PORT ",block";
diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
index b9e31d2216..a7ef405aa3 100644
--- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
+++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
@@ -231,7 +231,7 @@ class TestObject : public QObject
Q_PROPERTY(bool ran READ ran WRITE setRan)
public:
- TestObject(QObject *parent = 0) : m_ran(false) {}
+ TestObject(QObject *parent = 0) : QObject(parent), m_ran(false) {}
~TestObject() {}
bool ran() const { return m_ran; }
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 1cf8e13c3c..bca76a7bc9 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -3801,6 +3801,7 @@ void tst_qqmlecmascript::verifyContextLifetime(QQmlContextData *ctxt) {
v8::Persistent<v8::Context> context = v8::Context::New();
v8::Context::Scope context_scope(context);
v8::Local<v8::Object> temporaryScope = engine->qmlScope(scriptContext, NULL);
+ Q_UNUSED(temporaryScope)
context.Dispose();
}
diff --git a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
index 7d27751e77..591d4722e2 100644
--- a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
+++ b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
@@ -128,14 +128,14 @@ void tst_qqmlinstruction::dump()
{
QQmlCompiledData::Instruction::StoreFloat i;
i.propertyIndex = 3;
- i.value = 11.3;
+ i.value = 11.3f;
data->addInstruction(i);
}
{
QQmlCompiledData::Instruction::StoreDouble i;
i.propertyIndex = 4;
- i.value = 14.8;
+ i.value = 14.8f;
data->addInstruction(i);
}
@@ -676,8 +676,8 @@ void tst_qqmlinstruction::vector3d()
QCOMPARE(Q_ALIGNOF(QQmlInstruction::instr_storeVector3D::QVector3D), Q_ALIGNOF(QVector3D));
QQmlInstruction i;
- i.storeVector3D.vector.xp = 8.2;
- i.storeVector3D.vector.yp = 99.3;
+ i.storeVector3D.vector.xp = 8.2f;
+ i.storeVector3D.vector.yp = 99.3f;
i.storeVector3D.vector.zp = 12.0;
const QVector3D &vector = (const QVector3D &)(i.storeVector3D.vector);
@@ -692,10 +692,10 @@ void tst_qqmlinstruction::vector4d()
QCOMPARE(Q_ALIGNOF(QQmlInstruction::instr_storeVector4D::QVector4D), Q_ALIGNOF(QVector4D));
QQmlInstruction i;
- i.storeVector4D.vector.xp = 8.2;
- i.storeVector4D.vector.yp = 99.3;
+ i.storeVector4D.vector.xp = 8.2f;
+ i.storeVector4D.vector.yp = 99.3f;
i.storeVector4D.vector.zp = 12.0;
- i.storeVector4D.vector.wp = 121.1;
+ i.storeVector4D.vector.wp = 121.1f;
const QVector4D &vector = (const QVector4D &)(i.storeVector4D.vector);
QCOMPARE(vector.x(), (qreal)(float)8.2);
diff --git a/tests/auto/qml/qqmllanguage/testtypes.h b/tests/auto/qml/qqmllanguage/testtypes.h
index bd6205cbdf..e83e9e11ac 100644
--- a/tests/auto/qml/qqmllanguage/testtypes.h
+++ b/tests/auto/qml/qqmllanguage/testtypes.h
@@ -939,7 +939,7 @@ class MyUncreateableBaseClass : public QObject
Q_PROPERTY(bool prop2 READ prop2 WRITE setprop2 REVISION 1)
Q_PROPERTY(bool prop3 READ prop3 WRITE setprop3 REVISION 1)
public:
- explicit MyUncreateableBaseClass(bool arg, QObject *parent = 0)
+ explicit MyUncreateableBaseClass(bool /* arg */, QObject *parent = 0)
: QObject(parent), _prop1(false), _prop2(false), _prop3(false)
{
}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 3f5f5f2785..bd92c68f8e 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -596,8 +596,8 @@ void tst_qqmllanguage::assignBasicTypes()
QCOMPARE(object->rectFProperty(), QRectF(1000.1, -10.9, 400, 90.99));
QCOMPARE(object->boolProperty(), true);
QCOMPARE(object->variantProperty(), QVariant("Hello World!"));
- QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2));
- QCOMPARE(object->vector4Property(), QVector4D(10, 1, 2.2, 2.3));
+ QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2f));
+ QCOMPARE(object->vector4Property(), QVector4D(10, 1, 2.2f, 2.3f));
QUrl encoded;
encoded.setEncodedUrl("main.qml?with%3cencoded%3edata", QUrl::TolerantMode);
QCOMPARE(object->urlProperty(), component.url().resolved(encoded));
@@ -2571,7 +2571,7 @@ void tst_qqmllanguage::importJs()
QCOMPARE(expected.size(), actual.size());
for (int i = 0; i < expected.size(); ++i)
{
- size_t compareLen = std::min(expected.at(i).length(), actual.at(i).length());
+ const int compareLen = qMin(expected.at(i).length(), actual.at(i).length());
QCOMPARE(expected.at(i).left(compareLen), actual.at(i).left(compareLen));
}
}
@@ -2948,13 +2948,12 @@ void tst_qqmllanguage::signalWithDefaultArg()
QCOMPARE(object->property("signalCount").toInt(), 2);
QCOMPARE(object->property("signalArg").toInt(), 15);
- const QMetaObject *metaObject = object->metaObject();
- metaObject->invokeMethod(object, "emitNoArgSignal");
+ QMetaObject::invokeMethod(object, "emitNoArgSignal");
QCOMPARE(object->property("signalCount").toInt(), 3);
QCOMPARE(object->property("signalArg").toInt(), 5);
- metaObject->invokeMethod(object, "emitArgSignal");
+ QMetaObject::invokeMethod(object, "emitArgSignal");
QCOMPARE(object->property("signalCount").toInt(), 4);
QCOMPARE(object->property("signalArg").toInt(), 22);
diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
index 22be661755..9a525df973 100644
--- a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
+++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
@@ -320,8 +320,8 @@ void tst_qqmlqt::vector2d()
QObject *object = component.create();
QVERIFY(object != 0);
- QCOMPARE(qvariant_cast<QVector2D>(object->property("test1")), QVector2D(1, 0.9));
- QCOMPARE(qvariant_cast<QVector2D>(object->property("test2")), QVector2D(102, -982.1));
+ QCOMPARE(qvariant_cast<QVector2D>(object->property("test1")), QVector2D(1, 0.9f));
+ QCOMPARE(qvariant_cast<QVector2D>(object->property("test2")), QVector2D(102, -982.1f));
QCOMPARE(qvariant_cast<QVector2D>(object->property("test3")), QVector2D());
QCOMPARE(qvariant_cast<QVector2D>(object->property("test4")), QVector2D());
@@ -340,8 +340,8 @@ void tst_qqmlqt::vector3d()
QObject *object = component.create();
QVERIFY(object != 0);
- QCOMPARE(qvariant_cast<QVector3D>(object->property("test1")), QVector3D(1, 0, 0.9));
- QCOMPARE(qvariant_cast<QVector3D>(object->property("test2")), QVector3D(102, -10, -982.1));
+ QCOMPARE(qvariant_cast<QVector3D>(object->property("test1")), QVector3D(1, 0, 0.9f));
+ QCOMPARE(qvariant_cast<QVector3D>(object->property("test2")), QVector3D(102, -10, -982.1f));
QCOMPARE(qvariant_cast<QVector3D>(object->property("test3")), QVector3D());
QCOMPARE(qvariant_cast<QVector3D>(object->property("test4")), QVector3D());
@@ -360,8 +360,8 @@ void tst_qqmlqt::vector4d()
QObject *object = component.create();
QVERIFY(object != 0);
- QCOMPARE(qvariant_cast<QVector4D>(object->property("test1")), QVector4D(1, 0, 0.9, 0.6));
- QCOMPARE(qvariant_cast<QVector4D>(object->property("test2")), QVector4D(102, -10, -982.1, 10));
+ QCOMPARE(qvariant_cast<QVector4D>(object->property("test1")), QVector4D(1, 0, 0.9f, 0.6f));
+ QCOMPARE(qvariant_cast<QVector4D>(object->property("test2")), QVector4D(102, -10, -982.1f, 10));
QCOMPARE(qvariant_cast<QVector4D>(object->property("test3")), QVector4D());
QCOMPARE(qvariant_cast<QVector4D>(object->property("test4")), QVector4D());
@@ -380,8 +380,8 @@ void tst_qqmlqt::quaternion()
QObject *object = component.create();
QVERIFY(object != 0);
- QCOMPARE(qvariant_cast<QQuaternion>(object->property("test1")), QQuaternion(2, 17, 0.9, 0.6));
- QCOMPARE(qvariant_cast<QQuaternion>(object->property("test2")), QQuaternion(102, -10, -982.1, 10));
+ QCOMPARE(qvariant_cast<QQuaternion>(object->property("test1")), QQuaternion(2, 17, 0.9f, 0.6f));
+ QCOMPARE(qvariant_cast<QQuaternion>(object->property("test2")), QQuaternion(102, -10, -982.1f, 10));
QCOMPARE(qvariant_cast<QQuaternion>(object->property("test3")), QQuaternion());
QCOMPARE(qvariant_cast<QQuaternion>(object->property("test4")), QQuaternion());
diff --git a/tests/auto/quick/geometry/tst_geometry.cpp b/tests/auto/quick/geometry/tst_geometry.cpp
index 8bf65d1638..fc5e921db5 100644
--- a/tests/auto/quick/geometry/tst_geometry.cpp
+++ b/tests/auto/quick/geometry/tst_geometry.cpp
@@ -139,9 +139,9 @@ void GeometryTest::testCustomGeometry()
};
static QSGGeometry::Attribute attributes[] = {
- { 0, 2, GL_FLOAT },
- { 1, 4, GL_UNSIGNED_BYTE },
- { 2, 4, GL_FLOAT },
+ { 0, 2, GL_FLOAT, 0, 0},
+ { 1, 4, GL_UNSIGNED_BYTE, 0, 0},
+ { 2, 4, GL_FLOAT, 0, 0},
};
static QSGGeometry::AttributeSet set = { 4, 6 * sizeof(float) + 4 * sizeof(unsigned char), attributes };
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 37d96f4950..dc0db6d4ff 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -292,6 +292,7 @@ private:
}
void releaseView(QQuickView *view) {
Q_ASSERT(view == m_view);
+ Q_UNUSED(view)
m_view->setSource(QUrl());
}
#else
diff --git a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
index 64eb0a7f42..19b547944c 100644
--- a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
+++ b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
@@ -236,7 +236,7 @@ void tst_qquickimageprovider::runTest(bool async, QQuickImageProvider *provider)
// From this point on, treat forced async providers as async behaviour-wise
if (engine.imageProvider(QUrl(source).host()) == provider)
- async |= provider->flags() & QQuickImageProvider::ForceAsynchronousImageLoading;
+ async |= (provider->flags() & QQuickImageProvider::ForceAsynchronousImageLoading) != 0;
if (async)
QTRY_VERIFY(obj->status() == QQuickImage::Loading);
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
index d6b501c619..76768ee395 100644
--- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -1285,7 +1285,6 @@ void tst_QQuickMouseArea::pressedMultipleButtons()
QPoint point(10,10);
- int prevButtons = 0;
for (int i = 0; i < buttons.count(); ++i) {
int btns = buttons.at(i);
@@ -1294,8 +1293,6 @@ void tst_QQuickMouseArea::pressedMultipleButtons()
QCOMPARE(mouseArea->pressed(), pressed.at(i));
QCOMPARE(mouseArea->pressedButtons(), pressedButtons.at(i));
-
- prevButtons = buttons.at(i);
}
QTest::mousePress(view, Qt::NoButton, 0, point);
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
index ea2ad71bfc..f8332d661d 100644
--- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
+++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
@@ -2139,6 +2139,8 @@ void tst_qquicktextedit::positionAt()
case QQuickTextEdit::AlignRight:
xoff = texteditObject->width() - secondLine.naturalTextWidth();
break;
+ case QQuickTextEdit::AlignJustify:
+ break;
}
int pos = texteditObject->positionAt(texteditObject->width()/2, y0);