diff options
-rw-r--r-- | src/declarative/qml/qmlcontextscriptclass.cpp | 1 | ||||
-rw-r--r-- | src/declarative/qml/qmlglobalscriptclass.cpp | 19 | ||||
-rw-r--r-- | src/declarative/qml/qmllistscriptclass.cpp | 15 | ||||
-rw-r--r-- | tests/auto/declarative/examples/data/dummytest.qml | 1 | ||||
-rw-r--r-- | tests/auto/declarative/examples/data/webbrowser/webbrowser.qml | 2 | ||||
-rw-r--r-- | tests/auto/declarative/examples/tst_examples.cpp | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp | 8 | ||||
-rw-r--r-- | tools/qmlviewer/qfxtester.cpp | 8 | ||||
-rw-r--r-- | tools/qmlviewer/qmlviewer.cpp | 4 |
9 files changed, 37 insertions, 26 deletions
diff --git a/src/declarative/qml/qmlcontextscriptclass.cpp b/src/declarative/qml/qmlcontextscriptclass.cpp index 4615764..fda284a 100644 --- a/src/declarative/qml/qmlcontextscriptclass.cpp +++ b/src/declarative/qml/qmlcontextscriptclass.cpp @@ -219,6 +219,7 @@ QScriptValue QmlContextScriptClass::property(Object *object, const Identifier &n void QmlContextScriptClass::setProperty(Object *object, const Identifier &name, const QScriptValue &value) { + Q_UNUSED(object); Q_ASSERT(lastScopeObject || lastDefaultObject != -1); QmlContext *bindContext = lastContext; diff --git a/src/declarative/qml/qmlglobalscriptclass.cpp b/src/declarative/qml/qmlglobalscriptclass.cpp index a9c5d3d..fd270e3 100644 --- a/src/declarative/qml/qmlglobalscriptclass.cpp +++ b/src/declarative/qml/qmlglobalscriptclass.cpp @@ -70,10 +70,10 @@ QmlGlobalScriptClass::queryProperty(const QScriptValue &object, const QScriptString &name, QueryFlags flags, uint *id) { - Q_UNUSED(object) - Q_UNUSED(name) - Q_UNUSED(flags) - Q_UNUSED(id) + Q_UNUSED(object); + Q_UNUSED(name); + Q_UNUSED(flags); + Q_UNUSED(id); return HandlesReadAccess | HandlesWriteAccess; } @@ -82,9 +82,9 @@ QmlGlobalScriptClass::property(const QScriptValue &object, const QScriptString &name, uint id) { - Q_UNUSED(object) - Q_UNUSED(name) - Q_UNUSED(id) + Q_UNUSED(object); + Q_UNUSED(name); + Q_UNUSED(id); return engine()->undefinedValue(); } @@ -92,8 +92,9 @@ void QmlGlobalScriptClass::setProperty(QScriptValue &object, const QScriptString &name, uint id, const QScriptValue &value) { - Q_UNUSED(object) - Q_UNUSED(value) + Q_UNUSED(object); + Q_UNUSED(id); + Q_UNUSED(value); QString error = QLatin1String("Invalid write to global property \"") + name.toString() + QLatin1String("\""); engine()->currentContext()->throwError(error); diff --git a/src/declarative/qml/qmllistscriptclass.cpp b/src/declarative/qml/qmllistscriptclass.cpp index f067db6..a180e49 100644 --- a/src/declarative/qml/qmllistscriptclass.cpp +++ b/src/declarative/qml/qmllistscriptclass.cpp @@ -54,6 +54,7 @@ QmlListScriptClass::QmlListScriptClass(QmlEngine *e) : QScriptDeclarativeClass(QmlEnginePrivate::getScriptEngine(e)), engine(e) { QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); + Q_UNUSED(scriptEngine); m_lengthId = createPersistentIdentifier(QLatin1String("length")); } @@ -81,6 +82,8 @@ QScriptClass::QueryFlags QmlListScriptClass::queryProperty(Object *object, const Identifier &name, QScriptClass::QueryFlags flags) { + Q_UNUSED(object); + Q_UNUSED(flags); if (name == m_lengthId.identifier) return QScriptClass::HandlesReadAccess; @@ -115,9 +118,11 @@ QScriptValue QmlListScriptClass::property(Object *obj, const Identifier &name) if (data->type == QListPtr) { const QList<QObject *> &qlist = *((QList<QObject *>*)list); - if (name == m_lengthId.identifier) - return qlist.count(); - else if (lastIndex < qlist.count()) + quint32 count = qlist.count(); + + if (name == m_lengthId.identifier) + return count; + else if (lastIndex < count) return enginePriv->objectClass->newQObject(qlist.at(lastIndex)); else return scriptEngine->undefinedValue(); @@ -126,9 +131,9 @@ QScriptValue QmlListScriptClass::property(Object *obj, const Identifier &name) Q_ASSERT(data->type == QmlListPtr); const QmlList<QObject *> &qmllist = *((QmlList<QObject *>*)list); - int count = qmllist.count(); + quint32 count = qmllist.count(); - if (name == m_lengthId.identifier) + if (name == m_lengthId.identifier) return count; else if (lastIndex < count) return enginePriv->objectClass->newQObject(qmllist.at(lastIndex)); diff --git a/tests/auto/declarative/examples/data/dummytest.qml b/tests/auto/declarative/examples/data/dummytest.qml index cd9d8fb..b20e907 100644 --- a/tests/auto/declarative/examples/data/dummytest.qml +++ b/tests/auto/declarative/examples/data/dummytest.qml @@ -2,4 +2,5 @@ import Qt.VisualTest 4.6 VisualTest { Frame { msec: 0 } + Frame { msec: 10 } } diff --git a/tests/auto/declarative/examples/data/webbrowser/webbrowser.qml b/tests/auto/declarative/examples/data/webbrowser/webbrowser.qml index bdf3290..d31787b 100644 --- a/tests/auto/declarative/examples/data/webbrowser/webbrowser.qml +++ b/tests/auto/declarative/examples/data/webbrowser/webbrowser.qml @@ -2,5 +2,5 @@ import Qt.VisualTest 4.6 VisualTest { Frame { msec: 0 } - Frame { msec: 1000 } + Frame { msec: 2000 } } diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index d758101..2cbb916 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -182,9 +182,10 @@ void tst_examples::examples() QFileInfo fi(file); QFileInfo dir(fi.path()); - QFileInfo testdata("data/"+dir.baseName()+"/"+fi.baseName()); + QString script = "data/"+dir.baseName()+"/"+fi.baseName(); + QFileInfo testdata(script+".qml"); QStringList arguments; - arguments << "-script" << (testdata.exists() ? testdata.filePath() : QLatin1String("data/dummytest")) + arguments << "-script" << (testdata.exists() ? script : QLatin1String("data/dummytest")) << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" << file; QProcess p; diff --git a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp index 3e86cab..fc47d41 100644 --- a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp +++ b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp @@ -198,6 +198,8 @@ void tst_qmlgraphicstext::width() for (int i = 0; i < standard.size(); i++) { + QVERIFY(!Qt::mightBeRichText(standard.at(i))); // self-test + QFont f; QFontMetrics fm(f); int metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); @@ -208,11 +210,13 @@ void tst_qmlgraphicstext::width() QVERIFY(textObject != 0); QCOMPARE(textObject->width(), qreal(metricWidth)); - QVERIFY(textObject->textFormat() == QmlGraphicsText::PlainText); + QVERIFY(textObject->textFormat() == QmlGraphicsText::AutoText); // setting text doesn't change format } for (int i = 0; i < richText.size(); i++) { + QVERIFY(Qt::mightBeRichText(richText.at(i))); // self-test + QTextDocument document; document.setHtml(richText.at(i)); document.setDocumentMargin(0); @@ -225,7 +229,7 @@ void tst_qmlgraphicstext::width() QVERIFY(textObject != 0); QCOMPARE(textObject->width(), qreal(documentWidth)); - QVERIFY(textObject->textFormat() == QmlGraphicsText::RichText); + QVERIFY(textObject->textFormat() == QmlGraphicsText::AutoText); // setting text doesn't change format } } diff --git a/tools/qmlviewer/qfxtester.cpp b/tools/qmlviewer/qfxtester.cpp index 287771b..dfa628d 100644 --- a/tools/qmlviewer/qfxtester.cpp +++ b/tools/qmlviewer/qfxtester.cpp @@ -306,17 +306,15 @@ void QmlGraphicsTester::updateCurrentTime(int msec) QObject *event = testscript->event(testscriptidx); if (QmlGraphicsVisualTestFrame *frame = qobject_cast<QmlGraphicsVisualTestFrame *>(event)) { - if ((options & QmlViewer::TestImages) && (options & QmlViewer::Record)) - break; // recording and playing, no point "testing" results if (frame->msec() < msec) { - if (options & QmlViewer::TestImages) { + if (options & QmlViewer::TestImages && !(options & QmlViewer::Record)) { qWarning() << "QmlGraphicsTester: Extra frame. Seen:" << msec << "Expected:" << frame->msec(); imagefailure(); } } else if (frame->msec() == msec) { if (!frame->hash().isEmpty() && frame->hash().toUtf8() != fe.hash.toHex()) { - if (options & QmlViewer::TestImages) { + if (options & QmlViewer::TestImages && !(options & QmlViewer::Record)) { qWarning() << "QmlGraphicsTester: Mismatched frame hash. Seen:" << fe.hash.toHex() << "Expected:" << frame->hash().toUtf8(); @@ -327,7 +325,7 @@ void QmlGraphicsTester::updateCurrentTime(int msec) break; } - if (options & QmlViewer::TestImages && !frame->image().isEmpty()) { + if (options & QmlViewer::TestImages && !(options & QmlViewer::Record) && !frame->image().isEmpty()) { QImage goodImage(frame->image().toLocalFile()); if (goodImage != img) { QString reject(frame->image().toLocalFile() + ".reject.png"); diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index b9f3e67..b6a3627 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -366,7 +366,7 @@ QmlViewer::QmlViewer(QWidget *parent, Qt::WindowFlags flags) void QmlViewer::adjustSizeSlot() { - adjustSize(); + resize(sizeHint()); } QMenuBar *QmlViewer::menuBar() const @@ -722,7 +722,7 @@ void QmlViewer::openQml(const QString& file_or_url) canvas->updateGeometry(); if (mb) mb->updateGeometry(); - adjustSize(); + resize(sizeHint()); } else { if (scaleSkin) canvas->resize(canvas->sizeHint()); |