diff options
106 files changed, 1016 insertions, 309 deletions
diff --git a/bin/rename-qtdeclarative-symbols.sh b/bin/rename-qtdeclarative-symbols.sh index c9a70128ca..78df8554cc 100755 --- a/bin/rename-qtdeclarative-symbols.sh +++ b/bin/rename-qtdeclarative-symbols.sh @@ -598,42 +598,43 @@ replaceMatch() for QML_SYMBOL in $QML_SYMBOLS do QML_REPLACEMENT="QQml${QML_SYMBOL#QDeclarative}" - replaceMatch "\<QtDeclarative/$QML_SYMBOL\>" "QtQml/$QML_REPLACEMENT" - replaceMatch "\<$QML_SYMBOL\>" "$QML_REPLACEMENT" + replaceMatch "\bQtDeclarative/$QML_SYMBOL\b" "QtQml/$QML_REPLACEMENT" + replaceMatch "\b$QML_SYMBOL\b" "$QML_REPLACEMENT" done for QUICK_SYMBOL in $QUICK_SYMBOLS do QUICK_REPLACEMENT="QQuick${QUICK_SYMBOL#QDeclarative}" - replaceMatch "\<QtDeclarative/$QUICK_SYMBOL\>" "QtQuick/$QUICK_REPLACEMENT" - replaceMatch "\<$QUICK_SYMBOL\>" "$QUICK_REPLACEMENT" + replaceMatch "\bQtDeclarative/$QUICK_SYMBOL\b" "QtQuick/$QUICK_REPLACEMENT" + replaceMatch "\b$QUICK_SYMBOL\b" "$QUICK_REPLACEMENT" done for QML_INCLUDE_FILE in $QML_INCLUDE_FILES do QML_INCLUDE_REPLACEMENT="qqml${QML_INCLUDE_FILE#qdeclarative}" - replaceMatch "\<$QML_INCLUDE_FILE\>" "$QML_INCLUDE_REPLACEMENT" + replaceMatch "\b$QML_INCLUDE_FILE\b" "$QML_INCLUDE_REPLACEMENT" done for QUICK_INCLUDE_FILE in $QUICK_INCLUDE_FILES do QUICK_INCLUDE_REPLACEMENT="qquick${QUICK_INCLUDE_FILE#qdeclarative}" - replaceMatch "\<$QUICK_INCLUDE_FILE\>" "$QUICK_INCLUDE_REPLACEMENT" + replaceMatch "\b$QUICK_INCLUDE_FILE\b" "$QUICK_INCLUDE_REPLACEMENT" done # Various one-off replacements -replaceMatch "\<QtDeclarative\>" "QtQml" -replaceMatch "\<asQDeclarativeContext" "asQQmlContext" +replaceMatch "\bQtDeclarative\b" "QtQml" +replaceMatch "\basQDeclarativeContext\b" "asQQmlContext" +replaceMatch "\basQDeclarativeContextPrivate\b" "asQQmlContextPrivate" # Replace any references to the 'declarative' module with 'qml' echo "Replacing module declarative with qml:" -CONTAINERS=$(find "$MODIFY_DIR" \( -name \*\.pro -o -name \*\.pri \) | xargs grep -l -I "\<declarative\>") +CONTAINERS=$(find "$MODIFY_DIR" \( -name \*\.pro -o -name \*\.pri \) | xargs grep -l -I "\bdeclarative\b") for CONTAINER in $CONTAINERS do echo " $CONTAINER" TMP_FILE="$CONTAINER.tmp" - sed 's|\<declarative\>|qml|g' <"$CONTAINER" >"$TMP_FILE" + sed 's|\bdeclarative\b|qml|g' <"$CONTAINER" >"$TMP_FILE" mv "$TMP_FILE" "$CONTAINER" done echo diff --git a/src/imports/testlib/SignalSpy.qml b/src/imports/testlib/SignalSpy.qml index 8b74132806..539cb178f5 100644 --- a/src/imports/testlib/SignalSpy.qml +++ b/src/imports/testlib/SignalSpy.qml @@ -92,7 +92,9 @@ Item { function qtest_update() { if (qtest_prevTarget != null) { - qtest_prevTarget[qtest_prevSignalName].disconnect(spy, "qtest_activated") + var prevFunc = qtest_prevTarget[qtest_prevSignalName] + if (prevFunc) + prevFunc.disconnect(spy.qtest_activated) qtest_prevTarget = null qtest_prevSignalName = "" } diff --git a/src/plugins/accessible/quick/qaccessiblequickitem.cpp b/src/plugins/accessible/quick/qaccessiblequickitem.cpp index 6c13377b3f..45db9fa795 100644 --- a/src/plugins/accessible/quick/qaccessiblequickitem.cpp +++ b/src/plugins/accessible/quick/qaccessiblequickitem.cpp @@ -95,7 +95,7 @@ QAccessibleInterface *QAccessibleQuickItem::parent() const // QQuickView::declarativeRoot. The former is the true root item, // but is not a part of the accessibility tree. Check if we hit // it here and return an interface for the scene instead. - if (parent == canvas->rootItem()) { + if (canvas && (parent == canvas->rootItem())) { return QAccessible::queryAccessibleInterface(canvas); } else { return QAccessible::queryAccessibleInterface(parent); diff --git a/src/plugins/accessible/quick/qaccessiblequickview.cpp b/src/plugins/accessible/quick/qaccessiblequickview.cpp index 042d8dcf06..1823dfea42 100644 --- a/src/plugins/accessible/quick/qaccessiblequickview.cpp +++ b/src/plugins/accessible/quick/qaccessiblequickview.cpp @@ -119,6 +119,11 @@ static QQuickItem *childAt_helper(QQuickItem *item, int x, int y) return 0; } + QScopedPointer<QAccessibleInterface> accessibleInterface(QAccessible::queryAccessibleInterface(item)); + if (accessibleInterface->childCount() == 0) { + return (itemScreenRect(item).contains(x, y)) ? item : 0; + } + QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); QList<QQuickItem *> children = itemPrivate->paintOrderChildItems(); diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp index 2bfc66fea0..a540382847 100644 --- a/src/qml/animations/qabstractanimationjob.cpp +++ b/src/qml/animations/qabstractanimationjob.cpp @@ -499,8 +499,9 @@ void QAbstractAnimationJob::finished() //TODO: update this code so it is valid to delete the animation in animationFinished for (int i = 0; i < changeListeners.count(); ++i) { const QAbstractAnimationJob::ChangeListener &change = changeListeners.at(i); - if (change.types & QAbstractAnimationJob::Completion) - change.listener->animationFinished(this); + if (change.types & QAbstractAnimationJob::Completion) { + RETURN_IF_DELETED(change.listener->animationFinished(this)); + } } if (m_group && (duration() == -1 || loopCount() < 0)) { @@ -513,8 +514,9 @@ void QAbstractAnimationJob::stateChanged(QAbstractAnimationJob::State newState, { for (int i = 0; i < changeListeners.count(); ++i) { const QAbstractAnimationJob::ChangeListener &change = changeListeners.at(i); - if (change.types & QAbstractAnimationJob::StateChange) - change.listener->animationStateChanged(this, newState, oldState); + if (change.types & QAbstractAnimationJob::StateChange) { + RETURN_IF_DELETED(change.listener->animationStateChanged(this, newState, oldState)); + } } } @@ -523,8 +525,9 @@ void QAbstractAnimationJob::currentLoopChanged(int currentLoop) Q_UNUSED(currentLoop); for (int i = 0; i < changeListeners.count(); ++i) { const QAbstractAnimationJob::ChangeListener &change = changeListeners.at(i); - if (change.types & QAbstractAnimationJob::CurrentLoop) - change.listener->animationCurrentLoopChanged(this); + if (change.types & QAbstractAnimationJob::CurrentLoop) { + RETURN_IF_DELETED(change.listener->animationCurrentLoopChanged(this)); + } } } diff --git a/src/qml/qml/qqmlcomponent_p.h b/src/qml/qml/qqmlcomponent_p.h index b03dd68936..dda5bd0b71 100644 --- a/src/qml/qml/qqmlcomponent_p.h +++ b/src/qml/qml/qqmlcomponent_p.h @@ -62,7 +62,7 @@ #include "qqmlvme_p.h" #include "qqmlerror.h" #include "qqml.h" -#include "../debugger/qqmlprofilerservice_p.h" +#include <private/qqmlprofilerservice_p.h> #include <QtCore/QString> #include <QtCore/QStringList> diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h index ad6a2aa055..b715d0c8f2 100644 --- a/src/qml/qml/qqmlmetatype_p.h +++ b/src/qml/qml/qqmlmetatype_p.h @@ -180,7 +180,6 @@ public: int attachedPropertiesId() const; int parserStatusCast() const; - QVariant fromObject(QObject *) const; const char *interfaceIId() const; int propertyValueSourceCast() const; int propertyValueInterceptorCast() const; diff --git a/src/qml/qml/v4/qv4bindings.cpp b/src/qml/qml/v4/qv4bindings.cpp index 4fd84945fc..93c7820ca2 100644 --- a/src/qml/qml/v4/qv4bindings.cpp +++ b/src/qml/qml/v4/qv4bindings.cpp @@ -1172,6 +1172,15 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks, } QML_V4_END_INSTR(MathCosReal, unaryop) + QML_V4_BEGIN_INSTR(MathAbsReal, unaryop) + { + const Register &src = registers[instr->unaryop.src]; + Register &output = registers[instr->unaryop.output]; + if (src.isUndefined()) output.setUndefined(); + else output.setqreal(qAbs(src.getqreal())); + } + QML_V4_END_INSTR(MathAbsReal, unaryop) + QML_V4_BEGIN_INSTR(MathRoundReal, unaryop) { const Register &src = registers[instr->unaryop.src]; @@ -1190,6 +1199,15 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks, } QML_V4_END_INSTR(MathFloorReal, unaryop) + QML_V4_BEGIN_INSTR(MathCeilReal, unaryop) + { + const Register &src = registers[instr->unaryop.src]; + Register &output = registers[instr->unaryop.output]; + if (src.isUndefined()) output.setUndefined(); + else output.setint(qCeil(src.getqreal())); + } + QML_V4_END_INSTR(MathCeilReal, unaryop) + QML_V4_BEGIN_INSTR(MathPIReal, unaryop) { static const qreal qmlPI = 2.0 * qAsin(1.0); @@ -1480,6 +1498,26 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks, } QML_V4_END_INSTR(StrictNotEqualString, binaryop) + QML_V4_BEGIN_INSTR(MathMaxReal, binaryop) + { + const Register &left = registers[instr->binaryop.left]; + const Register &right = registers[instr->binaryop.right]; + Register &output = registers[instr->binaryop.output]; + if (left.isUndefined() || right.isUndefined()) output.setUndefined(); + else output.setqreal(qMax(left.getqreal(), right.getqreal())); + } + QML_V4_END_INSTR(MathMaxReal, binaryop) + + QML_V4_BEGIN_INSTR(MathMinReal, binaryop) + { + const Register &left = registers[instr->binaryop.left]; + const Register &right = registers[instr->binaryop.right]; + Register &output = registers[instr->binaryop.output]; + if (left.isUndefined() || right.isUndefined()) output.setUndefined(); + else output.setqreal(qMin(left.getqreal(), right.getqreal())); + } + QML_V4_END_INSTR(MathMinReal, binaryop) + QML_V4_BEGIN_INSTR(NewString, construct) { Register &output = registers[instr->construct.reg]; diff --git a/src/qml/qml/v4/qv4compiler.cpp b/src/qml/qml/v4/qv4compiler.cpp index 608368afc2..620d260053 100644 --- a/src/qml/qml/v4/qv4compiler.cpp +++ b/src/qml/qml/v4/qv4compiler.cpp @@ -803,6 +803,12 @@ void QV4CompilerPrivate::visitCall(IR::Call *call) gen(i); } return; + case IR::MathAbsBuiltinFunction: { + Instr::MathAbsReal i; + i.output = i.src = currentReg; + gen(i); + } return; + case IR::MathRoundBultinFunction: { Instr::MathRoundReal i; i.output = i.src = currentReg; @@ -815,9 +821,49 @@ void QV4CompilerPrivate::visitCall(IR::Call *call) gen(i); } return; + case IR::MathCeilBuiltinFunction: { + Instr::MathCeilReal i; + i.output = i.src = currentReg; + gen(i); + } return; + case IR::MathPIBuiltinConstant: + default: break; } // switch + } else { + if (name->builtin == IR::MathMaxBuiltinFunction || + name->builtin == IR::MathMinBuiltinFunction) { + + //only handles the most common case of exactly two arguments + if (call->args && call->args->next && !call->args->next->next) { + IR::Expr *arg1 = call->args->expr; + IR::Expr *arg2 = call->args->next->expr; + + if (arg1 != 0 && arg1->type == IR::RealType && + arg2 != 0 && arg2->type == IR::RealType) { + + traceExpression(arg1, currentReg); + traceExpression(arg2, currentReg + 1); + + if (name->builtin == IR::MathMaxBuiltinFunction) { + Instr::MathMaxReal i; + i.left = currentReg; + i.right = currentReg + 1; + i.output = currentReg; + gen(i); + return; + } else if (name->builtin == IR::MathMinBuiltinFunction) { + Instr::MathMinReal i; + i.left = currentReg; + i.right = currentReg + 1; + i.output = currentReg; + gen(i); + return; + } + } + } + } } } diff --git a/src/qml/qml/v4/qv4instruction.cpp b/src/qml/qml/v4/qv4instruction.cpp index efbd2b2c1c..a392c9392c 100644 --- a/src/qml/qml/v4/qv4instruction.cpp +++ b/src/qml/qml/v4/qv4instruction.cpp @@ -195,12 +195,18 @@ void Bytecode::dump(const V4Instr *i, int address) const case V4Instr::MathCosReal: INSTR_DUMP << "\t" << "MathCosReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; break; + case V4Instr::MathAbsReal: + INSTR_DUMP << "\t" << "MathAbsReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; + break; case V4Instr::MathRoundReal: INSTR_DUMP << "\t" << "MathRoundReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; break; case V4Instr::MathFloorReal: INSTR_DUMP << "\t" << "MathFloorReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; break; + case V4Instr::MathCeilReal: + INSTR_DUMP << "\t" << "MathCeilReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; + break; case V4Instr::MathPIReal: INSTR_DUMP << "\t" << "MathPIReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; break; @@ -306,6 +312,12 @@ void Bytecode::dump(const V4Instr *i, int address) const case V4Instr::StrictNotEqualString: INSTR_DUMP << "\t" << "StrictNotEqualString" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")"; break; + case V4Instr::MathMaxReal: + INSTR_DUMP << "\t" << "MathMaxReal" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")"; + break; + case V4Instr::MathMinReal: + INSTR_DUMP << "\t" << "MathMinReal" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")"; + break; case V4Instr::NewString: INSTR_DUMP << "\t" << "NewString" << "\t\t" << "Register(" << i->construct.reg << ")"; break; diff --git a/src/qml/qml/v4/qv4instruction_p.h b/src/qml/qml/v4/qv4instruction_p.h index 964c95513f..9727c23959 100644 --- a/src/qml/qml/v4/qv4instruction_p.h +++ b/src/qml/qml/v4/qv4instruction_p.h @@ -100,8 +100,10 @@ QT_BEGIN_NAMESPACE F(ResolveUrl, unaryop) \ F(MathSinReal, unaryop) \ F(MathCosReal, unaryop) \ + F(MathAbsReal, unaryop) \ F(MathRoundReal, unaryop) \ F(MathFloorReal, unaryop) \ + F(MathCeilReal, unaryop) \ F(MathPIReal, unaryop) \ F(LoadReal, real_value) \ F(LoadInt, int_value) \ @@ -137,6 +139,8 @@ QT_BEGIN_NAMESPACE F(NotEqualString, binaryop) \ F(StrictEqualString, binaryop) \ F(StrictNotEqualString, binaryop) \ + F(MathMaxReal, binaryop) \ + F(MathMinReal, binaryop) \ F(NewString, construct) \ F(NewUrl, construct) \ F(CleanupRegister, cleanup) \ diff --git a/src/qml/qml/v4/qv4ir.cpp b/src/qml/qml/v4/qv4ir.cpp index 68175d3bf4..54679c3d8c 100644 --- a/src/qml/qml/v4/qv4ir.cpp +++ b/src/qml/qml/v4/qv4ir.cpp @@ -219,10 +219,18 @@ void Name::init(Name *base, Type type, const QString *id, Symbol symbol, quint32 builtin = MathSinBultinFunction; } else if (id->length() == 8 && *id == QLatin1String("Math.cos")) { builtin = MathCosBultinFunction; + } else if (id->length() == 8 && *id == QLatin1String("Math.abs")) { + builtin = MathAbsBuiltinFunction; } else if (id->length() == 10 && *id == QLatin1String("Math.round")) { builtin = MathRoundBultinFunction; } else if (id->length() == 10 && *id == QLatin1String("Math.floor")) { builtin = MathFloorBultinFunction; + } else if (id->length() == 9 && *id == QLatin1String("Math.ceil")) { + builtin = MathCeilBuiltinFunction; + } else if (id->length() == 8 && *id == QLatin1String("Math.max")) { + builtin = MathMaxBuiltinFunction; + } else if (id->length() == 8 && *id == QLatin1String("Math.min")) { + builtin = MathMinBuiltinFunction; } else if (id->length() == 7 && *id == QLatin1String("Math.PI")) { builtin = MathPIBuiltinConstant; this->type = RealType; @@ -353,10 +361,14 @@ Type Call::typeForFunction(Expr *base) switch (name->builtin) { case MathSinBultinFunction: case MathCosBultinFunction: + case MathAbsBuiltinFunction: //### type could also be Int if input was Int + case MathMaxBuiltinFunction: + case MathMinBuiltinFunction: return RealType; case MathRoundBultinFunction: case MathFloorBultinFunction: + case MathCeilBuiltinFunction: return IntType; case NoBuiltinSymbol: diff --git a/src/qml/qml/v4/qv4ir_p.h b/src/qml/qml/v4/qv4ir_p.h index 3d3288b65f..79f50cd6c9 100644 --- a/src/qml/qml/v4/qv4ir_p.h +++ b/src/qml/qml/v4/qv4ir_p.h @@ -239,6 +239,10 @@ enum BuiltinSymbol { MathCosBultinFunction, MathRoundBultinFunction, MathFloorBultinFunction, + MathCeilBuiltinFunction, + MathAbsBuiltinFunction, + MathMaxBuiltinFunction, + MathMinBuiltinFunction, MathPIBuiltinConstant }; diff --git a/src/qml/qml/v4/qv4irbuilder.cpp b/src/qml/qml/v4/qv4irbuilder.cpp index 36e88e5276..06f4024423 100644 --- a/src/qml/qml/v4/qv4irbuilder.cpp +++ b/src/qml/qml/v4/qv4irbuilder.cpp @@ -628,7 +628,8 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast) case IR::Name::Property: if (baseName->type == IR::ObjectType && baseName->meta && baseName->property->isFinal()) { - QQmlPropertyCache *cache = m_engine->cache(baseName->meta); + const QMetaObject *meta = m_engine->metaObjectForType(baseName->property->propType); + QQmlPropertyCache *cache = m_engine->cache(meta); if (!cache) return false; @@ -640,9 +641,9 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast) return false; // We don't know enough about this property } - IR::Type irType = irTypeFromVariantType(data->propType, m_engine, baseName->meta); + IR::Type irType = irTypeFromVariantType(data->propType, m_engine, meta); _expr.code = _block->SYMBOL(baseName, irType, name, - baseName->meta, data, line, column); + meta, data, line, column); } } break; diff --git a/src/qmltest/qmltest.pro b/src/qmltest/qmltest.pro index d2e90c2b5d..b1c99d2739 100644 --- a/src/qmltest/qmltest.pro +++ b/src/qmltest/qmltest.pro @@ -7,7 +7,7 @@ CONFIG += module CONFIG += dll warn_on declarative_debug MODULE_PRI += ../../modules/qt_qmltest.pri -QT += testlib-private qml testlib quick widgets widgets-private gui +QT += testlib testlib-private qml quick gui DEFINES += QT_BUILD_QUICK_TEST_LIB QT_NO_URL_CAST_FROM_STRING load(qt_module_config) @@ -34,4 +34,3 @@ HEADERS += \ DEFINES += QT_BUILD_QUICK_TEST_LIB - diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index e6c27eec00..2e32a60b2d 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -43,14 +43,10 @@ #include "quicktestresult_p.h" #include <QtTest/qtestsystem.h> #include "qtestoptions_p.h" -#include <QApplication> #include <QtQml/qqml.h> #include <QtQml/qqmlengine.h> #include <QtQml/qqmlcontext.h> -#if defined(QML_VERSION) && QML_VERSION >= 0x020000 #include <QtQuick/qquickview.h> -#define QUICK_TEST_SCENEGRAPH 1 -#endif #include <QtQml/qjsvalue.h> #include <QtQml/qjsengine.h> #include <QtGui/qopengl.h> @@ -160,12 +156,10 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport // Look for QML-specific command-line options. // -import dir Specify an import directory. // -input dir Specify the input directory for test cases. - // -qtquick1 Run with QtQuick 1 rather than QtQuick 2. // -translation file Specify the translation file. QStringList imports; QString testPath; QString translationFile; - bool qtQuick2 = true; int outargc = 1; int index = 1; while (index < argc) { @@ -177,9 +171,6 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport index += 2; } else if (strcmp(argv[index], "-opengl") == 0) { ++index; - } else if (strcmp(argv[index], "-qtquick1") == 0) { - qtQuick2 = false; - ++index; } else if (strcmp(argv[index], "-translation") == 0 && (index + 1) < argc) { translationFile = stripQuotes(QString::fromLocal8Bit(argv[index + 1])); index += 2; @@ -255,57 +246,49 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport // Scan through all of the "tst_*.qml" files and run each of them // in turn with a QQuickView. -#ifdef QUICK_TEST_SCENEGRAPH - if (qtQuick2) { - QQuickView view; - QTestRootObject rootobj; - QEventLoop eventLoop; - QObject::connect(view.engine(), SIGNAL(quit()), - &rootobj, SLOT(quit())); - QObject::connect(view.engine(), SIGNAL(quit()), - &eventLoop, SLOT(quit())); - view.rootContext()->setContextProperty - (QLatin1String("qtest"), &rootobj); - foreach (const QString &path, imports) - view.engine()->addImportPath(path); + QQuickView view; + QTestRootObject rootobj; + QEventLoop eventLoop; + QObject::connect(view.engine(), SIGNAL(quit()), + &rootobj, SLOT(quit())); + QObject::connect(view.engine(), SIGNAL(quit()), + &eventLoop, SLOT(quit())); + view.rootContext()->setContextProperty + (QLatin1String("qtest"), &rootobj); + foreach (const QString &path, imports) + view.engine()->addImportPath(path); - foreach (QString file, files) { - QFileInfo fi(file); - if (!fi.exists()) - continue; + foreach (QString file, files) { + QFileInfo fi(file); + if (!fi.exists()) + continue; - rootobj.setHasTestCase(false); - rootobj.setWindowShown(false); - rootobj.hasQuit = false; - QString path = fi.absoluteFilePath(); - if (path.startsWith(QLatin1String(":/"))) - view.setSource(QUrl(QLatin1String("qrc:") + path.mid(2))); - else - view.setSource(QUrl::fromLocalFile(path)); + rootobj.setHasTestCase(false); + rootobj.setWindowShown(false); + rootobj.hasQuit = false; + QString path = fi.absoluteFilePath(); + if (path.startsWith(QLatin1String(":/"))) + view.setSource(QUrl(QLatin1String("qrc:") + path.mid(2))); + else + view.setSource(QUrl::fromLocalFile(path)); - if (QTest::printAvailableFunctions) - continue; - if (view.status() == QQuickView::Error) { - handleCompileErrors(fi, view); - continue; - } - if (!rootobj.hasQuit) { - // If the test already quit, then it was performed - // synchronously during setSource(). Otherwise it is - // an asynchronous test and we need to show the window - // and wait for the quit indication. - view.show(); - QTest::qWaitForWindowShown(&view); - rootobj.setWindowShown(true); - if (!rootobj.hasQuit && rootobj.hasTestCase()) - eventLoop.exec(); - } + if (QTest::printAvailableFunctions) + continue; + if (view.status() == QQuickView::Error) { + handleCompileErrors(fi, view); + continue; + } + if (!rootobj.hasQuit) { + // If the test already quit, then it was performed + // synchronously during setSource(). Otherwise it is + // an asynchronous test and we need to show the window + // and wait for the quit indication. + view.show(); + QTest::qWaitForWindowShown(&view); + rootobj.setWindowShown(true); + if (!rootobj.hasQuit && rootobj.hasTestCase()) + eventLoop.exec(); } - } else -#endif - { - qWarning("No suitable QtQuick1 implementation is available!"); - return 1; } // Flush the current logging stream. diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp index f996adbeca..94051711f1 100644 --- a/src/qmltest/quicktestevent.cpp +++ b/src/qmltest/quicktestevent.cpp @@ -42,12 +42,8 @@ #include "quicktestevent_p.h" #include <QtTest/qtestkeyboard.h> #include <QtQml/qqml.h> -#if defined(QML_VERSION) && QML_VERSION >= 0x020000 #include <QtQuick/qquickitem.h> #include <QtQuick/qquickcanvas.h> -#define QUICK_TEST_SCENEGRAPH 1 -#endif -#include <QtWidgets/qgraphicsscene.h> QT_BEGIN_NAMESPACE @@ -114,15 +110,9 @@ namespace QtQuickTest } QPoint pos; -#ifdef QUICK_TEST_SCENEGRAPH QQuickItem *sgitem = qobject_cast<QQuickItem *>(item); - if (sgitem) { + if (sgitem) pos = sgitem->mapToScene(_pos).toPoint(); - } else -#endif - { - qWarning("No suitable QtQuick1 implementation is available!"); - } QTEST_ASSERT(button == Qt::NoButton || button & Qt::MouseButtonMask); QTEST_ASSERT(stateKey == 0 || stateKey & Qt::KeyboardModifierMask); @@ -168,15 +158,10 @@ namespace QtQuickTest QTest::qWait(delay); QPoint pos; -#ifdef QUICK_TEST_SCENEGRAPH QQuickItem *sgitem = qobject_cast<QQuickItem *>(item); - if (sgitem) { + if (sgitem) pos = sgitem->mapToScene(_pos).toPoint(); - } else -#endif - { - qWarning("No suitable QtQuick1 implementation is available!"); - } + QTEST_ASSERT(buttons == Qt::NoButton || buttons & Qt::MouseButtonMask); QTEST_ASSERT(stateKey == 0 || stateKey & Qt::KeyboardModifierMask); @@ -272,24 +257,10 @@ bool QuickTestEvent::mouseMove QWindow *QuickTestEvent::eventWindow() { -#ifdef QUICK_TEST_SCENEGRAPH QQuickItem *sgitem = qobject_cast<QQuickItem *>(parent()); if (sgitem) return sgitem->canvas(); -#endif return 0; - /* - QQuickItem *item = qobject_cast<QQuickItem *>(parent()); - if (!item) - return 0; - QGraphicsScene *s = item->scene(); - if (!s) - return 0; - QList<QGraphicsView *> views = s->views(); - if (views.isEmpty()) - return 0; - return views.at(0)->windowHandle(); - */ } QT_END_NAMESPACE diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp index 33c5fef96a..d33eab4943 100644 --- a/src/qmltest/quicktestresult.cpp +++ b/src/qmltest/quicktestresult.cpp @@ -379,18 +379,12 @@ bool QuickTestResult::compare const QString &val1, const QString &val2, const QUrl &location, int line) { - if (success) { - return QTestResult::compare - (success, message.toLocal8Bit().constData(), - qtestFixUrl(location).toLatin1().constData(), line); - } else { - return QTestResult::compare - (success, message.toLocal8Bit().constData(), - QTest::toString(val1.toLatin1().constData()), - QTest::toString(val2.toLatin1().constData()), - "", "", - qtestFixUrl(location).toLatin1().constData(), line); - } + return QTestResult::compare + (success, message.toLocal8Bit().constData(), + QTest::toString(val1.toLatin1().constData()), + QTest::toString(val2.toLatin1().constData()), + "", "", + qtestFixUrl(location).toLatin1().constData(), line); } void QuickTestResult::skip diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickcanvas.cpp index 60f1992b57..f14eccd9a9 100644 --- a/src/quick/items/qquickcanvas.cpp +++ b/src/quick/items/qquickcanvas.cpp @@ -376,10 +376,8 @@ void QQuickCanvasPrivate::translateTouchToMouse(QTouchEvent *event) { if (event->type() == QEvent::TouchCancel) { touchMouseId = -1; - if (!mouseGrabberItem) - return; - mouseGrabberItem->ungrabMouse(); - mouseGrabberItem = 0; + if (mouseGrabberItem) + mouseGrabberItem->ungrabMouse(); return; } for (int i = 0; i < event->touchPoints().count(); ++i) { @@ -447,7 +445,8 @@ void QQuickCanvasPrivate::translateTouchToMouse(QTouchEvent *event) me.setTimestamp(event->timestamp()); me.setCapabilities(event->device()->capabilities()); deliverMouseEvent(&me); - mouseGrabberItem = 0; + if (mouseGrabberItem) + mouseGrabberItem->ungrabMouse(); } break; } @@ -947,13 +946,13 @@ bool QQuickCanvasPrivate::deliverInitialMousePressEvent(QQuickItem *item, QMouse QMouseEvent me(event->type(), p, event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers()); me.accept(); - mouseGrabberItem = item; + item->grabMouse(); q->sendEvent(item, &me); event->setAccepted(me.isAccepted()); if (me.isAccepted()) return true; - mouseGrabberItem->ungrabMouse(); - mouseGrabberItem = 0; + if (mouseGrabberItem) + mouseGrabberItem->ungrabMouse(); } } @@ -1023,7 +1022,8 @@ void QQuickCanvas::mouseReleaseEvent(QMouseEvent *event) } d->deliverMouseEvent(event); - d->mouseGrabberItem = 0; + if (d->mouseGrabberItem) + d->mouseGrabberItem->ungrabMouse(); } /*! \reimp */ @@ -1560,6 +1560,12 @@ bool QQuickCanvas::sendEvent(QQuickItem *item, QEvent *e) QQuickItemPrivate::get(item)->deliverMouseEvent(static_cast<QMouseEvent *>(e)); } break; + case QEvent::UngrabMouse: + if (!d->sendFilteredMouseEvent(item->parentItem(), item, e)) { + e->accept(); + item->mouseUngrabEvent(); + } + break; case QEvent::Wheel: QQuickItemPrivate::get(item)->deliverWheelEvent(static_cast<QWheelEvent *>(e)); break; diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index f75ca14989..82f674741f 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -107,7 +107,7 @@ static const int FlickThreshold = 20; // RetainGrabVelocity is the maxmimum instantaneous velocity that // will ensure the Flickable retains the grab on consecutive flicks. -static const int RetainGrabVelocity = 15; +static const int RetainGrabVelocity = 100; QQuickFlickableVisibleArea::QQuickFlickableVisibleArea(QQuickFlickable *parent) : QObject(parent), flickable(parent), m_xPosition(0.), m_widthRatio(0.) @@ -823,8 +823,8 @@ void QQuickFlickablePrivate::handleMousePressEvent(QMouseEvent *event) Q_Q(QQuickFlickable); QQuickItemPrivate::start(timer); if (interactive && timeline.isActive() - && (qAbs(hData.smoothVelocity.value()) > RetainGrabVelocity - || qAbs(vData.smoothVelocity.value()) > RetainGrabVelocity)) { + && ((qAbs(hData.smoothVelocity.value()) > RetainGrabVelocity && !hData.fixingUp && !hData.inOvershoot) + || (qAbs(vData.smoothVelocity.value()) > RetainGrabVelocity && !vData.fixingUp && !vData.inOvershoot))) { stealMouse = true; // If we've been flicked then steal the click. int flickTime = timeline.time(); if (flickTime > 600) { @@ -846,7 +846,10 @@ void QQuickFlickablePrivate::handleMousePressEvent(QMouseEvent *event) } q->setKeepMouseGrab(stealMouse); pressed = true; - timeline.clear(); + if (!hData.fixingUp) + timeline.reset(hData.move); + if (!vData.fixingUp) + timeline.reset(vData.move); hData.reset(); vData.reset(); hData.dragMinBound = q->minXExtent(); @@ -910,6 +913,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) } } if (!rejectY && stealMouse && dy != 0.0) { + timeline.clear(); vData.move.setValue(newY); vMoved = true; } @@ -942,6 +946,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) } } if (!rejectX && stealMouse && dx != 0.0) { + timeline.clear(); hData.move.setValue(newX); hMoved = true; } @@ -1753,6 +1758,7 @@ void QQuickFlickable::mouseUngrabEvent() if (d->pressed) { // if our mouse grab has been removed (probably by another Flickable), // fix our state + d->clearDelayedPress(); d->pressed = false; d->draggingEnding(); d->stealMouse = false; @@ -1838,13 +1844,19 @@ bool QQuickFlickable::sendMouseEvent(QMouseEvent *event) bool QQuickFlickable::childMouseEventFilter(QQuickItem *i, QEvent *e) { Q_D(QQuickFlickable); - if (!isVisible() || !d->interactive || !isEnabled()) + if (!isVisible() || !isEnabled()) return QQuickItem::childMouseEventFilter(i, e); switch (e->type()) { case QEvent::MouseButtonPress: case QEvent::MouseMove: case QEvent::MouseButtonRelease: return sendMouseEvent(static_cast<QMouseEvent *>(e)); + case QEvent::UngrabMouse: + if (d->canvas && d->canvas->mouseGrabberItem() && d->canvas->mouseGrabberItem() != this) { + // The grab has been taken away from a child and given to some other item. + mouseUngrabEvent(); + } + break; default: break; } diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 1af4c31d75..8e351f1527 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -3040,9 +3040,8 @@ void QQuickItem::mouseReleaseEvent(QMouseEvent *event) event->ignore(); } -void QQuickItem::mouseDoubleClickEvent(QMouseEvent *event) +void QQuickItem::mouseDoubleClickEvent(QMouseEvent *) { - mousePressEvent(event); } void QQuickItem::mouseUngrabEvent() @@ -4751,8 +4750,10 @@ void QQuickItem::grabMouse() QQuickItem *oldGrabber = canvasPriv->mouseGrabberItem; canvasPriv->mouseGrabberItem = this; - if (oldGrabber) - oldGrabber->mouseUngrabEvent(); + if (oldGrabber) { + QEvent ev(QEvent::UngrabMouse); + d->canvas->sendEvent(oldGrabber, &ev); + } } void QQuickItem::ungrabMouse() @@ -4767,7 +4768,9 @@ void QQuickItem::ungrabMouse() } canvasPriv->mouseGrabberItem = 0; - mouseUngrabEvent(); + + QEvent ev(QEvent::UngrabMouse); + d->canvas->sendEvent(this, &ev); } bool QQuickItem::keepMouseGrab() const diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index c6f45aaf0b..501b206ef6 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -1658,10 +1658,11 @@ void QQuickItemViewPrivate::updateViewport() { Q_Q(QQuickItemView); if (isValid()) { + qreal extra = headerSize() + footerSize(); if (layoutOrientation() == Qt::Vertical) - q->setContentHeight(endPosition() - startPosition()); + q->setContentHeight(endPosition() - startPosition() + extra); else - q->setContentWidth(endPosition() - startPosition()); + q->setContentWidth(endPosition() - startPosition() + extra); } } diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp index d9dce49349..823269bfc1 100644 --- a/src/quick/items/qquickitemviewtransition.cpp +++ b/src/quick/items/qquickitemviewtransition.cpp @@ -333,6 +333,8 @@ QQuickItemViewTransitionableItem::QQuickItemViewTransitionableItem(QQuickItem *i , nextTransitionType(QQuickItemViewTransitioner::NoTransition) , isTransitionTarget(false) , nextTransitionToSet(false) + , nextTransitionFromSet(false) + , lastMovedToSet(false) , prepared(false) { } @@ -367,12 +369,17 @@ qreal QQuickItemViewTransitionableItem::itemY() const void QQuickItemViewTransitionableItem::moveTo(const QPointF &pos, bool immediate) { + if (!nextTransitionFromSet && nextTransitionType != QQuickItemViewTransitioner::NoTransition) { + nextTransitionFrom = item->pos(); + nextTransitionFromSet = true; + } + + lastMovedTo = pos; + lastMovedToSet = true; + if (immediate || !transitionScheduledOrRunning()) { - if (immediate) { - if (transition) - transition->cancel(); - resetTransitionData(); - } + if (immediate) + stopTransition(); item->setPos(pos); } else { nextTransitionTo = pos; @@ -402,17 +409,27 @@ bool QQuickItemViewTransitionableItem::isPendingRemoval() const bool QQuickItemViewTransitionableItem::prepareTransition(QQuickItemViewTransitioner *transitioner, int index, const QRectF &viewBounds) { - bool doTransition = false; + if (nextTransitionType == QQuickItemViewTransitioner::NoTransition) + return false; + + if (isTransitionTarget) { + // If item is not already moving somewhere, set it to not move anywhere. + // This ensures that removed targets don't transition to the default (0,0) and that + // items set for other transition types only transition if they actually move somewhere. + if (!nextTransitionToSet) + moveTo(item->pos()); + } else { + // don't start displaced transitions that don't move anywhere + if (!nextTransitionToSet || (nextTransitionFromSet && nextTransitionFrom == nextTransitionTo)) { + clearCurrentScheduledTransition(); + return false; + } + } - // If item is not already moving somewhere, set it to not move anywhere. - // This ensures that removed targets don't transition to the default (0,0) and that - // items set for other transition types only transition if they actually move somewhere. - if (nextTransitionType != QQuickItemViewTransitioner::NoTransition && !nextTransitionToSet) - moveTo(item->pos()); + bool doTransition = false; // For move transitions (both target and displaced) and displaced transitions of other // types, only run the transition if the item is actually moving to another position. - switch (nextTransitionType) { case QQuickItemViewTransitioner::NoTransition: { @@ -465,10 +482,8 @@ bool QQuickItemViewTransitionableItem::prepareTransition(QQuickItemViewTransitio if (!doTransition) { // if transition type is not valid, the previous transition still has to be // canceled so that the item can move immediately to the right position - if (transition) - transition->cancel(); item->setPos(nextTransitionTo); - resetTransitionData(); + stopTransition(); } prepared = true; @@ -490,14 +505,8 @@ void QQuickItemViewTransitionableItem::startTransition(QQuickItemViewTransitione transition = new QQuickItemViewTransitionJob; } - // if item is not already moving somewhere, set it to not move anywhere - // so that removed items do not move to the default (0,0) - if (!nextTransitionToSet) - moveTo(item->pos()); - transition->startTransition(this, index, transitioner, nextTransitionType, nextTransitionTo, isTransitionTarget); - nextTransitionType = QQuickItemViewTransitioner::NoTransition; - prepared = false; + clearCurrentScheduledTransition(); } void QQuickItemViewTransitionableItem::setNextTransition(QQuickItemViewTransitioner::TransitionType type, bool isTargetItem) @@ -507,27 +516,50 @@ void QQuickItemViewTransitionableItem::setNextTransition(QQuickItemViewTransitio // to calculate positions for transitions for other items in the view. nextTransitionType = type; isTransitionTarget = isTargetItem; + + if (!nextTransitionFromSet && lastMovedToSet) { + nextTransitionFrom = lastMovedTo; + nextTransitionFromSet = true; + } } bool QQuickItemViewTransitionableItem::transitionWillChangePosition() const { if (transitionRunning() && transition->m_toPos != nextTransitionTo) return true; - return nextTransitionTo != item->pos(); + if (!nextTransitionFromSet) + return false; + return nextTransitionTo != nextTransitionFrom; } -void QQuickItemViewTransitionableItem::finishedTransition() +void QQuickItemViewTransitionableItem::resetNextTransitionPos() { nextTransitionToSet = false; nextTransitionTo = QPointF(); } -void QQuickItemViewTransitionableItem::resetTransitionData() +void QQuickItemViewTransitionableItem::finishedTransition() +{ + resetNextTransitionPos(); +} + +void QQuickItemViewTransitionableItem::clearCurrentScheduledTransition() { + // Just clear the current scheduled transition - don't touch the nextTransitionTo + // which may have already been set for a previously scheduled transition + nextTransitionType = QQuickItemViewTransitioner::NoTransition; isTransitionTarget = false; - nextTransitionTo = QPointF(); - nextTransitionToSet = false; + prepared = false; + nextTransitionFromSet = false; +} + +void QQuickItemViewTransitionableItem::stopTransition() +{ + if (transition) + transition->cancel(); + clearCurrentScheduledTransition(); + resetNextTransitionPos(); } diff --git a/src/quick/items/qquickitemviewtransition_p.h b/src/quick/items/qquickitemviewtransition_p.h index a4babdca05..9e17385c46 100644 --- a/src/quick/items/qquickitemviewtransition_p.h +++ b/src/quick/items/qquickitemviewtransition_p.h @@ -142,11 +142,15 @@ public: void startTransition(QQuickItemViewTransitioner *transitioner, int index); QPointF nextTransitionTo; + QPointF lastMovedTo; + QPointF nextTransitionFrom; QQuickItem *item; QQuickItemViewTransitionJob *transition; QQuickItemViewTransitioner::TransitionType nextTransitionType; bool isTransitionTarget; bool nextTransitionToSet; + bool nextTransitionFromSet; + bool lastMovedToSet; bool prepared; private: @@ -155,7 +159,9 @@ private: void setNextTransition(QQuickItemViewTransitioner::TransitionType, bool isTargetItem); bool transitionWillChangePosition() const; void finishedTransition(); - void resetTransitionData(); + void resetNextTransitionPos(); + void clearCurrentScheduledTransition(); + void stopTransition(); }; diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index f8098c8f65..0526187531 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -1224,7 +1224,8 @@ void QQuickPathViewPrivate::handleMousePressEvent(QMouseEvent *event) return; } - if (tl.isActive() && flicking) + + if (tl.isActive() && flicking && flickDuration && qreal(tl.time())/flickDuration < 0.8) stealMouse = true; // If we've been flicked then steal the click. else stealMouse = false; @@ -1335,6 +1336,7 @@ void QQuickPathViewPrivate::handleMouseReleaseEvent(QMouseEvent *) } else { dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * 2.0))); } + flickDuration = static_cast<int>(1000 * qAbs(velocity) / accel); offsetAdj = 0.0; moveOffset.setValue(offset); tl.accel(moveOffset, velocity, accel, dist); diff --git a/src/quick/items/qquickpathview_p_p.h b/src/quick/items/qquickpathview_p_p.h index a80c01f320..412caa6d2b 100644 --- a/src/quick/items/qquickpathview_p_p.h +++ b/src/quick/items/qquickpathview_p_p.h @@ -81,7 +81,7 @@ public: , autoHighlight(true), highlightUp(false), layoutScheduled(false) , moving(false), flicking(false), requestedOnPath(false), inRequest(false) , dragMargin(0), deceleration(100) - , moveOffset(this, &QQuickPathViewPrivate::setAdjustedOffset) + , moveOffset(this, &QQuickPathViewPrivate::setAdjustedOffset), flickDuration(0) , firstIndex(-1), pathItems(-1), requestedIndex(-1), requestedZ(0) , moveReason(Other), moveDirection(Shortest), attType(0), highlightComponent(0), highlightItem(0) , moveHighlight(this, &QQuickPathViewPrivate::setHighlightPosition) @@ -171,6 +171,7 @@ public: qreal deceleration; QQuickTimeLine tl; QQuickTimeLineValueProxy<QQuickPathViewPrivate> moveOffset; + int flickDuration; int firstIndex; int pathItems; int requestedIndex; diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp index d26ebed85e..1f7578c583 100644 --- a/src/quick/items/qquickrepeater.cpp +++ b/src/quick/items/qquickrepeater.cpp @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QQuickRepeaterPrivate::QQuickRepeaterPrivate() - : model(0), ownModel(false), inRequest(false), itemCount(0), createFrom(-1) + : model(0), ownModel(false), inRequest(false), dataSourceIsObject(false), itemCount(0), createFrom(-1) { } @@ -175,6 +175,12 @@ QQuickRepeater::~QQuickRepeater() QVariant QQuickRepeater::model() const { Q_D(const QQuickRepeater); + + if (d->dataSourceIsObject) { + QObject *o = d->dataSourceAsObject; + return QVariant::fromValue(o); + } + return d->dataSource; } @@ -194,6 +200,8 @@ void QQuickRepeater::setModel(const QVariant &model) } d->dataSource = model; QObject *object = qvariant_cast<QObject*>(model); + d->dataSourceAsObject = object; + d->dataSourceIsObject = object != 0; QQuickVisualModel *vim = 0; if (object && (vim = qobject_cast<QQuickVisualModel *>(object))) { if (d->ownModel) { diff --git a/src/quick/items/qquickrepeater_p_p.h b/src/quick/items/qquickrepeater_p_p.h index 88e0c94218..41d77ad977 100644 --- a/src/quick/items/qquickrepeater_p_p.h +++ b/src/quick/items/qquickrepeater_p_p.h @@ -75,8 +75,10 @@ private: QQuickVisualModel *model; QVariant dataSource; + QQmlGuard<QObject> dataSourceAsObject; bool ownModel : 1; bool inRequest : 1; + bool dataSourceIsObject : 1; int itemCount; int createFrom; diff --git a/src/quick/util/qquickchangeset_p.h b/src/quick/util/qquickchangeset_p.h index 64179666c7..04a1e77c24 100644 --- a/src/quick/util/qquickchangeset_p.h +++ b/src/quick/util/qquickchangeset_p.h @@ -152,6 +152,11 @@ private: int m_difference; }; +Q_DECLARE_TYPEINFO(QQuickChangeSet::Change, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(QQuickChangeSet::Remove, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(QQuickChangeSet::Insert, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(QQuickChangeSet::MoveKey, Q_PRIMITIVE_TYPE); + inline uint qHash(const QQuickChangeSet::MoveKey &key) { return qHash(qMakePair(key.moveId, key.offset)); } inline bool operator ==(const QQuickChangeSet::MoveKey &l, const QQuickChangeSet::MoveKey &r) { return l.moveId == r.moveId && l.offset == r.offset; } diff --git a/src/quick/util/qquicklistcompositor_p.h b/src/quick/util/qquicklistcompositor_p.h index b12ee8025f..5c9d679fa4 100644 --- a/src/quick/util/qquicklistcompositor_p.h +++ b/src/quick/util/qquicklistcompositor_p.h @@ -317,6 +317,10 @@ private: friend Q_AUTOTEST_EXPORT QDebug operator <<(QDebug debug, const QQuickListCompositor &list); }; +Q_DECLARE_TYPEINFO(QQuickListCompositor::Change, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(QQuickListCompositor::Remove, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(QQuickListCompositor::Insert, Q_PRIMITIVE_TYPE); + inline QQuickListCompositor::iterator::iterator() : range(0), offset(0), group(Default), groupCount(0) {} inline QQuickListCompositor::iterator::iterator(const iterator &it) diff --git a/sync.profile b/sync.profile index 554dd14fbf..36b45b35d0 100644 --- a/sync.profile +++ b/sync.profile @@ -216,7 +216,7 @@ # - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch) # %dependencies = ( - "qtbase" => "3d19422ef16a230bb11dbbfe4a8cc9667f39bf15", + "qtbase" => "refs/heads/master", "qtxmlpatterns" => "refs/heads/master", "qtjsbackend" => "refs/heads/master", ); diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 5012b5cdec..15d88785de 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -2,9 +2,8 @@ TEMPLATE=subdirs SUBDIRS=\ qml \ quick \ + headersclean \ particles \ qmldevtools contains(QT_CONFIG, qmltest): SUBDIRS += qmltest - -!cross_compile: SUBDIRS += host.pro diff --git a/tests/auto/headersclean/headersclean.pro b/tests/auto/headersclean/headersclean.pro index 4ce05fe512..379648e950 100644 --- a/tests/auto/headersclean/headersclean.pro +++ b/tests/auto/headersclean/headersclean.pro @@ -1,6 +1,9 @@ -CONFIG += testcase -TARGET = tst_headersclean -SOURCES += tst_headersclean.cpp -QT = core testlib +QT = core testlib declarative qml quick qmltest qmldevtools +HEADERSCLEAN_PRI = $${QT.core.sources}/../../tests/auto/other/headersclean/headersclean.pri +isEmpty(QT.core.sources)|!include($$HEADERSCLEAN_PRI) { + warning("headersclean.pri from QtCore sources not available. test disabled") + TEMPLATE=subdirs +} -contains(QT_CONFIG,qml): QT += qml qml-private +# shadowing problems in scenegraph, allow it for now +*-g++*: QMAKE_CXXFLAGS -= -Wshadow diff --git a/tests/auto/headersclean/tst_headersclean.cpp b/tests/auto/headersclean/qt_headersclean_headers.h index d5131f96cd..d3f4e4b5c8 100644 --- a/tests/auto/headersclean/tst_headersclean.cpp +++ b/tests/auto/headersclean/qt_headersclean_headers.h @@ -39,24 +39,13 @@ ** ****************************************************************************/ -#define QT_NO_KEYWORDS -#define signals int -#define slots int -#define emit public:; -#define foreach public:; -#define forever public:; - -#include <QtCore/QtCore> -#include <QtTest/QtTest> +#ifndef QT_HEADERSCLEAN_HEADERS +#define QT_HEADERSCLEAN_HEADERS +#include <QtDeclarative/QtDeclarative> #include <QtQml/QtQml> +#include <QtQmlDevTools/QtQmlDevTools> +#include <QtQuick/QtQuick> +#include <QtQuickTest/QtQuickTest> -class tst_HeadersClean: public QObject -{ - Q_OBJECT -public: - tst_HeadersClean() {} -}; - -QTEST_MAIN(tst_HeadersClean) -#include "tst_headersclean.moc" +#endif diff --git a/tests/auto/host.pro b/tests/auto/host.pro deleted file mode 100644 index 0a96ef0413..0000000000 --- a/tests/auto/host.pro +++ /dev/null @@ -1,9 +0,0 @@ -TEMPLATE=subdirs - -# FIXME -# This test is crrently broken: -#SUBDIRS=\ - #headersclean \ - -SUBDIRS= - diff --git a/tests/auto/particles/qquickage/qquickage.pro b/tests/auto/particles/qquickage/qquickage.pro index 99c768fdb1..8e5c2f0e33 100644 --- a/tests/auto/particles/qquickage/qquickage.pro +++ b/tests/auto/particles/qquickage/qquickage.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickangleddirection/qquickangleddirection.pro b/tests/auto/particles/qquickangleddirection/qquickangleddirection.pro index 6899ee60d9..df8d460d3e 100644 --- a/tests/auto/particles/qquickangleddirection/qquickangleddirection.pro +++ b/tests/auto/particles/qquickangleddirection/qquickangleddirection.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickcumulativedirection/qquickcumulativedirection.pro b/tests/auto/particles/qquickcumulativedirection/qquickcumulativedirection.pro index b5d3efac6d..4ea8739c21 100644 --- a/tests/auto/particles/qquickcumulativedirection/qquickcumulativedirection.pro +++ b/tests/auto/particles/qquickcumulativedirection/qquickcumulativedirection.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro b/tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro index b1533d6be1..0855187d47 100644 --- a/tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro +++ b/tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro b/tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro index 6666c91d7e..d5c21abef3 100644 --- a/tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro +++ b/tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickellipseextruder/qquickellipseextruder.pro b/tests/auto/particles/qquickellipseextruder/qquickellipseextruder.pro index b7eedb00f1..33241a4792 100644 --- a/tests/auto/particles/qquickellipseextruder/qquickellipseextruder.pro +++ b/tests/auto/particles/qquickellipseextruder/qquickellipseextruder.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickfriction/qquickfriction.pro b/tests/auto/particles/qquickfriction/qquickfriction.pro index 19c789ddfe..36cf9aaa60 100644 --- a/tests/auto/particles/qquickfriction/qquickfriction.pro +++ b/tests/auto/particles/qquickfriction/qquickfriction.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickgravity/qquickgravity.pro b/tests/auto/particles/qquickgravity/qquickgravity.pro index a3fab3837c..331def26b5 100644 --- a/tests/auto/particles/qquickgravity/qquickgravity.pro +++ b/tests/auto/particles/qquickgravity/qquickgravity.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro b/tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro index b97549eeee..f7f09ed9d0 100644 --- a/tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro +++ b/tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private opengl-private testlib +QT += core-private gui-private v8-private qml-private testlib diff --git a/tests/auto/particles/qquickimageparticle/qquickimageparticle.pro b/tests/auto/particles/qquickimageparticle/qquickimageparticle.pro index 590f698510..226d844263 100644 --- a/tests/auto/particles/qquickimageparticle/qquickimageparticle.pro +++ b/tests/auto/particles/qquickimageparticle/qquickimageparticle.pro @@ -6,4 +6,4 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickitemparticle/qquickitemparticle.pro b/tests/auto/particles/qquickitemparticle/qquickitemparticle.pro index b275e4bf08..ec7fa48e26 100644 --- a/tests/auto/particles/qquickitemparticle/qquickitemparticle.pro +++ b/tests/auto/particles/qquickitemparticle/qquickitemparticle.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquicklineextruder/qquicklineextruder.pro b/tests/auto/particles/qquicklineextruder/qquicklineextruder.pro index 519b3e4927..a1297b1e26 100644 --- a/tests/auto/particles/qquicklineextruder/qquicklineextruder.pro +++ b/tests/auto/particles/qquicklineextruder/qquicklineextruder.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro b/tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro index 48aeaddc5e..99f50a286d 100644 --- a/tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro +++ b/tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro b/tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro index d3e132fc83..c5c908e305 100644 --- a/tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro +++ b/tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro b/tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro index b241048d9e..2179ae3ae9 100644 --- a/tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro +++ b/tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickpointattractor/qquickpointattractor.pro b/tests/auto/particles/qquickpointattractor/qquickpointattractor.pro index 22a9ac5d87..43c8022b0a 100644 --- a/tests/auto/particles/qquickpointattractor/qquickpointattractor.pro +++ b/tests/auto/particles/qquickpointattractor/qquickpointattractor.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickpointdirection/qquickpointdirection.pro b/tests/auto/particles/qquickpointdirection/qquickpointdirection.pro index 319bdee22f..71b21e5f56 100644 --- a/tests/auto/particles/qquickpointdirection/qquickpointdirection.pro +++ b/tests/auto/particles/qquickpointdirection/qquickpointdirection.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickrectangleextruder/qquickrectangleextruder.pro b/tests/auto/particles/qquickrectangleextruder/qquickrectangleextruder.pro index 683f77ec55..5e595204cc 100644 --- a/tests/auto/particles/qquickrectangleextruder/qquickrectangleextruder.pro +++ b/tests/auto/particles/qquickrectangleextruder/qquickrectangleextruder.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickspritegoal/qquickspritegoal.pro b/tests/auto/particles/qquickspritegoal/qquickspritegoal.pro index 95cf68f459..cfe932aabd 100644 --- a/tests/auto/particles/qquickspritegoal/qquickspritegoal.pro +++ b/tests/auto/particles/qquickspritegoal/qquickspritegoal.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private opengl-private testlib +QT += core-private gui-private v8-private qml-private testlib diff --git a/tests/auto/particles/qquicktargetdirection/qquicktargetdirection.pro b/tests/auto/particles/qquicktargetdirection/qquicktargetdirection.pro index a4a09ae6de..b7ba905f2e 100644 --- a/tests/auto/particles/qquicktargetdirection/qquicktargetdirection.pro +++ b/tests/auto/particles/qquicktargetdirection/qquicktargetdirection.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro b/tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro index e169ccdfe2..5a76e2fba4 100644 --- a/tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro +++ b/tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickturbulence/qquickturbulence.pro b/tests/auto/particles/qquickturbulence/qquickturbulence.pro index 306d58d223..3bfb94addf 100644 --- a/tests/auto/particles/qquickturbulence/qquickturbulence.pro +++ b/tests/auto/particles/qquickturbulence/qquickturbulence.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/particles/qquickwander/qquickwander.pro b/tests/auto/particles/qquickwander/qquickwander.pro index 94b88379f0..1cd4269074 100644 --- a/tests/auto/particles/qquickwander/qquickwander.pro +++ b/tests/auto/particles/qquickwander/qquickwander.pro @@ -6,5 +6,5 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/qml/debugger/qqmlinspector/app/app.pro b/tests/auto/qml/debugger/qqmlinspector/app/app.pro index f6ef983735..9c7574a97e 100644 --- a/tests/auto/qml/debugger/qqmlinspector/app/app.pro +++ b/tests/auto/qml/debugger/qqmlinspector/app/app.pro @@ -1,5 +1,5 @@ TARGET = app -QT += qml quick widgets +QT += qml quick CONFIG += declarative_debug macx:CONFIG -= app_bundle diff --git a/tests/auto/qml/qqmlincubator/qqmlincubator.pro b/tests/auto/qml/qqmlincubator/qqmlincubator.pro index b6ce22d4cf..6c4692db96 100644 --- a/tests/auto/qml/qqmlincubator/qqmlincubator.pro +++ b/tests/auto/qml/qqmlincubator/qqmlincubator.pro @@ -13,4 +13,4 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private network widgets testlib +QT += core-private gui-private v8-private qml-private network testlib diff --git a/tests/auto/qml/qqmlinfo/qqmlinfo.pro b/tests/auto/qml/qqmlinfo/qqmlinfo.pro index 050bad68a1..891e698aeb 100644 --- a/tests/auto/qml/qqmlinfo/qqmlinfo.pro +++ b/tests/auto/qml/qqmlinfo/qqmlinfo.pro @@ -9,4 +9,4 @@ include (../../shared/util.pri) TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private qml-private widgets testlib +QT += core-private gui-private qml-private testlib diff --git a/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro b/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro index 7c781dd9db..d723907024 100644 --- a/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro +++ b/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro @@ -4,4 +4,4 @@ SOURCES += tst_qqmlmetatype.cpp macx:CONFIG -= app_bundle CONFIG += parallel_test -QT += core-private gui-private qml-private widgets testlib +QT += core-private gui-private qml-private testlib diff --git a/tests/auto/qml/qqmlproperty/qqmlproperty.pro b/tests/auto/qml/qqmlproperty/qqmlproperty.pro index 6d878902ff..c32545dc77 100644 --- a/tests/auto/qml/qqmlproperty/qqmlproperty.pro +++ b/tests/auto/qml/qqmlproperty/qqmlproperty.pro @@ -10,4 +10,4 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private widgets testlib +QT += core-private gui-private v8-private qml-private testlib diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index ae300900c9..13ea1abd73 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -1553,6 +1553,8 @@ void tst_qqmlproperty::crashOnValueProperty() delete engine; engine = 0; + QSKIP("QTBUG-24734: test accesses deleted QML engine from QQmlProperty::propertyTypeName()"); + QCOMPARE(p.propertyTypeName(), "int"); QCOMPARE(p.read(), QVariant(10)); p.write(QVariant(20)); diff --git a/tests/auto/qml/qquickconnection/qquickconnection.pro b/tests/auto/qml/qquickconnection/qquickconnection.pro index baef334459..46f7971df1 100644 --- a/tests/auto/qml/qquickconnection/qquickconnection.pro +++ b/tests/auto/qml/qquickconnection/qquickconnection.pro @@ -10,4 +10,4 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/qml/qquicklistmodel/qquicklistmodel.pro b/tests/auto/qml/qquicklistmodel/qquicklistmodel.pro index 25b28bbe4c..6f558a7e51 100644 --- a/tests/auto/qml/qquicklistmodel/qquicklistmodel.pro +++ b/tests/auto/qml/qquicklistmodel/qquicklistmodel.pro @@ -10,4 +10,4 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp b/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp index 69a8d2ecd8..bf26452f0e 100644 --- a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp +++ b/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp @@ -216,17 +216,21 @@ QQuickItem *tst_qquicklistmodel::createWorkerTest(QQmlEngine *eng, QQmlComponent void tst_qquicklistmodel::waitForWorker(QQuickItem *item) { + QQmlProperty prop(item, "done"); + QVERIFY(prop.isValid()); + if (prop.read().toBool()) + return; // already finished + QEventLoop loop; QTimer timer; timer.setSingleShot(true); connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); - QQmlProperty prop(item, "done"); - QVERIFY(prop.isValid()); QVERIFY(prop.connectNotifySignal(&loop, SLOT(quit()))); timer.start(10000); loop.exec(); QVERIFY(timer.isActive()); + QVERIFY(prop.read().toBool()); } void tst_qquicklistmodel::static_types_data() @@ -986,6 +990,8 @@ void tst_qquicklistmodel::get_worker() QCOMPARE(spyResult.at(0).toInt(), index); QCOMPARE(spyResult.at(1).toInt(), 1); // only 1 item is modified at a time QVERIFY(spyResult.at(2).value<QList<int> >().contains(role)); + + delete item; } void tst_qquicklistmodel::get_worker_data() diff --git a/tests/auto/qml/v4/data/mathAbs.qml b/tests/auto/qml/v4/data/mathAbs.qml new file mode 100644 index 0000000000..eb504ae4d8 --- /dev/null +++ b/tests/auto/qml/v4/data/mathAbs.qml @@ -0,0 +1,42 @@ +import QtQuick 2.0 + +Item { + property real test1: Math.abs(i1.p1) + property real test2: Math.abs(i1.p2) + + property int test3: Math.abs(i1.p3) + property int test4: Math.abs(i1.p4) + + property real subtest5: Math.abs() + property real subtest6: Math.abs(i1.p6) + property bool test5: isNaN(subtest5) + property bool test6: isNaN(subtest6) + + property real subtest7: Math.abs(i1.p7) + property bool test7: isNaN(subtest7) + property int test8: Math.abs(i1.p8) + + property real subtest9: Math.abs(i1.p9) + property real subtest10: Math.abs(i1.p10) + property bool test9: subtest9 === Number.POSITIVE_INFINITY + property bool test10: subtest10 === Number.POSITIVE_INFINITY + + property int test11: Math.abs(i1.p11) + property real subtest12: Math.abs(i1.p12) + property bool test12: subtest12 === 0 && (1/subtest12) === Infinity + + QtObject { + id: i1 + property real p1: -3.7 + property real p2: 4.5 + property int p3: 18 + property int p4: -72 + property real p6: Number.NaN + property string p7: "hello world" + property string p8: "82" + property real p9: Number.NEGATIVE_INFINITY + property real p10: Number.POSITIVE_INFINITY + property real p11: 0 + property real p12: -0 + } + } diff --git a/tests/auto/qml/v4/data/mathCeil.qml b/tests/auto/qml/v4/data/mathCeil.qml new file mode 100644 index 0000000000..f67838a445 --- /dev/null +++ b/tests/auto/qml/v4/data/mathCeil.qml @@ -0,0 +1,37 @@ +import QtQuick 2.0 + +Item { + property real test1: Math.ceil(i1.p1) + property real test2: Math.ceil(i1.p2) + + property real subtest3: Math.ceil() + property real subtest4: Math.ceil(i1.p4) + property bool test3: isNaN(subtest3) + property bool test4: isNaN(subtest4) + + property real subtest5: Math.ceil(i1.p5) + property bool test5: isNaN(subtest5) + property real test6: Math.ceil(i1.p6) + + property real subtest7: Math.ceil(i1.p7) + property real subtest8: Math.ceil(i1.p8) + property bool test7: subtest7 === Number.NEGATIVE_INFINITY + property bool test8: subtest8 === Number.POSITIVE_INFINITY + + property real test9: Math.ceil(i1.p9) + property real subtest10: Math.ceil(i1.p10) + property bool test10: subtest10 === 0 && (1/subtest10) === -Infinity + + QtObject { + id: i1 + property real p1: -3.7 + property real p2: 4.4 + property real p4: Number.NaN + property string p5: "hello world" + property string p6: "82.6" + property real p7: Number.NEGATIVE_INFINITY + property real p8: Number.POSITIVE_INFINITY + property real p9: 0 + property real p10: -0 + } + } diff --git a/tests/auto/qml/v4/data/mathMax.qml b/tests/auto/qml/v4/data/mathMax.qml new file mode 100644 index 0000000000..543b4994aa --- /dev/null +++ b/tests/auto/qml/v4/data/mathMax.qml @@ -0,0 +1,41 @@ +import QtQuick 2.0 + +Item { + property real test1: Math.max(i1.p1, i1.p2) + property real test2: Math.max(i1.p2, i1.p3) + + property real subtest3: Math.max() + property real subtest4: Math.max(i1.p4) + property bool test3: subtest3 === -Infinity + property bool test4: isNaN(subtest4) + + property real subtest5: Math.max(i1.p5, i1.p1) + property bool test5: isNaN(subtest5) + property real test6: Math.max(i1.p6, i1.p3) + + property real test7: Math.max(i1.p7, i1.p2) + property real subtest8: Math.max(i1.p8, i1.p2) + property bool test8: subtest8 === Number.POSITIVE_INFINITY + + property real subtest9: Math.max(i1.p10, i1.p9) + property bool test9: subtest9 === 0 && (1/subtest9) === Infinity + + property real test10: Math.max(i1.p11, i1.p1) + property real test11: Math.max(i1.p11, i1.p2) + property real test12: Math.max(i1.p1, i1.p2, i1.p3) + + QtObject { + id: i1 + property real p1: -3.7 + property real p2: 4.4 + property int p3: 7 + property real p4: Number.NaN + property string p5: "hello world" + property string p6: "82.6" + property real p7: Number.NEGATIVE_INFINITY + property real p8: Number.POSITIVE_INFINITY + property real p9: 0 + property real p10: -0 + property var p11: null + } + } diff --git a/tests/auto/qml/v4/data/mathMin.qml b/tests/auto/qml/v4/data/mathMin.qml new file mode 100644 index 0000000000..7d2a561623 --- /dev/null +++ b/tests/auto/qml/v4/data/mathMin.qml @@ -0,0 +1,41 @@ +import QtQuick 2.0 + +Item { + property real test1: Math.min(i1.p1, i1.p2) + property real test2: Math.min(i1.p2, i1.p3) + + property real subtest3: Math.min() + property real subtest4: Math.min(i1.p4) + property bool test3: subtest3 === Infinity + property bool test4: isNaN(subtest4) + + property real subtest5: Math.min(i1.p5, i1.p1) + property bool test5: isNaN(subtest5) + property real test6: Math.min(i1.p6, i1.p3) + + property real subtest7: Math.min(i1.p7, i1.p2) + property bool test7: subtest7 === Number.NEGATIVE_INFINITY + property real test8: Math.min(i1.p8, i1.p2) + + property real subtest9: Math.min(i1.p10, i1.p9) + property bool test9: subtest9 === 0 && (1/subtest9) === -Infinity + + property real test10: Math.min(i1.p11, i1.p1) + property real test11: Math.min(i1.p11, i1.p2) + property real test12: Math.min(i1.p1, i1.p2, i1.p3) + + QtObject { + id: i1 + property real p1: -3.7 + property real p2: 4.4 + property int p3: 95 + property real p4: Number.NaN + property string p5: "hello world" + property string p6: "82.6" + property real p7: Number.NEGATIVE_INFINITY + property real p8: Number.POSITIVE_INFINITY + property real p9: 0 + property real p10: -0 + property var p11: null + } + } diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp index 041d9ab8e6..91a32268cf 100644 --- a/tests/auto/qml/v4/tst_v4.cpp +++ b/tests/auto/qml/v4/tst_v4.cpp @@ -75,6 +75,10 @@ private slots: void unaryMinus(); void unaryPlus(); void colorType(); + void mathAbs(); + void mathCeil(); + void mathMax(); + void mathMin(); private: QQmlEngine engine; @@ -248,7 +252,6 @@ void tst_v4::nestedObjectAccess() ResultObject *ro = qobject_cast<ResultObject *>(o); QVERIFY(ro != 0); - QEXPECT_FAIL("","QTBUG-24606", Continue); QCOMPARE(ro->result(), 37); delete o; @@ -383,6 +386,95 @@ void tst_v4::colorType() delete o; } +void tst_v4::mathAbs() +{ + QQmlComponent component(&engine, testFileUrl("mathAbs.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test1").toReal(), qreal(3.7)); + QCOMPARE(o->property("test2").toReal(), qreal(4.5)); + QCOMPARE(o->property("test3").toInt(), 18); + QCOMPARE(o->property("test4").toInt(), 72); + QCOMPARE(o->property("test5").toBool(), true); + QCOMPARE(o->property("test6").toBool(), true); + QCOMPARE(o->property("test7").toBool(), true); + QCOMPARE(o->property("test8").toInt(), 82); + QCOMPARE(o->property("test9").toBool(), true); + QCOMPARE(o->property("test10").toBool(), true); + QCOMPARE(o->property("test11").toInt(), 0); + //QCOMPARE(o->property("test12").toBool(), true); //QTBUG-24706 + + delete o; +} + +void tst_v4::mathCeil() +{ + QQmlComponent component(&engine, testFileUrl("mathCeil.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test1").toReal(), qreal(-3)); + QCOMPARE(o->property("test2").toReal(), qreal(5)); + QCOMPARE(o->property("test3").toBool(), true); + //QCOMPARE(o->property("test4").toBool(), true); //QTBUG-24706 + QCOMPARE(o->property("test5").toBool(), true); + QCOMPARE(o->property("test6").toReal(), qreal(83)); + //QCOMPARE(o->property("test7").toBool(), true); //QTBUG-24706 + //QCOMPARE(o->property("test8").toBool(), true); //QTBUG-24706 + QCOMPARE(o->property("test9").toInt(), 0); + //QCOMPARE(o->property("test10").toBool(), true); //QTBUG-24706 + + delete o; +} + +void tst_v4::mathMax() +{ + QQmlComponent component(&engine, testFileUrl("mathMax.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test1").toReal(), qreal(4.4)); + QCOMPARE(o->property("test2").toReal(), qreal(7)); + QCOMPARE(o->property("test3").toBool(), true); + QCOMPARE(o->property("test4").toBool(), true); + QCOMPARE(o->property("test5").toBool(), true); + QCOMPARE(o->property("test6").toReal(), qreal(82.6)); + QCOMPARE(o->property("test7").toReal(), qreal(4.4)); + QCOMPARE(o->property("test8").toBool(), true); + //QCOMPARE(o->property("test9").toBool(), true); //QTBUG-24706 + QCOMPARE(o->property("test10").toReal(), qreal(0)); + QCOMPARE(o->property("test11").toReal(), qreal(4.4)); + QCOMPARE(o->property("test12").toReal(), qreal(7)); + + delete o; +} + +void tst_v4::mathMin() +{ + QQmlComponent component(&engine, testFileUrl("mathMin.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test1").toReal(), qreal(-3.7)); + QCOMPARE(o->property("test2").toReal(), qreal(4.4)); + QCOMPARE(o->property("test3").toBool(), true); + QCOMPARE(o->property("test4").toBool(), true); + QCOMPARE(o->property("test5").toBool(), true); + QCOMPARE(o->property("test6").toReal(), qreal(82.6)); + QCOMPARE(o->property("test7").toBool(), true); + QCOMPARE(o->property("test8").toReal(), qreal(4.4)); + //QCOMPARE(o->property("test9").toBool(), true); //QTBUG-24706 + QCOMPARE(o->property("test10").toReal(), qreal(-3.7)); + QCOMPARE(o->property("test11").toReal(), qreal(0)); + QCOMPARE(o->property("test12").toReal(), qreal(-3.7)); + delete o; +} + QTEST_MAIN(tst_v4) #include "tst_v4.moc" diff --git a/tests/auto/quick/examples/examples.pro b/tests/auto/quick/examples/examples.pro index 5907ba291c..c320fdad9e 100644 --- a/tests/auto/quick/examples/examples.pro +++ b/tests/auto/quick/examples/examples.pro @@ -7,6 +7,6 @@ DEFINES += SRCDIR=\\\"$$PWD\\\" CONFIG += parallel_test #temporary -QT += core-private gui-private qml-private quick-private widgets-private v8-private testlib +QT += core-private gui-private qml-private quick-private v8-private testlib cross_compile: DEFINES += QTEST_CROSS_COMPILED diff --git a/tests/auto/quick/geometry/geometry.pro b/tests/auto/quick/geometry/geometry.pro index 41fcab7c8f..0b7e64d038 100644 --- a/tests/auto/quick/geometry/geometry.pro +++ b/tests/auto/quick/geometry/geometry.pro @@ -6,4 +6,4 @@ SOURCES += tst_geometry.cpp CONFIG+=parallel_test -QT += core-private gui-private qml-private quick-private opengl testlib +QT += core-private gui-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquickanimations/qquickanimations.pro b/tests/auto/quick/qquickanimations/qquickanimations.pro index d9c3ea28c1..5c0bd3a2d4 100644 --- a/tests/auto/quick/qquickanimations/qquickanimations.pro +++ b/tests/auto/quick/qquickanimations/qquickanimations.pro @@ -10,7 +10,7 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib widgets # QTBUG-23385 - color mixing tests failing on Ubuntu 11.10 x64 linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):DEFINES+=UBUNTU_ONEIRIC diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp index dd010999b4..d71100d120 100644 --- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp +++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp @@ -190,9 +190,6 @@ void tst_qquickanimations::simpleColor() QVERIFY(animation.isPaused()); animation.setCurrentTime(125); QVERIFY(animation.currentTime() == 125); -#if defined(UBUNTU_ONEIRIC) && defined(__x86_64__) - QEXPECT_FAIL("", "Fails on this platform - QTBUG-23385", Abort); -#endif QCOMPARE(rect.color(), QColor::fromRgbF(0.498039, 0, 0.498039, 1)); rect.setColor(QColor("green")); @@ -746,9 +743,6 @@ void tst_qquickanimations::mixedTypes() //rather inexact -- is there a better way? QVERIFY(myRect->x() > 100 && myRect->x() < 200); -#if defined(UBUNTU_ONEIRIC) && defined(__x86_64__) - QEXPECT_FAIL("", "Fails on this platform - QTBUG-23385", Continue); -#endif QVERIFY(myRect->color() != QColor("red") && myRect->color() != QColor("blue")); } } diff --git a/tests/auto/quick/qquickbehaviors/qquickbehaviors.pro b/tests/auto/quick/qquickbehaviors/qquickbehaviors.pro index dcffad6cd9..e8165c271c 100644 --- a/tests/auto/quick/qquickbehaviors/qquickbehaviors.pro +++ b/tests/auto/quick/qquickbehaviors/qquickbehaviors.pro @@ -10,4 +10,4 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquickborderimage/qquickborderimage.pro b/tests/auto/quick/qquickborderimage/qquickborderimage.pro index c967d579e5..998b66f89b 100644 --- a/tests/auto/quick/qquickborderimage/qquickborderimage.pro +++ b/tests/auto/quick/qquickborderimage/qquickborderimage.pro @@ -12,4 +12,4 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private qml-private quick-private network widgets testlib +QT += core-private gui-private qml-private quick-private network testlib diff --git a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp index 13b12f6020..173f230203 100644 --- a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp +++ b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp @@ -43,7 +43,6 @@ #include <QTcpServer> #include <QTcpSocket> #include <QDir> -#include <QGraphicsScene> #include <QPainter> #include <QtQml/qqmlengine.h> diff --git a/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro b/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro index b0122f997a..6d5706b9f7 100644 --- a/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro +++ b/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro @@ -1,4 +1,4 @@ -QT += core-private gui-private qml-private widgets +QT += core-private gui-private qml-private TEMPLATE=app TARGET=tst_qquickcanvasitem diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index e46659e6d0..a2ecadf33a 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -50,7 +50,6 @@ #include "../../shared/util.h" #include "../shared/viewtestutil.h" #include "../shared/visualtestutil.h" -#include <QtOpenGL/QGLShaderProgram> using namespace QQuickViewTestUtil; using namespace QQuickVisualTestUtil; diff --git a/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp b/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp index 2f399359ef..4fe155168a 100644 --- a/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp +++ b/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp @@ -47,7 +47,6 @@ #include <QFontMetrics> #include <QtQuick/private/qquickrectangle_p.h> #include <math.h> -#include <QtOpenGL/QGLShaderProgram> #include "../../shared/util.h" class tst_qquickflipable : public QQmlDataTest diff --git a/tests/auto/quick/qquickgridview/data/multipleDisplaced.qml b/tests/auto/quick/qquickgridview/data/multipleDisplaced.qml new file mode 100644 index 0000000000..7c48bf39ae --- /dev/null +++ b/tests/auto/quick/qquickgridview/data/multipleDisplaced.qml @@ -0,0 +1,81 @@ +import QtQuick 2.0 + +Rectangle { + id: root + width: 500 + height: 600 + + property int duration: 10 + property int count: grid.count + + Component { + id: myDelegate + Rectangle { + id: wrapper + + property string nameData: name + + objectName: "wrapper" + width: 80 + height: 60 + border.width: 1 + Column { + Text { text: index } + Text { + text: wrapper.x + ", " + wrapper.y + } + Text { + id: textName + objectName: "textName" + text: name + } + } + color: GridView.isCurrentItem ? "lightsteelblue" : "white" + } + } + + GridView { + id: grid + + property var displaceTransitionsStarted: new Object() + property bool displaceTransitionsDone: false + + objectName: "grid" + focus: true + anchors.centerIn: parent + width: 240 + height: 320 + cellWidth: 80 + cellHeight: 60 + model: testModel + delegate: myDelegate + + displaced: Transition { + id: transition + SequentialAnimation { + ScriptAction { + script: { + var name = transition.ViewTransition.item.nameData + if (grid.displaceTransitionsStarted[name] == undefined) + grid.displaceTransitionsStarted[name] = 0 + grid.displaceTransitionsStarted[name] += 1 + } + } + NumberAnimation { + properties: "x,y" + duration: root.duration + easing.type: Easing.OutBounce + easing.amplitude: 10.0 // longer-lasting bounce to trigger bug + } + PropertyAction { target: grid; property: "displaceTransitionsDone"; value: true } + } + } + } + + Rectangle { + anchors.fill: grid + color: "lightsteelblue" + opacity: 0.2 + } +} + diff --git a/tests/auto/quick/qquickgridview/data/snapOneRow.qml b/tests/auto/quick/qquickgridview/data/snapOneRow.qml index 3d32d75c45..597c5efa9c 100644 --- a/tests/auto/quick/qquickgridview/data/snapOneRow.qml +++ b/tests/auto/quick/qquickgridview/data/snapOneRow.qml @@ -37,7 +37,7 @@ Rectangle { flow: GridView.TopToBottom highlightRangeMode: GridView.StrictlyEnforceRange highlight: Rectangle { width: 120; height: 120; color: "yellow" } - model: 10 + model: 8 delegate: myDelegate } diff --git a/tests/auto/quick/qquickgridview/data/snapToRow.qml b/tests/auto/quick/qquickgridview/data/snapToRow.qml index f079a048f0..e3963b0c4a 100644 --- a/tests/auto/quick/qquickgridview/data/snapToRow.qml +++ b/tests/auto/quick/qquickgridview/data/snapToRow.qml @@ -37,7 +37,7 @@ Rectangle { flow: GridView.TopToBottom highlightRangeMode: GridView.StrictlyEnforceRange highlight: Rectangle { width: 80; height: 80; color: "yellow" } - model: 54 + model: 39 delegate: myDelegate } diff --git a/tests/auto/quick/qquickgridview/qquickgridview.pro b/tests/auto/quick/qquickgridview/qquickgridview.pro index b4a234e35a..ed2007d734 100644 --- a/tests/auto/quick/qquickgridview/qquickgridview.pro +++ b/tests/auto/quick/qquickgridview/qquickgridview.pro @@ -10,4 +10,4 @@ include (../shared/util.pri) TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib widgets +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index 04bdfc8ac3..7d004915a6 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -142,6 +142,7 @@ private slots: void displacedTransitions_data(); void multipleTransitions(); void multipleTransitions_data(); + void multipleDisplaced(); private: QList<int> toIntList(const QVariantList &list); @@ -693,8 +694,7 @@ void tst_QQuickGridView::removed() QTRY_VERIFY(gridview->currentItem() != oldCurrent); gridview->setContentY(0); - // let transitions settle. - QTest::qWait(300); + QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); // Confirm items positioned correctly itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); @@ -968,7 +968,7 @@ void tst_QQuickGridView::addOrRemoveBeforeVisible() QTRY_COMPARE(gridview->currentIndex(), 24); QTRY_COMPARE(gridview->contentY(), 220.0); - QTest::qWait(100); // wait for refill to complete + QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QTRY_VERIFY(!findItem<QQuickItem>(contentItem, "wrapper", 0)); // 0 shouldn't be visible if (doAdd) { @@ -2809,6 +2809,11 @@ void tst_QQuickGridView::footer() QCOMPARE(footer->height(), 30.); QCOMPARE(QPointF(gridview->contentX(), gridview->contentY()), initialContentPos); + if (flow == QQuickGridView::LeftToRight) + QCOMPARE(gridview->contentHeight(), (model.count()+2) / 3 * 60. + footer->height()); + else + QCOMPARE(gridview->contentWidth(), (model.count()+3) / 5 * 80. + footer->width()); + QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0); QVERIFY(item); QCOMPARE(item->pos(), firstDelegatePos); @@ -2970,6 +2975,11 @@ void tst_QQuickGridView::header() QCOMPARE(header->height(), 30.); QCOMPARE(QPointF(gridview->contentX(), gridview->contentY()), initialContentPos); + if (flow == QQuickGridView::LeftToRight) + QCOMPARE(gridview->contentHeight(), (model.count()+2) / 3 * 60. + header->height()); + else + QCOMPARE(gridview->contentWidth(), (model.count()+3) / 5 * 80. + header->width()); + QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0); QVERIFY(item); QCOMPARE(item->pos(), firstDelegatePos); @@ -3563,22 +3573,22 @@ void tst_QQuickGridView::snapToRow_data() QTest::addColumn<qreal>("startExtent"); QTest::newRow("vertical, left to right") << QQuickGridView::LeftToRight << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange) - << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 1200.0 << 0.0; + << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 800.0 << 0.0; QTest::newRow("horizontal, left to right") << QQuickGridView::TopToBottom << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange) - << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 1200.0 << 0.0; + << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 800.0 << 0.0; QTest::newRow("horizontal, right to left") << QQuickGridView::TopToBottom << Qt::RightToLeft << int(QQuickItemView::NoHighlightRange) - << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -1200.0 - 240.0 << -240.0; + << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -800.0 - 240.0 << -240.0; QTest::newRow("vertical, left to right, enforce range") << QQuickGridView::LeftToRight << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 1340.0 << -20.0; + << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 940.0 << -20.0; QTest::newRow("horizontal, left to right, enforce range") << QQuickGridView::TopToBottom << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 1340.0 << -20.0; + << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 940.0 << -20.0; QTest::newRow("horizontal, right to left, enforce range") << QQuickGridView::TopToBottom << Qt::RightToLeft << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -1200.0 - 240.0 - 140.0 << -220.0; + << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -800.0 - 240.0 - 140.0 << -220.0; } void tst_QQuickGridView::snapToRow() @@ -3658,22 +3668,22 @@ void tst_QQuickGridView::snapOneRow_data() QTest::addColumn<qreal>("startExtent"); QTest::newRow("vertical, left to right") << QQuickGridView::LeftToRight << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange) - << QPoint(20, 200) << QPoint(20, 20) << 100.0 << 360.0 << 0.0; + << QPoint(20, 200) << QPoint(20, 20) << 100.0 << 240.0 << 0.0; QTest::newRow("horizontal, left to right") << QQuickGridView::TopToBottom << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange) - << QPoint(200, 20) << QPoint(20, 20) << 100.0 << 360.0 << 0.0; + << QPoint(200, 20) << QPoint(20, 20) << 100.0 << 240.0 << 0.0; QTest::newRow("horizontal, right to left") << QQuickGridView::TopToBottom << Qt::RightToLeft << int(QQuickItemView::NoHighlightRange) - << QPoint(20, 20) << QPoint(200, 20) << -340.0 << -360.0 - 240.0 << -240.0; + << QPoint(20, 20) << QPoint(200, 20) << -340.0 << -240.0 - 240.0 << -240.0; QTest::newRow("vertical, left to right, enforce range") << QQuickGridView::LeftToRight << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(20, 200) << QPoint(20, 20) << 100.0 << 460.0 << -20.0; + << QPoint(20, 200) << QPoint(20, 20) << 100.0 << 340.0 << -20.0; QTest::newRow("horizontal, left to right, enforce range") << QQuickGridView::TopToBottom << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(200, 20) << QPoint(20, 20) << 100.0 << 460.0 << -20.0; + << QPoint(200, 20) << QPoint(20, 20) << 100.0 << 340.0 << -20.0; QTest::newRow("horizontal, right to left, enforce range") << QQuickGridView::TopToBottom << Qt::RightToLeft << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(20, 20) << QPoint(200, 20) << -340.0 << -360.0 - 240.0 - 100.0 << -220.0; + << QPoint(20, 20) << QPoint(200, 20) << -340.0 << -240.0 - 240.0 - 100.0 << -220.0; } void tst_QQuickGridView::snapOneRow() @@ -3728,8 +3738,8 @@ void tst_QQuickGridView::snapOneRow() : layoutDirection == Qt::LeftToRight ? !gridview->isAtXEnd() : !gridview->isAtXBeginning()); if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) { - QCOMPARE(gridview->currentIndex(), 8); - QCOMPARE(currentIndexSpy.count(), 4); + QCOMPARE(gridview->currentIndex(), 6); + QCOMPARE(currentIndexSpy.count(), 3); } if (flow == QQuickGridView::LeftToRight) @@ -3752,7 +3762,7 @@ void tst_QQuickGridView::snapOneRow() if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) { QCOMPARE(gridview->currentIndex(), 0); - QCOMPARE(currentIndexSpy.count(), 8); + QCOMPARE(currentIndexSpy.count(), 6); } delete canvas; @@ -4975,6 +4985,55 @@ void tst_QQuickGridView::multipleTransitions_data() << true << true << false << false; } +void tst_QQuickGridView::multipleDisplaced() +{ + // multiple move() operations should only restart displace transitions for items that + // moved from previously set positions, and not those that have moved from their current + // item positions (which may e.g. still be changing from easing bounces in the last transition) + + QmlListModel model; + for (int i = 0; i < 30; i++) + model.addItem("Original item" + QString::number(i), ""); + + QQuickView *canvas = createView(); + QQmlContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + canvas->setSource(testFileUrl("multipleDisplaced.qml")); + canvas->show(); + QTest::qWaitForWindowShown(canvas); + + QQuickGridView *gridview = findItem<QQuickGridView>(canvas->rootObject(), "grid"); + QTRY_VERIFY(gridview != 0); + QQuickItem *contentItem = gridview->contentItem(); + QVERIFY(contentItem != 0); + QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); + + model.moveItems(12, 8, 1); + QTest::qWait(canvas->rootObject()->property("duration").toInt() / 2); + model.moveItems(8, 3, 1); + QTRY_VERIFY(gridview->property("displaceTransitionsDone").toBool()); + + QVariantMap transitionsStarted = gridview->property("displaceTransitionsStarted").toMap(); + foreach (const QString &name, transitionsStarted.keys()) { + QVERIFY2(transitionsStarted[name] == 1, + QTest::toString(QString("%1 was displaced %2 times").arg(name).arg(transitionsStarted[name].toInt()))); + } + + // verify all items moved to the correct final positions + QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); + for (int i=0; i < model.count() && i < items.count(); ++i) { + QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); + QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); + QTRY_COMPARE(item->x(), (i%3)*80.0); + QTRY_COMPARE(item->y(), (i/3)*60.0); + QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); + QVERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); + } + + delete canvas; +} + void tst_QQuickGridView::cacheBuffer() { QQuickView *canvas = createView(); diff --git a/tests/auto/quick/qquickitem/qquickitem.pro b/tests/auto/quick/qquickitem/qquickitem.pro index cbbd6e586b..ee40be6a2e 100644 --- a/tests/auto/quick/qquickitem/qquickitem.pro +++ b/tests/auto/quick/qquickitem/qquickitem.pro @@ -9,4 +9,4 @@ macx:CONFIG -= app_bundle TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private widgets testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquickitem2/qquickitem2.pro b/tests/auto/quick/qquickitem2/qquickitem2.pro index 887c8796a8..589d1bd568 100644 --- a/tests/auto/quick/qquickitem2/qquickitem2.pro +++ b/tests/auto/quick/qquickitem2/qquickitem2.pro @@ -10,4 +10,4 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquicklistview/data/multipleDisplaced.qml b/tests/auto/quick/qquicklistview/data/multipleDisplaced.qml new file mode 100644 index 0000000000..e315270360 --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/multipleDisplaced.qml @@ -0,0 +1,78 @@ +import QtQuick 2.0 + +Rectangle { + id: root + width: 500 + height: 600 + + property int duration: 10 + property int count: list.count + + Component { + id: myDelegate + Rectangle { + id: wrapper + + property string nameData: name + + objectName: "wrapper" + height: 20 + width: 240 + Text { text: index } + Text { + x: 30 + id: textName + objectName: "textName" + text: name + } + Text { + x: 200 + text: wrapper.y + } + color: ListView.isCurrentItem ? "lightsteelblue" : "white" + } + } + + ListView { + id: list + + property var displaceTransitionsStarted: new Object() + property bool displaceTransitionsDone: false + + objectName: "list" + focus: true + anchors.centerIn: parent + width: 240 + height: 320 + model: testModel + delegate: myDelegate + + displaced: Transition { + id: transition + SequentialAnimation { + ScriptAction { + script: { + var name = transition.ViewTransition.item.nameData + if (list.displaceTransitionsStarted[name] == undefined) + list.displaceTransitionsStarted[name] = 0 + list.displaceTransitionsStarted[name] += 1 + } + } + NumberAnimation { + properties: "x,y" + duration: root.duration + easing.type: Easing.OutBounce + easing.amplitude: 10.0 // longer-lasting bounce to trigger bug + } + PropertyAction { target: list; property: "displaceTransitionsDone"; value: true } + } + } + } + + Rectangle { + anchors.fill: list + color: "lightsteelblue" + opacity: 0.2 + } +} + diff --git a/tests/auto/quick/qquicklistview/data/snapToItem.qml b/tests/auto/quick/qquicklistview/data/snapToItem.qml index 6f201072f0..91d31adfc7 100644 --- a/tests/auto/quick/qquicklistview/data/snapToItem.qml +++ b/tests/auto/quick/qquicklistview/data/snapToItem.qml @@ -37,7 +37,7 @@ Rectangle { layoutDirection: Qt.RightToLeft highlightRangeMode: ListView.StrictlyEnforceRange highlight: Rectangle { width: 80; height: 80; color: "yellow" } - model: 18 + model: 10 delegate: myDelegate } diff --git a/tests/auto/quick/qquicklistview/qquicklistview.pro b/tests/auto/quick/qquicklistview/qquicklistview.pro index d4d97e2106..c1b24baed4 100644 --- a/tests/auto/quick/qquicklistview/qquicklistview.pro +++ b/tests/auto/quick/qquicklistview/qquicklistview.pro @@ -11,4 +11,4 @@ include (../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private qml-private quick-private widgets widgets-private v8-private opengl-private testlib +QT += core-private gui-private qml-private quick-private v8-private testlib diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index c038faa0f1..1a494183a8 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -183,6 +183,7 @@ private slots: void displacedTransitions_data(); void multipleTransitions(); void multipleTransitions_data(); + void multipleDisplaced(); void flickBeyondBounds(); @@ -826,7 +827,6 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) listview->setContentY(20); // That's the top now // let transitions settle. QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); - QTest::qWait(300); // Confirm items positioned correctly itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); @@ -857,7 +857,6 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) listview->setContentY(80); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); - QTest::qWait(300); // remove all visible items model.removeItems(1, 18); @@ -3056,6 +3055,11 @@ void tst_QQuickListView::header() QCOMPARE(header->pos(), initialHeaderPos); QCOMPARE(QPointF(listview->contentX(), listview->contentY()), initialContentPos); + if (orientation == QQuickListView::Vertical) + QCOMPARE(listview->contentHeight(), model.count() * 30. + header->height()); + else + QCOMPARE(listview->contentWidth(), model.count() * 240. + header->width()); + QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0); QVERIFY(item); QCOMPARE(item->pos(), firstDelegatePos); @@ -3240,6 +3244,11 @@ void tst_QQuickListView::footer() QCOMPARE(footer->height(), 30.); QCOMPARE(QPointF(listview->contentX(), listview->contentY()), initialContentPos); + if (orientation == QQuickListView::Vertical) + QCOMPARE(listview->contentHeight(), model.count() * 20. + footer->height()); + else + QCOMPARE(listview->contentWidth(), model.count() * 40. + footer->width()); + QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0); QVERIFY(item); QCOMPARE(item->pos(), firstDelegatePos); @@ -4240,22 +4249,22 @@ void tst_QQuickListView::snapToItem_data() QTest::addColumn<qreal>("startExtent"); QTest::newRow("vertical, left to right") << QQuickListView::Vertical << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange) - << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 1200.0 << 0.0; + << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 560.0 << 0.0; QTest::newRow("horizontal, left to right") << QQuickListView::Horizontal << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange) - << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 1200.0 << 0.0; + << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 560.0 << 0.0; QTest::newRow("horizontal, right to left") << QQuickListView::Horizontal << Qt::RightToLeft << int(QQuickItemView::NoHighlightRange) - << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -1200.0 - 240.0 << -240.0; + << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -560.0 - 240.0 << -240.0; QTest::newRow("vertical, left to right, enforce range") << QQuickListView::Vertical << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 1340.0 << -20.0; + << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 700.0 << -20.0; QTest::newRow("horizontal, left to right, enforce range") << QQuickListView::Horizontal << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 1340.0 << -20.0; + << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 700.0 << -20.0; QTest::newRow("horizontal, right to left, enforce range") << QQuickListView::Horizontal << Qt::RightToLeft << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -1200.0 - 240.0 - 140.0 << -220.0; + << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -560.0 - 240.0 - 140.0 << -220.0; } void tst_QQuickListView::snapToItem() @@ -5977,6 +5986,56 @@ void tst_QQuickListView::multipleTransitions_data() << true << true << false << false; } +void tst_QQuickListView::multipleDisplaced() +{ + // multiple move() operations should only restart displace transitions for items that + // moved from previously set positions, and not those that have moved from their current + // item positions (which may e.g. still be changing from easing bounces in the last transition) + + QmlListModel model; + for (int i = 0; i < 30; i++) + model.addItem("Original item" + QString::number(i), ""); + + QQuickView *canvas = createView(); + QQmlContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testObject", new TestObject(canvas)); + canvas->setSource(testFileUrl("multipleDisplaced.qml")); + canvas->show(); + QTest::qWaitForWindowShown(canvas); + + QQuickListView *listview = findItem<QQuickListView>(canvas->rootObject(), "list"); + QTRY_VERIFY(listview != 0); + QQuickItem *contentItem = listview->contentItem(); + QVERIFY(contentItem != 0); + QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); + + model.moveItems(12, 8, 1); + QTest::qWait(canvas->rootObject()->property("duration").toInt() / 2); + model.moveItems(8, 3, 1); + QTRY_VERIFY(listview->property("displaceTransitionsDone").toBool()); + + QVariantMap transitionsStarted = listview->property("displaceTransitionsStarted").toMap(); + foreach (const QString &name, transitionsStarted.keys()) { + QVERIFY2(transitionsStarted[name] == 1, + QTest::toString(QString("%1 was displaced %2 times").arg(name).arg(transitionsStarted[name].toInt()))); + } + + // verify all items moved to the correct final positions + QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); + for (int i=0; i < model.count() && i < items.count(); ++i) { + QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); + QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); + QTRY_COMPARE(item->x(), 0.0); + QTRY_COMPARE(item->y(), i*20.0); + QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); + QVERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); + } + + delete canvas; +} + QList<int> tst_QQuickListView::toIntList(const QVariantList &list) { QList<int> ret; diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 0b4a6fa438..a4b04bb88a 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -47,7 +47,6 @@ #include <QtQuick/qquickview.h> #include <QtQml/qqmlcontext.h> #include <QtQml/qqmlengine.h> -#include <QtOpenGL/QGLShaderProgram> #include "../../shared/util.h" //#define OLDWAY @@ -468,6 +467,8 @@ void tst_QQuickMouseArea::doubleClick() canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); + // The sequence for a double click is: + // press, release, (click), press, double click, release QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(canvas, &pressEvent); @@ -476,9 +477,9 @@ void tst_QQuickMouseArea::doubleClick() QCOMPARE(canvas->rootObject()->property("released").toInt(), 1); + QGuiApplication::sendEvent(canvas, &pressEvent); pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(canvas, &pressEvent); - QGuiApplication::sendEvent(canvas, &releaseEvent); QCOMPARE(canvas->rootObject()->property("clicked").toInt(), 1); @@ -507,9 +508,8 @@ void tst_QQuickMouseArea::clickTwice() QCOMPARE(canvas->rootObject()->property("released").toInt(), 1); QCOMPARE(canvas->rootObject()->property("clicked").toInt(), 1); - pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(canvas, &pressEvent); - + pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(canvas, &pressEvent); QGuiApplication::sendEvent(canvas, &releaseEvent); @@ -787,13 +787,17 @@ void tst_QQuickMouseArea::hoverVisible() QSignalSpy enteredSpy(mouseTracker, SIGNAL(entered())); - QTest::mouseMove(canvas,QPoint(10,32)); + // Note: We need to use a position that is different from the position in the last event + // generated in the previous test case. Otherwise it is not interpreted as a move. + QTest::mouseMove(canvas,QPoint(11,33)); QCOMPARE(mouseTracker->hovered(), false); QCOMPARE(enteredSpy.count(), 0); mouseTracker->setVisible(true); + QTest::mouseMove(canvas,QPoint(10,31)); + QCOMPARE(mouseTracker->hovered(), true); QCOMPARE(enteredSpy.count(), 1); diff --git a/tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro b/tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro index a13b0b6f43..a24ea52e11 100644 --- a/tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro +++ b/tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro @@ -15,5 +15,6 @@ TESTDATA = data/* # LIBS += -lgcov CONFIG += parallel_test +CONFIG += insignificant_test QT += core-private gui-private qml-private quick-private network testlib concurrent diff --git a/tests/auto/quick/qquickpositioners/qquickpositioners.pro b/tests/auto/quick/qquickpositioners/qquickpositioners.pro index 243d03484a..dbbfae0ebf 100644 --- a/tests/auto/quick/qquickpositioners/qquickpositioners.pro +++ b/tests/auto/quick/qquickpositioners/qquickpositioners.pro @@ -10,4 +10,4 @@ macx:CONFIG -= app_bundle TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquickrepeater/data/dynamicmodelcrash.qml b/tests/auto/quick/qquickrepeater/data/dynamicmodelcrash.qml new file mode 100644 index 0000000000..0280df0620 --- /dev/null +++ b/tests/auto/quick/qquickrepeater/data/dynamicmodelcrash.qml @@ -0,0 +1,20 @@ +import QtQuick 2.0 + +Item { + ListModel { + id: lm; + } + + Component.onCompleted: { + lm.append({ subModel: [ {d:0} ] }); + rep.model = lm.get(0).subModel; + rep.model; + lm.remove(0); + rep.model; + } + + Repeater { + objectName: "rep" + id: rep + } +} diff --git a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp index 1b07a6e9f8..d9cbed093a 100644 --- a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp +++ b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp @@ -77,6 +77,7 @@ private slots: void properties(); void asynchronous(); void initParent(); + void dynamicModelCrash(); }; class TestObject : public QObject @@ -639,6 +640,20 @@ void tst_QQuickRepeater::initParent() QCOMPARE(qvariant_cast<QQuickItem*>(rootObject->property("parentItem")), rootObject); } +void tst_QQuickRepeater::dynamicModelCrash() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("dynamicmodelcrash.qml")); + + // Don't crash + QQuickItem *rootObject = qobject_cast<QQuickItem*>(component.create()); + QVERIFY(rootObject); + + QQuickRepeater *repeater = findItem<QQuickRepeater>(rootObject, "rep"); + QVERIFY(repeater); + QVERIFY(qvariant_cast<QObject *>(repeater->model()) == 0); +} + QTEST_MAIN(tst_QQuickRepeater) #include "tst_qquickrepeater.moc" diff --git a/tests/auto/quick/qquickshadereffect/qquickshadereffect.pro b/tests/auto/quick/qquickshadereffect/qquickshadereffect.pro index 6ff50a0553..142d368aed 100644 --- a/tests/auto/quick/qquickshadereffect/qquickshadereffect.pro +++ b/tests/auto/quick/qquickshadereffect/qquickshadereffect.pro @@ -5,4 +5,4 @@ SOURCES += tst_qquickshadereffect.cpp macx:CONFIG -= app_bundle CONFIG += parallel_test -QT += core-private gui-private qml-private quick-private widgets testlib +QT += core-private gui-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquickstates/qquickstates.pro b/tests/auto/quick/qquickstates/qquickstates.pro index 5f2b8cd2de..783e1097dd 100644 --- a/tests/auto/quick/qquickstates/qquickstates.pro +++ b/tests/auto/quick/qquickstates/qquickstates.pro @@ -9,4 +9,4 @@ include (../../shared/util.pri) TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquicktext/qquicktext.pro b/tests/auto/quick/qquicktext/qquicktext.pro index 53e170a115..8932664fa3 100644 --- a/tests/auto/quick/qquicktext/qquicktext.pro +++ b/tests/auto/quick/qquicktext/qquicktext.pro @@ -14,4 +14,4 @@ TESTDATA = data/* CONFIG += parallel_test -QT += core-private gui-private v8-private qml-private quick-private widgets-private opengl-private network testlib +QT += core-private gui-private v8-private qml-private quick-private network testlib diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 54b5a04466..92e8528a0d 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -47,10 +47,9 @@ #include <private/qquicktext_p_p.h> #include <private/qqmlvaluetype_p.h> #include <QFontMetrics> -#include <QGraphicsSceneMouseEvent> #include <qmath.h> #include <QtQuick/QQuickView> -#include <private/qapplication_p.h> +#include <private/qguiapplication_p.h> #include <limits.h> #include <QtGui/QMouseEvent> #include "../../shared/util.h" diff --git a/tests/auto/quick/qquicktextedit/qquicktextedit.pro b/tests/auto/quick/qquicktextedit/qquicktextedit.pro index 23459f2a91..83250030de 100644 --- a/tests/auto/quick/qquicktextedit/qquicktextedit.pro +++ b/tests/auto/quick/qquicktextedit/qquicktextedit.pro @@ -11,4 +11,4 @@ include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private network widgets-private testlib +QT += core-private gui-private v8-private qml-private quick-private network-private testlib diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index 85a9033dd7..a90b23dfd7 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -55,7 +55,6 @@ #include <QFontMetrics> #include <QtQuick/QQuickView> #include <QDir> -#include <QStyle> #include <QInputMethod> #include <QClipboard> #include <QMimeData> @@ -1855,6 +1854,7 @@ void tst_qquicktextedit::cursorDelegate() textEditObject->setSelectByMouse(true); textEditObject->setCursorPosition(0); const QPoint point1 = textEditObject->positionToRectangle(5).center().toPoint(); + QTest::qWait(400); //ensure this isn't treated as a double-click QTest::mouseClick(&view, Qt::LeftButton, 0, point1); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); @@ -1864,6 +1864,7 @@ void tst_qquicktextedit::cursorDelegate() // Test delegate gets moved on mouse drag textEditObject->setCursorPosition(0); const QPoint point2 = textEditObject->positionToRectangle(10).center().toPoint(); + QTest::qWait(400); //ensure this isn't treated as a double-click QTest::mousePress(&view, Qt::LeftButton, 0, point1); QMouseEvent mv(QEvent::MouseMove, point2, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); QGuiApplication::sendEvent(&view, &mv); @@ -1874,6 +1875,7 @@ void tst_qquicktextedit::cursorDelegate() textEditObject->setReadOnly(true); textEditObject->setCursorPosition(0); + QTest::qWait(400); //ensure this isn't treated as a double-click QTest::mouseClick(&view, Qt::LeftButton, 0, textEditObject->positionToRectangle(5).center().toPoint()); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); @@ -1881,6 +1883,7 @@ void tst_qquicktextedit::cursorDelegate() QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y()); textEditObject->setCursorPosition(0); + QTest::qWait(400); //ensure this isn't treated as a double-click QTest::mouseClick(&view, Qt::LeftButton, 0, textEditObject->positionToRectangle(5).center().toPoint()); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); diff --git a/tests/auto/quick/qquicktextinput/qquicktextinput.pro b/tests/auto/quick/qquicktextinput/qquicktextinput.pro index 046e6abcad..13b087eef5 100644 --- a/tests/auto/quick/qquicktextinput/qquicktextinput.pro +++ b/tests/auto/quick/qquicktextinput/qquicktextinput.pro @@ -8,4 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib +QT += core-private gui-private v8-private qml-private quick-private testlib diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index bdd18d620e..c5db92af45 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -53,8 +53,6 @@ #include <private/qquicktextinput_p_p.h> #include <QDebug> #include <QDir> -#include <QStyle> -#include <QtOpenGL/QGLShaderProgram> #include <math.h> #ifdef Q_OS_MAC |