diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-12-16 17:05:21 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-12-16 17:05:21 +0100 |
commit | 13e88fe2b9b1680cb161a249289c3ba998f08c0c (patch) | |
tree | 496a9d88c69b441e8c88aa0416b327faca3a1532 /tests/auto/qml | |
parent | a2dad3ddee9c4bf274a7c6469342e4104605ceeb (diff) | |
parent | 470ba767663e4ad9d3183fb56ee89361354dfefb (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/quick/items/qquickitem.cpp
src/quick/items/qquicktext.cpp
tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
Change-Id: I0bc5786098193c2c40b6fd8905de75d90f6ed0cf
Diffstat (limited to 'tests/auto/qml')
15 files changed, 384 insertions, 38 deletions
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index 39086d75ac..726f8636b6 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -134,6 +134,7 @@ private slots: void reentrancy_Array(); void reentrancy_objectCreation(); void jsIncDecNonObjectProperty(); + void JSONparse(); void qRegExpInport_data(); void qRegExpInport(); @@ -2500,6 +2501,13 @@ void tst_QJSEngine::jsIncDecNonObjectProperty() } } +void tst_QJSEngine::JSONparse() +{ + QJSEngine eng; + QJSValue ret = eng.evaluate("var json=\"{\\\"1\\\": null}\"; JSON.parse(json);"); + QVERIFY(ret.isObject()); +} + static QRegExp minimal(QRegExp r) { r.setMinimal(true); return r; } void tst_QJSEngine::qRegExpInport_data() diff --git a/tests/auto/qml/qqmlecmascript/data/misctypetest.qml b/tests/auto/qml/qqmlecmascript/data/misctypetest.qml index 60ff53a2b4..088ede67ec 100644 --- a/tests/auto/qml/qqmlecmascript/data/misctypetest.qml +++ b/tests/auto/qml/qqmlecmascript/data/misctypetest.qml @@ -11,7 +11,7 @@ Item { return mtt.invalidUrl() == mtt.invalidUrl(); } - function test_invalid_url_refequal() + function test_invalid_url_strictequal() { return mtt.invalidUrl() === mtt.invalidUrl(); } @@ -21,7 +21,7 @@ Item { return mtt.validUrl() == mtt.validUrl(); } - function test_valid_url_refequal() + function test_valid_url_strictequal() { return mtt.validUrl() === mtt.validUrl(); } diff --git a/tests/auto/qml/qqmlecmascript/data/noCaptureWhenWritingProperty.qml b/tests/auto/qml/qqmlecmascript/data/noCaptureWhenWritingProperty.qml new file mode 100644 index 0000000000..8b8601692d --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/noCaptureWhenWritingProperty.qml @@ -0,0 +1,14 @@ +import QtQml 2.0 +QtObject { + property bool somePropertyEvaluated: false; + + property int someProperty: { + // It's sort of evil to set the property here, but that doesn't mean that + // this expression should get re-evaluated when unrelatedProperty changes later. + somePropertyEvaluated = true + return 20; + } + Component.onCompleted: { + somePropertyEvaluated = false + } +} diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml index 52abda1e55..8d08cc5559 100644 --- a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml +++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml @@ -140,6 +140,22 @@ Item { if (msco.intListProperty.toString() != expected.toString()) success = false; expected = 7; if (poppedVal != expected) success = false; + + // concat + msco.stringListProperty = [ "one", "two" ] + stringList = [ "hello", "world" ] + stringList = stringList.concat(msco.stringListProperty) + expected = [ "hello", "world", "one", "two" ] + if (stringList.length != expected.length) { + success = false; + } else { + for (var i = 0; i < stringList.length; ++i) { + if (stringList[i] != expected[i]) { + success = false; + break; + } + } + } } property variant variantList: [ 1, 2, 3, 4, 5 ]; diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp index 41fa3672bd..22fac2013e 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.cpp +++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp @@ -106,7 +106,7 @@ public: void MyQmlObject::v8function(QQmlV4Function *function) { - QV8Engine::getV4(function->engine())->current->throwError(QStringLiteral("Exception thrown from within QObject slot")); + QV8Engine::getV4(function->engine())->currentContext()->throwError(QStringLiteral("Exception thrown from within QObject slot")); } static QJSValue script_api(QQmlEngine *engine, QJSEngine *scriptEngine) diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 660be13f71..7b89709923 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -319,6 +319,7 @@ private slots: void stackLimits(); void idsAsLValues(); void qtbug_34792(); + void noCaptureWhenWritingProperty(); private: // static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter); @@ -2267,7 +2268,7 @@ static inline bool evaluate_error(QV8Engine *engine, const QV4::ValueRef o, cons QV4::Script program(QV8Engine::getV4(engine)->rootContext, functionSource); program.inheritContext = true; - QV4::ExecutionContext *ctx = QV8Engine::getV4(engine)->current; + QV4::ExecutionContext *ctx = QV8Engine::getV4(engine)->currentContext(); QV4::Scope scope(ctx); QV4::Scoped<QV4::FunctionObject> function(scope, program.run()); @@ -2295,7 +2296,7 @@ static inline bool evaluate_value(QV8Engine *engine, const QV4::ValueRef o, QV4::Script program(QV8Engine::getV4(engine)->rootContext, functionSource); program.inheritContext = true; - QV4::ExecutionContext *ctx = QV8Engine::getV4(engine)->current; + QV4::ExecutionContext *ctx = QV8Engine::getV4(engine)->currentContext(); QV4::Scope scope(ctx); QV4::Scoped<QV4::FunctionObject> function(scope, program.run()); @@ -2324,7 +2325,7 @@ static inline QV4::ReturnedValue evaluate(QV8Engine *engine, const QV4::ValueRef QString functionSource = QLatin1String("(function(object) { return ") + QLatin1String(source) + QLatin1String(" })"); - QV4::ExecutionContext *ctx = QV8Engine::getV4(engine)->current; + QV4::ExecutionContext *ctx = QV8Engine::getV4(engine)->currentContext(); QV4::Scope scope(ctx); QV4::Script program(QV8Engine::getV4(engine)->rootContext, functionSource); @@ -7498,6 +7499,14 @@ void tst_qqmlecmascript::qtbug_34792() delete object; } +void tst_qqmlecmascript::noCaptureWhenWritingProperty() +{ + QQmlComponent component(&engine, testFileUrl("noCaptureWhenWritingProperty.qml")); + QScopedPointer<QObject> obj(component.create()); + QVERIFY(!obj.isNull()); + QCOMPARE(obj->property("somePropertyEvaluated").toBool(), false); +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index 382bfe4b73..004514d39c 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -54,7 +54,7 @@ #include <QQmlExpression> #include <QQmlIncubationController> #include <private/qqmlengine_p.h> -#include <private/qqmlabstracturlinterceptor_p.h> +#include <QQmlAbstractUrlInterceptor> class tst_qqmlengine : public QQmlDataTest { diff --git a/tests/auto/qml/qqmllanguage/data/customParserBindingScopes.qml b/tests/auto/qml/qqmllanguage/data/customParserBindingScopes.qml new file mode 100644 index 0000000000..2efc199f32 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/customParserBindingScopes.qml @@ -0,0 +1,19 @@ +import Test 1.0 +import QtQml 2.0 +QtObject { + id: root + + property int otherProperty: 10 + + property QtObject child: QtObject { + id: child + + property int testProperty; + property int otherProperty: 41 + + property QtObject customBinder: CustomBinding { + target: child + testProperty: otherProperty + 1 + } + } +} diff --git a/tests/auto/qml/qqmllanguage/testtypes.cpp b/tests/auto/qml/qqmllanguage/testtypes.cpp index 3957f9d872..4a4ab3b81a 100644 --- a/tests/auto/qml/qqmllanguage/testtypes.cpp +++ b/tests/auto/qml/qqmllanguage/testtypes.cpp @@ -89,6 +89,8 @@ void registerTypes() qmlRegisterUncreatableType<MyUncreateableBaseClass,1>("Test", 1, 1, "MyUncreateableBaseClass", "Cannot create MyUncreateableBaseClass"); qmlRegisterType<MyCreateableDerivedClass,1>("Test", 1, 1, "MyCreateableDerivedClass"); + + qmlRegisterCustomType<CustomBinding>("Test", 1, 0, "CustomBinding", new CustomBindingParser); } QVariant myCustomVariantTypeConverter(const QString &data) @@ -97,3 +99,61 @@ QVariant myCustomVariantTypeConverter(const QString &data) rv.a = data.toInt(); return QVariant::fromValue(rv); } + + +QByteArray CustomBindingParser::compile(const QList<QQmlCustomParserProperty> &properties) +{ + QByteArray result; + QDataStream ds(&result, QIODevice::WriteOnly); + + ds << properties.count(); + for (int i = 0; i < properties.count(); ++i) { + const QQmlCustomParserProperty &prop = properties.at(i); + ds << prop.name(); + + Q_ASSERT(prop.assignedValues().count() == 1); + QVariant value = prop.assignedValues().first(); + + Q_ASSERT(value.userType() == qMetaTypeId<QQmlScript::Variant>()); + QQmlScript::Variant v = qvariant_cast<QQmlScript::Variant>(value); + Q_ASSERT(v.type() == QQmlScript::Variant::Script); + int bindingId = bindingIdentifier(v, prop.name()); + ds << bindingId; + + ds << prop.location().line; + } + + return result; +} + +void CustomBindingParser::setCustomData(QObject *object, const QByteArray &data) +{ + CustomBinding *customBinding = qobject_cast<CustomBinding*>(object); + Q_ASSERT(customBinding); + customBinding->m_bindingData = data; +} + +void CustomBinding::componentComplete() +{ + Q_ASSERT(m_target); + + QDataStream ds(m_bindingData); + int count; + ds >> count; + for (int i = 0; i < count; ++i) { + QString name; + ds >> name; + + int bindingId; + ds >> bindingId; + + int line; + ds >> line; + + QQmlBinding *binding = QQmlBinding::createBinding(QQmlBinding::Identifier(bindingId), m_target, qmlContext(this), QString(), line); + + QQmlProperty property(m_target, name, qmlContext(this)); + binding->setTarget(property); + QQmlPropertyPrivate::setBinding(property, binding); + } +} diff --git a/tests/auto/qml/qqmllanguage/testtypes.h b/tests/auto/qml/qqmllanguage/testtypes.h index 703b26a73c..a968d9a25a 100644 --- a/tests/auto/qml/qqmllanguage/testtypes.h +++ b/tests/auto/qml/qqmllanguage/testtypes.h @@ -1070,6 +1070,29 @@ QML_DECLARE_TYPE(MyRevisionedSubclass) QML_DECLARE_TYPE(MySubclass) QML_DECLARE_TYPE(MyReceiversTestObject) +class CustomBinding : public QObject, public QQmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QQmlParserStatus) + Q_PROPERTY(QObject* target READ target WRITE setTarget) +public: + + virtual void classBegin() {} + virtual void componentComplete(); + + QObject *target() const { return m_target; } + void setTarget(QObject *newTarget) { m_target = newTarget; } + + QPointer<QObject> m_target; + QByteArray m_bindingData; +}; + +class CustomBindingParser : public QQmlCustomParser +{ + virtual QByteArray compile(const QList<QQmlCustomParserProperty> &properties); + virtual void setCustomData(QObject *object, const QByteArray &data); +}; + void registerTypes(); #endif // TESTTYPES_H diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 621061ab6a..6a577ec91c 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -214,6 +214,8 @@ private slots: void compositeSingletonSelectors(); void compositeSingletonRegistered(); + void customParserBindingScopes(); + private: QQmlEngine engine; QStringList defaultImportPathList; @@ -3534,6 +3536,17 @@ void tst_qqmllanguage::compositeSingletonRegistered() verifyCompositeSingletonPropertyValues(o, "value1", 925, "value2", 755); } +void tst_qqmllanguage::customParserBindingScopes() +{ + QQmlComponent component(&engine, testFile("customParserBindingScopes.qml")); + VERIFY_ERRORS(0); + QScopedPointer<QObject> o(component.create()); + QVERIFY(!o.isNull()); + QPointer<QObject> child = qvariant_cast<QObject*>(o->property("child")); + QVERIFY(!child.isNull()); + QCOMPARE(child->property("testProperty").toInt(), 42); +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp index d76c11b833..28a9bce98d 100644 --- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp +++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp @@ -55,6 +55,8 @@ public: tst_QQmlPropertyMap() {} private slots: + void initTestCase(); + void insert(); void operatorInsert(); void operatorValue(); @@ -68,8 +70,39 @@ private slots: void metaObjectAccessibility(); void QTBUG_31226(); void QTBUG_29836(); + void QTBUG_35233(); + void disallowExtending(); +}; + +class LazyPropertyMap : public QQmlPropertyMap, public QQmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QQmlParserStatus) + + Q_PROPERTY(int someFixedProperty READ someFixedProperty WRITE setSomeFixedProperty) +public: + LazyPropertyMap() + : QQmlPropertyMap(this, /*parent*/0) + , value(0) + {} + + virtual void classBegin() {} + virtual void componentComplete() { + insert(QStringLiteral("lateProperty"), QStringLiteral("lateValue")); + } + + int someFixedProperty() const { return value; } + void setSomeFixedProperty(int v) { value = v; } + +private: + int value; }; +void tst_QQmlPropertyMap::initTestCase() +{ + qmlRegisterType<LazyPropertyMap>("QTBUG_35233", 1, 0, "LazyPropertyMap"); +} + void tst_QQmlPropertyMap::insert() { QQmlPropertyMap map; @@ -369,6 +402,54 @@ void tst_QQmlPropertyMap::QTBUG_29836() } +void tst_QQmlPropertyMap::QTBUG_35233() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.setData("import QtQml 2.0\n" + "import QTBUG_35233 1.0\n" + "QtObject {\n" + " property QtObject testMap: LazyPropertyMap {\n" + " id: map\n" + " }\n" + " property QtObject sibling: QtObject {\n" + " objectName: \"sibling\"\n" + " property string testValue: map.lateProperty\n" + " }\n" + "}", QUrl()); + QScopedPointer<QObject> obj(component.create()); + QVERIFY(!obj.isNull()); + + QObject *sibling = obj->findChild<QObject*>("sibling"); + QVERIFY(sibling); + QCOMPARE(sibling->property("testValue").toString(), QString("lateValue")); +} + +void tst_QQmlPropertyMap::disallowExtending() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.setData("import QtQml 2.0\n" + "import QTBUG_35233 1.0\n" + "LazyPropertyMap {\n" + " id: blah\n" + " someFixedProperty: 42\n" + "}\n", QUrl()); + QScopedPointer<QObject> obj(component.create()); + QVERIFY(!obj.isNull()); + + component.setData("import QtQml 2.0\n" + "import QTBUG_35233 1.0\n" + "LazyPropertyMap {\n" + " id: blah\n" + " property int someNewProperty;\n" + "}\n", QUrl()); + obj.reset(component.create()); + QVERIFY(obj.isNull()); + QCOMPARE(component.errors().count(), 1); + QCOMPARE(component.errors().at(0).toString(), QStringLiteral("<Unknown File>: Fully dynamic types cannot declare new properties.")); +} + QTEST_MAIN(tst_QQmlPropertyMap) #include "tst_qqmlpropertymap.moc" diff --git a/tests/auto/qml/qqmltranslation/data/jstranslation.qml b/tests/auto/qml/qqmltranslation/data/jstranslation.qml new file mode 100644 index 0000000000..7adde019fa --- /dev/null +++ b/tests/auto/qml/qqmltranslation/data/jstranslation.qml @@ -0,0 +1,20 @@ +import QtQuick 2.0 +import "translation.js" as Js + +QtObject { + property string basic: Js.basic() + property string basic2: Js.basic2() + property string basic3: Js.basic3() + + property string disambiguation: Js.disambiguation() + property string disambiguation2: Js.disambiguation2() + property string disambiguation3: Js.disambiguation3() + + property string noop: Js.noop() + property string noop2: Js.noop2() + + property string singular: Js.singular() + property string singular2: Js.singular2() + property string plural: Js.plural() + property string plural2: Js.plural2() +} diff --git a/tests/auto/qml/qqmltranslation/data/translation.js b/tests/auto/qml/qqmltranslation/data/translation.js new file mode 100644 index 0000000000..c1e25dcd2f --- /dev/null +++ b/tests/auto/qml/qqmltranslation/data/translation.js @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +function basic() { + return qsTr("hello") +} + +function basic2() { + return qsTranslate("CustomContext", "goodbye") +} + +function basic3() { + if (1) + return qsTr("hello") + return ""; +} + +function disambiguation() { + return qsTr("hi", "informal 'hello'") +} + +function disambiguation2() { + return qsTranslate("CustomContext", "see ya", "informal 'goodbye'") +} + +function disambiguation3() { + if (1) + return qsTr("hi", "informal 'hello'") + return ""; +} + +function noop() { + var _noop = QT_TR_NOOP("hello") + return qsTr(_noop) +} + +function noop2() { + var _noop2 = QT_TRANSLATE_NOOP("CustomContext", "goodbye") + return qsTranslate("CustomContext", _noop2) +} + +function singular() { + return qsTr("%n duck(s)", "", 1) +} + +function singular2() { + if (1) + return qsTr("%n duck(s)", "", 1) + return ""; +} + +function plural() { + return qsTr("%n duck(s)", "", 2) +} + +function plural2() { + if (1) + return qsTr("%n duck(s)", "", 2) + return ""; +} diff --git a/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp b/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp index 0e22d3cfca..01e1cf85fb 100644 --- a/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp +++ b/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp @@ -52,19 +52,32 @@ public: tst_qqmltranslation() {} private slots: + void translation_data(); void translation(); void idTranslation(); - void translationInQrc(); }; +void tst_qqmltranslation::translation_data() +{ + QTest::addColumn<QString>("translation"); + QTest::addColumn<QUrl>("testFile"); + + QTest::newRow("qml") << QStringLiteral("qml_fr") << testFileUrl("translation.qml"); + QTest::newRow("qrc") << QStringLiteral(":/qml_fr.qm") << QUrl("qrc:/translation.qml"); + QTest::newRow("js") << QStringLiteral("qml_fr") << testFileUrl("jstranslation.qml"); +} + void tst_qqmltranslation::translation() { + QFETCH(QString, translation); + QFETCH(QUrl, testFile); + QTranslator translator; - translator.load(QLatin1String("qml_fr"), dataDirectory()); + translator.load(translation, dataDirectory()); QCoreApplication::installTranslator(&translator); QQmlEngine engine; - QQmlComponent component(&engine, testFileUrl("translation.qml")); + QQmlComponent component(&engine, testFile); QObject *object = component.create(); QVERIFY(object != 0); @@ -104,34 +117,6 @@ void tst_qqmltranslation::idTranslation() delete object; } -void tst_qqmltranslation::translationInQrc() -{ - QTranslator translator; - translator.load(":/qml_fr.qm"); - QCoreApplication::installTranslator(&translator); - - QQmlEngine engine; - QQmlComponent component(&engine, QUrl("qrc:/translation.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("basic").toString(), QLatin1String("bonjour")); - QCOMPARE(object->property("basic2").toString(), QLatin1String("au revoir")); - QCOMPARE(object->property("basic3").toString(), QLatin1String("bonjour")); - QCOMPARE(object->property("disambiguation").toString(), QLatin1String("salut")); - QCOMPARE(object->property("disambiguation2").toString(), QString::fromUtf8("\xc3\xa0 plus tard")); - QCOMPARE(object->property("disambiguation3").toString(), QLatin1String("salut")); - QCOMPARE(object->property("noop").toString(), QLatin1String("bonjour")); - QCOMPARE(object->property("noop2").toString(), QLatin1String("au revoir")); - QCOMPARE(object->property("singular").toString(), QLatin1String("1 canard")); - QCOMPARE(object->property("singular2").toString(), QLatin1String("1 canard")); - QCOMPARE(object->property("plural").toString(), QLatin1String("2 canards")); - QCOMPARE(object->property("plural2").toString(), QLatin1String("2 canards")); - - QCoreApplication::removeTranslator(&translator); - delete object; -} - QTEST_MAIN(tst_qqmltranslation) #include "tst_qqmltranslation.moc" |