diff options
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp | 137 | ||||
-rw-r--r-- | tests/auto/gui.pro | 1 | ||||
-rw-r--r-- | tests/auto/qdatetime/tst_qdatetime.cpp | 71 | ||||
-rw-r--r-- | tests/auto/qguard/qguard.pro | 2 | ||||
-rw-r--r-- | tests/auto/qguard/tst_qguard.cpp | 350 | ||||
-rw-r--r-- | tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp | 4 | ||||
-rw-r--r-- | tests/auto/uic/baseline/config_fromuic3.ui.h | 1 | ||||
-rw-r--r-- | tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h | 1 |
8 files changed, 140 insertions, 427 deletions
diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp index 56166f2..7d51bb6 100644 --- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp +++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp @@ -43,7 +43,6 @@ #include <QtDeclarative/qdeclarativecomponent.h> #include <QtDeclarative/qdeclarativeproperty.h> #include <QtDeclarative/private/qdeclarativeproperty_p.h> -#include <private/qguard_p.h> #include <private/qdeclarativebinding_p.h> #include <QtGui/QLineEdit> #include <QtCore/qfileinfo.h> @@ -138,9 +137,9 @@ void tst_qdeclarativeproperty::qmlmetaproperty() { QDeclarativeProperty prop; - QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QWeakPointer<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); - QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QWeakPointer<QDeclarativeExpression> expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -169,10 +168,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty() QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -234,9 +233,9 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object() { QDeclarativeProperty prop(&object); - QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QWeakPointer<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); - QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QWeakPointer<QDeclarativeExpression> expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -265,10 +264,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object() QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -279,10 +278,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object() { QDeclarativeProperty prop(&dobject); - QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QWeakPointer<QDeclarativeExpression> expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -312,11 +311,11 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object() QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int"); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding != 0); - QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding.data()); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -333,9 +332,9 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() { QDeclarativeProperty prop(&object, QString("defaultProperty")); - QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QWeakPointer<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); - QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QWeakPointer<QDeclarativeExpression> expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -364,10 +363,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -378,10 +377,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() { QDeclarativeProperty prop(&dobject, QString("defaultProperty")); - QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QWeakPointer<QDeclarativeExpression> expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -411,11 +410,11 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int"); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding != 0); - QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding.data()); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -426,10 +425,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() { QDeclarativeProperty prop(&dobject, QString("onClicked")); - QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QWeakPointer<QDeclarativeExpression> expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -458,12 +457,12 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression != 0); - QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression.data()); QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("clicked()")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -473,10 +472,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() { QDeclarativeProperty prop(&dobject, QString("onPropertyWithNotifyChanged")); - QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QWeakPointer<QDeclarativeExpression> expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -505,12 +504,12 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression != 0); - QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression.data()); QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("oddlyNamedNotifySignal()")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -526,9 +525,9 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context() { QDeclarativeProperty prop(&object, engine.rootContext()); - QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QWeakPointer<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); - QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QWeakPointer<QDeclarativeExpression> expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -557,10 +556,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context() QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -571,10 +570,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context() { QDeclarativeProperty prop(&dobject, engine.rootContext()); - QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QWeakPointer<QDeclarativeExpression> expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -604,11 +603,11 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context() QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int"); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding != 0); - QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding.data()); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -625,9 +624,9 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() { QDeclarativeProperty prop(&object, QString("defaultProperty"), engine.rootContext()); - QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QWeakPointer<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); - QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QWeakPointer<QDeclarativeExpression> expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -656,10 +655,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -670,10 +669,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() { QDeclarativeProperty prop(&dobject, QString("defaultProperty"), engine.rootContext()); - QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QWeakPointer<QDeclarativeExpression> expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -703,11 +702,11 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int"); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding != 0); - QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding.data()); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -718,10 +717,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() { QDeclarativeProperty prop(&dobject, QString("onClicked"), engine.rootContext()); - QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QWeakPointer<QDeclarativeExpression> expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -750,12 +749,12 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression != 0); - QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression.data()); QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("clicked()")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -765,10 +764,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() { QDeclarativeProperty prop(&dobject, QString("onPropertyWithNotifyChanged"), engine.rootContext()); - QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QWeakPointer<QDeclarativeExpression> expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -797,12 +796,12 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression != 0); - QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression.data()); QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("oddlyNamedNotifySignal()")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); diff --git a/tests/auto/gui.pro b/tests/auto/gui.pro index 10a760c..a8fd2b4 100644 --- a/tests/auto/gui.pro +++ b/tests/auto/gui.pro @@ -78,7 +78,6 @@ SUBDIRS=\ qgraphicswidget \ qgridlayout \ qgroupbox \ - qguard \ qguivariant \ qheaderview \ qhelpcontentmodel \ diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index a6b9a5f..6aca996 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -83,6 +83,8 @@ private slots: void setTime(); void setTimeSpec(); void setTime_t(); + void setMSecsSinceEpoch_data(); + void setMSecsSinceEpoch(); void toString_enumformat(); void toString_strformat_data(); void toString_strformat(); @@ -437,6 +439,71 @@ void tst_QDateTime::setTime_t() } } +void tst_QDateTime::setMSecsSinceEpoch_data() +{ + QTest::addColumn<qint64>("msecs"); + QTest::addColumn<QDateTime>("utc"); + QTest::addColumn<QDateTime>("european"); + + QTest::newRow("zero") + << Q_INT64_C(0) + << QDateTime(QDate(1970, 1, 1), QTime(), Qt::UTC) + << QDateTime(QDate(1970, 1, 1), QTime(1, 0)); + QTest::newRow("-1") + << Q_INT64_C(-1) + << QDateTime(QDate(1969, 12, 31), QTime(23, 59, 59, 999), Qt::UTC) + << QDateTime(QDate(1970, 1, 1), QTime(0, 59, 59, 999)); + QTest::newRow("123456789") + << Q_INT64_C(123456789) + << QDateTime(QDate(1970, 1, 2), QTime(10, 17, 36, 789), Qt::UTC) + << QDateTime(QDate(1970, 1, 2), QTime(11, 17, 36, 789), Qt::LocalTime); + QTest::newRow("-123456789") + << Q_INT64_C(-123456789) + << QDateTime(QDate(1969, 12, 30), QTime(13, 42, 23, 211), Qt::UTC) + << QDateTime(QDate(1969, 12, 30), QTime(14, 42, 23, 211), Qt::LocalTime); + QTest::newRow("non-time_t") + << (Q_INT64_C(1000) << 32) + << QDateTime(QDate(2106, 2, 7), QTime(6, 28, 16), Qt::UTC) + << QDateTime(QDate(2106, 2, 7), QTime(7, 28, 16)); + QTest::newRow("very-large") + << (Q_INT64_C(123456) << 32) + << QDateTime(QDate(18772, 8, 15), QTime(1, 8, 14, 976), Qt::UTC) + << QDateTime(QDate(18772, 8, 15), QTime(3, 8, 14, 976)); + QTest::newRow("min_date") // julian day 0 is an invalid date for QDate + << Q_INT64_C(-210866716800000) + << QDateTime(QDate::fromJulianDay(1), QTime(), Qt::UTC) + << QDateTime(QDate::fromJulianDay(1), QTime(1, 0)); + QTest::newRow("max_date") // technically jd is unsigned, but fromJulianDay takes int + << Q_INT64_C(185331720376799999) + << QDateTime(QDate::fromJulianDay(0x7fffffff), QTime(21, 59, 59, 999), Qt::UTC) + << QDateTime(QDate::fromJulianDay(0x7fffffff), QTime(23, 59, 59, 999)); +} + +void tst_QDateTime::setMSecsSinceEpoch() +{ + QFETCH(qint64, msecs); + QFETCH(QDateTime, utc); + QFETCH(QDateTime, european); + + QDateTime dt; + dt.setTimeSpec(Qt::UTC); + dt.setMSecsSinceEpoch(msecs); + + QCOMPARE(dt, utc); + if (europeanTimeZone) { + QCOMPARE(dt.toLocalTime(), european); + } + + QCOMPARE(dt.toMSecsSinceEpoch(), msecs); + + if (quint64(msecs / 1000) < 0xFFFFFFFF) { + QCOMPARE(qint64(dt.toTime_t()), msecs / 1000); + } + + QDateTime reference(QDate(1970, 1, 1), QTime(), Qt::UTC); + QCOMPARE(dt, reference.addMSecs(msecs)); +} + void tst_QDateTime::toString_enumformat() { QDateTime dt1(QDate(1995, 5, 20), QTime(12, 34, 56)); @@ -932,7 +999,7 @@ void tst_QDateTime::currentDateTimeUtc2() do { local = QDateTime::currentDateTime(); utc = QDateTime::currentDateTimeUtc(); - msec = QDateTime::currentMsecsSinceEpoch(); + msec = QDateTime::currentMSecsSinceEpoch(); ok = local.time().msec() == utc.time().msec() && utc.time().msec() == (msec % 1000); } while (--i && !ok); @@ -953,6 +1020,8 @@ void tst_QDateTime::currentDateTimeUtc2() // and finally, the time_t should equal our number QCOMPARE(qint64(utc.toTime_t()), msec / 1000); QCOMPARE(qint64(local.toTime_t()), msec / 1000); + QCOMPARE(utc.toMSecsSinceEpoch(), msec); + QCOMPARE(local.toMSecsSinceEpoch(), msec); } void tst_QDateTime::toTime_t_data() diff --git a/tests/auto/qguard/qguard.pro b/tests/auto/qguard/qguard.pro deleted file mode 100644 index f249dde..0000000 --- a/tests/auto/qguard/qguard.pro +++ /dev/null @@ -1,2 +0,0 @@ -load(qttest_p4) -SOURCES += tst_qguard.cpp diff --git a/tests/auto/qguard/tst_qguard.cpp b/tests/auto/qguard/tst_qguard.cpp deleted file mode 100644 index 465ad0e..0000000 --- a/tests/auto/qguard/tst_qguard.cpp +++ /dev/null @@ -1,350 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// NOTE: This is identical to the QPointer autotest - -#include <QtTest/QtTest> - -#include <QApplication> -#include <QDebug> -#include <QWidget> -#include <private/qguard_p.h> - -class tst_QGuard : public QObject -{ - Q_OBJECT -public: - tst_QGuard(); - ~tst_QGuard(); - - inline tst_QGuard *me() const - { return const_cast<tst_QGuard *>(this); } - -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); -private slots: - void constructors(); - void destructor(); - void assignment_operators(); - void equality_operators(); - void isNull(); - void dereference_operators(); - void disconnect(); - void castDuringDestruction(); - void data() const; - void dataSignature() const; -}; - -tst_QGuard::tst_QGuard() -{ } - -tst_QGuard::~tst_QGuard() -{ } - -void tst_QGuard::initTestCase() -{ } - -void tst_QGuard::cleanupTestCase() -{ } - -void tst_QGuard::init() -{ } - -void tst_QGuard::cleanup() -{ } - -void tst_QGuard::constructors() -{ - QGuard<QObject> p1; - QGuard<QObject> p2(this); - QGuard<QObject> p3(p2); - QCOMPARE(p1, QGuard<QObject>(0)); - QCOMPARE(p2, QGuard<QObject>(this)); - QCOMPARE(p3, QGuard<QObject>(this)); -} - -void tst_QGuard::destructor() -{ - QObject *object = new QObject; - QGuard<QObject> p = object; - QCOMPARE(p, QGuard<QObject>(object)); - delete object; - QCOMPARE(p, QGuard<QObject>(0)); -} - -void tst_QGuard::assignment_operators() -{ - QGuard<QObject> p1; - QGuard<QObject> p2; - - p1 = this; - p2 = p1; - - QCOMPARE(p1, QGuard<QObject>(this)); - QCOMPARE(p2, QGuard<QObject>(this)); - QCOMPARE(p1, QGuard<QObject>(p2)); - - p1 = 0; - p2 = p1; - QCOMPARE(p1, QGuard<QObject>(0)); - QCOMPARE(p2, QGuard<QObject>(0)); - QCOMPARE(p1, QGuard<QObject>(p2)); - - QObject *object = new QObject; - - p1 = object; - p2 = p1; - QCOMPARE(p1, QGuard<QObject>(object)); - QCOMPARE(p2, QGuard<QObject>(object)); - QCOMPARE(p1, QGuard<QObject>(p2)); - - delete object; - QCOMPARE(p1, QGuard<QObject>(0)); - QCOMPARE(p2, QGuard<QObject>(0)); - QCOMPARE(p1, QGuard<QObject>(p2)); -} - -void tst_QGuard::equality_operators() -{ - QGuard<QObject> p1; - QGuard<QObject> p2; - - QVERIFY(p1 == p2); - - QObject *object = 0; - QWidget *widget = 0; - - p1 = object; - QVERIFY(p1 == p2); - QVERIFY(p1 == object); - p2 = object; - QVERIFY(p2 == p1); - QVERIFY(p2 == object); - - p1 = this; - QVERIFY(p1 != p2); - p2 = p1; - QVERIFY(p1 == p2); - - // compare to zero - p1 = 0; - QVERIFY(p1 == 0); - QVERIFY(0 == p1); - QVERIFY(p2 != 0); - QVERIFY(0 != p2); - QVERIFY(p1 == object); - QVERIFY(object == p1); - QVERIFY(p2 != object); - QVERIFY(object != p2); - QVERIFY(p1 == widget); - QVERIFY(widget == p1); - QVERIFY(p2 != widget); - QVERIFY(widget != p2); -} - -void tst_QGuard::isNull() -{ - QGuard<QObject> p1; - QVERIFY(p1.isNull()); - p1 = this; - QVERIFY(!p1.isNull()); - p1 = 0; - QVERIFY(p1.isNull()); -} - -void tst_QGuard::dereference_operators() -{ - QGuard<tst_QGuard> p1 = this; - - QObject *object = p1->me(); - QVERIFY(object == this); - - QObject &ref = *p1; - QVERIFY(&ref == this); - - object = static_cast<QObject *>(p1); - QVERIFY(object == this); -} - -void tst_QGuard::disconnect() -{ - QGuard<QObject> p1 = new QObject; - QVERIFY(!p1.isNull()); - p1->disconnect(); - QVERIFY(!p1.isNull()); - delete static_cast<QObject *>(p1); - QVERIFY(p1.isNull()); -} - -class ChildObject : public QObject -{ - QGuard<QObject> guardedPointer; - -public: - ChildObject(QObject *parent) - : QObject(parent), guardedPointer(parent) - { } - ~ChildObject(); -}; - -ChildObject::~ChildObject() -{ - QCOMPARE(static_cast<QObject *>(guardedPointer), static_cast<QObject *>(0)); - QCOMPARE(qobject_cast<QObject *>(guardedPointer), static_cast<QObject *>(0)); -} - -class ChildWidget : public QWidget -{ - QGuard<QWidget> guardedPointer; - -public: - ChildWidget(QWidget *parent) - : QWidget(parent), guardedPointer(parent) - { } - ~ChildWidget(); -}; - -ChildWidget::~ChildWidget() -{ - QCOMPARE(static_cast<QWidget *>(guardedPointer), static_cast<QWidget *>(0)); - QCOMPARE(qobject_cast<QWidget *>(guardedPointer), static_cast<QWidget *>(0)); -} - -class DerivedChild; - -class DerivedParent : public QObject -{ - Q_OBJECT - - DerivedChild *derivedChild; - -public: - DerivedParent(); - ~DerivedParent(); -}; - -class DerivedChild : public QObject -{ - Q_OBJECT - - DerivedParent *parentPointer; - QGuard<DerivedParent> guardedParentPointer; - -public: - DerivedChild(DerivedParent *parent) - : QObject(parent), parentPointer(parent), guardedParentPointer(parent) - { } - ~DerivedChild(); -}; - -DerivedParent::DerivedParent() - : QObject() -{ - derivedChild = new DerivedChild(this); -} - -DerivedParent::~DerivedParent() -{ - delete derivedChild; -} - -DerivedChild::~DerivedChild() -{ - QCOMPARE(static_cast<DerivedParent *>(guardedParentPointer), parentPointer); - QCOMPARE(qobject_cast<DerivedParent *>(guardedParentPointer), parentPointer); -} - -void tst_QGuard::castDuringDestruction() -{ - { - QObject *parentObject = new QObject(); - (void) new ChildObject(parentObject); - delete parentObject; - } - - { - QWidget *parentWidget = new QWidget(); - (void) new ChildWidget(parentWidget); - delete parentWidget; - } - - { - delete new DerivedParent(); - } -} - -void tst_QGuard::data() const -{ - /* Check value of a default constructed object. */ - { - QGuard<QObject> p; - QCOMPARE(p.data(), static_cast<QObject *>(0)); - } - - /* Check value of a default constructed object. */ - { - QObject *const object = new QObject(); - QGuard<QObject> p(object); - QCOMPARE(p.data(), object); - } -} - -void tst_QGuard::dataSignature() const -{ - /* data() should be const. */ - { - const QGuard<QObject> p; - p.data(); - } - - /* The return type should be T. */ - { - const QGuard<QWidget> p; - /* If the types differs, the QCOMPARE will fail to instansiate. */ - QCOMPARE(p.data(), static_cast<QWidget *>(0)); - } -} - -QTEST_MAIN(tst_QGuard) -#include "tst_qguard.moc" diff --git a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp index a3dfd6c..5f9a578 100644 --- a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp +++ b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp @@ -255,10 +255,6 @@ tst_Suite::tst_Suite() addTestExclusion("string-case", "V8-specific behavior? (Doesn't pass on SpiderMonkey either)"); -#ifdef Q_CC_MINGW - addTestExclusion("date$", "QTBUG-7698: Date.prototype.setMonth() crashes on win32-g++"); -#endif - #ifdef Q_OS_WINCE addTestExclusion("deep-recursion", "Demands too much memory on WinCE"); addTestExclusion("nested-repetition-count-overflow", "Demands too much memory on WinCE"); diff --git a/tests/auto/uic/baseline/config_fromuic3.ui.h b/tests/auto/uic/baseline/config_fromuic3.ui.h index c77b303..7e0189e 100644 --- a/tests/auto/uic/baseline/config_fromuic3.ui.h +++ b/tests/auto/uic/baseline/config_fromuic3.ui.h @@ -670,6 +670,7 @@ protected: }; static QPixmap qt_get_icon(IconID id) { + /* XPM */ static const char* const image0_data[] = { "22 22 2 1", ". c None", diff --git a/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h b/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h index 50cc4c8..40485ac 100644 --- a/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h +++ b/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h @@ -439,6 +439,7 @@ protected: }; static QPixmap qt_get_icon(IconID id) { + /* XPM */ static const char* const image0_data[] = { "22 22 2 1", ". c None", |