summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-04-22 03:07:09 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-04-22 03:07:53 (GMT)
commite6b5d2a4df73aa26812e26daa3199443bd84cc90 (patch)
tree1c6683e6f4ef92fc8e13f99d3c3045f0833faa82
parent9a40a3e76171c06d32ab4cadf700f6504dada129 (diff)
downloadQt-e6b5d2a4df73aa26812e26daa3199443bd84cc90.zip
Qt-e6b5d2a4df73aa26812e26daa3199443bd84cc90.tar.gz
Qt-e6b5d2a4df73aa26812e26daa3199443bd84cc90.tar.bz2
Autotests and doc
-rw-r--r--doc/src/declarative/globalobject.qdoc4
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp70
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/atob.qml7
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/btoa.qml6
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp83
5 files changed, 110 insertions, 60 deletions
diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc
index d729d4f..6709ab4 100644
--- a/doc/src/declarative/globalobject.qdoc
+++ b/doc/src/declarative/globalobject.qdoc
@@ -190,10 +190,10 @@ This function attempts to open the specified \c target url in an external applic
This function returns a hex string of the md5 hash of \c data.
\section3 Qt.btoa(data)
-This function returns a base64 encoding of \c data.
+Binary to ASCII - this function returns a base64 encoding of \c data.
\section3 Qt.atob(data)
-This function returns a base64 decoding of \c data.
+ASCII to binary - this function returns a base64 decoding of \c data.
\section3 Qt.quit()
This function causes the QML engine to emit the quit signal, which in
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 84146b3..8eae120 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -986,7 +986,7 @@ QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt, QS
Q_ASSERT(context);
if(ctxt->argumentCount() != 1) {
- return ctxt->throwError(QDeclarativeEngine::tr("expected 1 parameter"));
+ return ctxt->throwError("Qt.createComponent(): Invalid arguments");
}else{
QString arg = ctxt->argument(0).toString();
if (arg.isEmpty())
@@ -1006,7 +1006,7 @@ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QS
QDeclarativeEngine* activeEngine = activeEnginePriv->q_func();
if(ctxt->argumentCount() < 2 || ctxt->argumentCount() > 3)
- return ctxt->throwError(QDeclarativeEngine::tr("expected 2 or 3 parameters"));
+ return ctxt->throwError("Qt.createQmlObject(): Invalid arguments");
QDeclarativeContextData* context = activeEnginePriv->getContext(ctxt);
Q_ASSERT(context);
@@ -1026,7 +1026,7 @@ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QS
QObject *parentArg = activeEnginePriv->objectClass->toQObject(ctxt->argument(1));
if(!parentArg)
- return ctxt->throwError(QDeclarativeEngine::tr("parent object not found"));
+ return ctxt->throwError("Qt.createQmlObject(): Missing parent object");
QDeclarativeComponent component(activeEngine);
component.setData(qml.toUtf8(), url);
@@ -1051,7 +1051,7 @@ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QS
}
if (!component.isReady())
- return ctxt->throwError(QDeclarativeEngine::tr("Qt.createQmlObject(): component is not ready"));
+ return ctxt->throwError("Qt.createQmlObject(): Component is not ready");
QObject *obj = component.create(context->asQDeclarativeContext());
@@ -1097,7 +1097,7 @@ QScriptValue QDeclarativeEnginePrivate::isQtObject(QScriptContext *ctxt, QScript
QScriptValue QDeclarativeEnginePrivate::vector(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 3)
- return ctxt->throwError(QDeclarativeEngine::tr("expected 3 parameters"));
+ return ctxt->throwError("Qt.vector(): Invalid arguments");
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
qsreal z = ctxt->argument(2).toNumber();
@@ -1108,7 +1108,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptE
{
int argCount = ctxt->argumentCount();
if(argCount == 0 || argCount > 2)
- return ctxt->throwError(QDeclarativeEngine::tr("expected 1 or 2 parameters"));
+ return ctxt->throwError("Qt.formatDate(): Invalid arguments");
QDate date = ctxt->argument(0).toDateTime().date();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
@@ -1118,8 +1118,9 @@ QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptE
return engine->newVariant(qVariantFromValue(date.toString(format)));
} else if (ctxt->argument(1).isNumber()) {
enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32());
- } else
- return ctxt->throwError(QDeclarativeEngine::tr("invalid date format"));
+ } else {
+ return ctxt->throwError("Qt.formatDate(): Invalid date format");
+ }
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
}
@@ -1128,7 +1129,7 @@ QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptE
{
int argCount = ctxt->argumentCount();
if(argCount == 0 || argCount > 2)
- return ctxt->throwError(QDeclarativeEngine::tr("expected 1 or 2 parameters"));
+ return ctxt->throwError("Qt.formatTime(): Invalid arguments");
QTime date = ctxt->argument(0).toDateTime().time();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
@@ -1138,8 +1139,9 @@ QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptE
return engine->newVariant(qVariantFromValue(date.toString(format)));
} else if (ctxt->argument(1).isNumber()) {
enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32());
- } else
- return ctxt->throwError(QDeclarativeEngine::tr("invalid time format"));
+ } else {
+ return ctxt->throwError("Qt.formatTime(): Invalid time format");
+ }
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
}
@@ -1148,7 +1150,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScr
{
int argCount = ctxt->argumentCount();
if(argCount == 0 || argCount > 2)
- return ctxt->throwError(QDeclarativeEngine::tr("expected 1 or 2 parameters"));
+ return ctxt->throwError("Qt.formatDateTime(): Invalid arguments");
QDateTime date = ctxt->argument(0).toDateTime();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
@@ -1158,8 +1160,9 @@ QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScr
return engine->newVariant(qVariantFromValue(date.toString(format)));
} else if (ctxt->argument(1).isNumber()) {
enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32());
- } else
- return ctxt->throwError(QDeclarativeEngine::tr("invalid datetiem format"));
+ } else {
+ return ctxt->throwError("Qt.formatDateTime(): Invalid datetime formate");
+ }
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
}
@@ -1168,7 +1171,7 @@ QScriptValue QDeclarativeEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine
{
int argCount = ctxt->argumentCount();
if(argCount < 3 || argCount > 4)
- return ctxt->throwError(QDeclarativeEngine::tr("expected 3 or 4 parameters"));
+ return ctxt->throwError("Qt.rgba(): Invalid arguments");
qsreal r = ctxt->argument(0).toNumber();
qsreal g = ctxt->argument(1).toNumber();
qsreal b = ctxt->argument(2).toNumber();
@@ -1190,7 +1193,7 @@ QScriptValue QDeclarativeEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine
{
int argCount = ctxt->argumentCount();
if(argCount < 3 || argCount > 4)
- return ctxt->throwError(QDeclarativeEngine::tr("expected 3 or 4 parameters"));
+ return ctxt->throwError("Qt.hsla(): Invalid arguments");
qsreal h = ctxt->argument(0).toNumber();
qsreal s = ctxt->argument(1).toNumber();
qsreal l = ctxt->argument(2).toNumber();
@@ -1211,7 +1214,7 @@ QScriptValue QDeclarativeEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 4)
- return ctxt->throwError(QDeclarativeEngine::tr("expected 4 parameters"));
+ return ctxt->throwError("Qt.rect(): Invalid arguments");
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
@@ -1227,7 +1230,7 @@ QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::point(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
- return ctxt->throwError(QDeclarativeEngine::tr("expected 2 parameters"));
+ return ctxt->throwError("Qt.point(): Invalid arguments");
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
return qScriptValueFromValue(engine, qVariantFromValue(QPointF(x, y)));
@@ -1236,7 +1239,7 @@ QScriptValue QDeclarativeEnginePrivate::point(QScriptContext *ctxt, QScriptEngin
QScriptValue QDeclarativeEnginePrivate::size(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
- return ctxt->throwError(QDeclarativeEngine::tr("expected 2 parameters"));
+ return ctxt->throwError("Qt.size(): Invalid arguments");
qsreal w = ctxt->argument(0).toNumber();
qsreal h = ctxt->argument(1).toNumber();
return qScriptValueFromValue(engine, qVariantFromValue(QSizeF(w, h)));
@@ -1245,7 +1248,7 @@ QScriptValue QDeclarativeEnginePrivate::size(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::lighter(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 1)
- return ctxt->throwError(QDeclarativeEngine::tr("expected 1 parameter"));
+ return ctxt->throwError("Qt.lighter(): Invalid arguments");
QVariant v = ctxt->argument(0).toVariant();
QColor color;
if (v.userType() == QVariant::Color)
@@ -1264,7 +1267,7 @@ QScriptValue QDeclarativeEnginePrivate::lighter(QScriptContext *ctxt, QScriptEng
QScriptValue QDeclarativeEnginePrivate::darker(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 1)
- return ctxt->throwError(QDeclarativeEngine::tr("expected 1 parameter"));
+ return ctxt->throwError("Qt.darker(): Invalid arguments");
QVariant v = ctxt->argument(0).toVariant();
QColor color;
if (v.userType() == QVariant::Color)
@@ -1283,21 +1286,20 @@ QScriptValue QDeclarativeEnginePrivate::darker(QScriptContext *ctxt, QScriptEngi
QScriptValue QDeclarativeEnginePrivate::desktopOpenUrl(QScriptContext *ctxt, QScriptEngine *e)
{
if(ctxt->argumentCount() < 1)
- return e->newVariant(QVariant(false));
+ return QScriptValue(e, false);
bool ret = false;
#ifndef QT_NO_DESKTOPSERVICES
ret = QDesktopServices::openUrl(QUrl(ctxt->argument(0).toString()));
#endif
- return e->newVariant(QVariant(ret));
+ return QScriptValue(e, ret);
}
QScriptValue QDeclarativeEnginePrivate::md5(QScriptContext *ctxt, QScriptEngine *)
{
- QByteArray data;
-
- if (ctxt->argumentCount() >= 1)
- data = ctxt->argument(0).toString().toUtf8();
+ if (ctxt->argumentCount() != 1)
+ return ctxt->throwError("Qt.md5(): Invalid arguments");
+ QByteArray data = ctxt->argument(0).toString().toUtf8();
QByteArray result = QCryptographicHash::hash(data, QCryptographicHash::Md5);
return QScriptValue(QLatin1String(result.toHex()));
@@ -1305,20 +1307,20 @@ QScriptValue QDeclarativeEnginePrivate::md5(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::btoa(QScriptContext *ctxt, QScriptEngine *)
{
- QByteArray data;
+ if (ctxt->argumentCount() != 1)
+ return ctxt->throwError("Qt.btoa(): Invalid arguments");
- if (ctxt->argumentCount() >= 1)
- data = ctxt->argument(0).toString().toUtf8();
+ QByteArray data = ctxt->argument(0).toString().toUtf8();
return QScriptValue(QLatin1String(data.toBase64()));
}
QScriptValue QDeclarativeEnginePrivate::atob(QScriptContext *ctxt, QScriptEngine *)
{
- QByteArray data;
+ if (ctxt->argumentCount() != 1)
+ return ctxt->throwError("Qt.atob(): Invalid arguments");
- if (ctxt->argumentCount() >= 1)
- data = ctxt->argument(0).toString().toUtf8();
+ QByteArray data = ctxt->argument(0).toString().toUtf8();
return QScriptValue(QLatin1String(QByteArray::fromBase64(data)));
}
@@ -1417,7 +1419,7 @@ QScriptValue QDeclarativeEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptE
QScriptValue QDeclarativeEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
- return ctxt->throwError(QDeclarativeEngine::tr("expected 2 parameters"));
+ return ctxt->throwError("Qt.tint(): Invalid arguments");
//get color
QVariant v = ctxt->argument(0).toVariant();
QColor color;
diff --git a/tests/auto/declarative/qdeclarativeqt/data/atob.qml b/tests/auto/declarative/qdeclarativeqt/data/atob.qml
new file mode 100644
index 0000000..8355fa5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/atob.qml
@@ -0,0 +1,7 @@
+import Qt 4.7
+
+QtObject {
+ property string test1: Qt.atob()
+ property string test2: Qt.atob("SGVsbG8gd29ybGQh")
+}
+
diff --git a/tests/auto/declarative/qdeclarativeqt/data/btoa.qml b/tests/auto/declarative/qdeclarativeqt/data/btoa.qml
new file mode 100644
index 0000000..c2993ff
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/btoa.qml
@@ -0,0 +1,6 @@
+import Qt 4.7
+
+QtObject {
+ property string test1: Qt.btoa()
+ property string test2: Qt.btoa("Hello world!")
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
index 727d74c..f5d5926 100644
--- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
+++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
@@ -74,6 +74,8 @@ private slots:
void consoleLog();
void formatting();
void isQtObject();
+ void btoa();
+ void atob();
private:
QDeclarativeEngine engine;
@@ -102,8 +104,8 @@ void tst_qdeclarativeqt::rgba()
{
QDeclarativeComponent component(&engine, TEST_FILE("rgba.qml"));
- QString warning1 = component.url().toString() + ":6: Error: expected 3 or 4 parameters";
- QString warning2 = component.url().toString() + ":7: Error: expected 3 or 4 parameters";
+ QString warning1 = component.url().toString() + ":6: Error: Qt.rgba(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.rgba(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
@@ -125,8 +127,8 @@ void tst_qdeclarativeqt::hsla()
{
QDeclarativeComponent component(&engine, TEST_FILE("hsla.qml"));
- QString warning1 = component.url().toString() + ":6: Error: expected 3 or 4 parameters";
- QString warning2 = component.url().toString() + ":7: Error: expected 3 or 4 parameters";
+ QString warning1 = component.url().toString() + ":6: Error: Qt.hsla(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.hsla(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
@@ -147,8 +149,8 @@ void tst_qdeclarativeqt::rect()
{
QDeclarativeComponent component(&engine, TEST_FILE("rect.qml"));
- QString warning1 = component.url().toString() + ":6: Error: expected 4 parameters";
- QString warning2 = component.url().toString() + ":7: Error: expected 4 parameters";
+ QString warning1 = component.url().toString() + ":6: Error: Qt.rect(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.rect(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
@@ -168,8 +170,8 @@ void tst_qdeclarativeqt::point()
{
QDeclarativeComponent component(&engine, TEST_FILE("point.qml"));
- QString warning1 = component.url().toString() + ":6: Error: expected 2 parameters";
- QString warning2 = component.url().toString() + ":7: Error: expected 2 parameters";
+ QString warning1 = component.url().toString() + ":6: Error: Qt.point(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.point(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
@@ -188,8 +190,8 @@ void tst_qdeclarativeqt::size()
{
QDeclarativeComponent component(&engine, TEST_FILE("size.qml"));
- QString warning1 = component.url().toString() + ":7: Error: expected 2 parameters";
- QString warning2 = component.url().toString() + ":8: Error: expected 2 parameters";
+ QString warning1 = component.url().toString() + ":7: Error: Qt.size(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":8: Error: Qt.size(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
@@ -209,8 +211,8 @@ void tst_qdeclarativeqt::vector()
{
QDeclarativeComponent component(&engine, TEST_FILE("vector.qml"));
- QString warning1 = component.url().toString() + ":6: Error: expected 3 parameters";
- QString warning2 = component.url().toString() + ":7: Error: expected 3 parameters";
+ QString warning1 = component.url().toString() + ":6: Error: Qt.vector(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.vector(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
@@ -229,8 +231,8 @@ void tst_qdeclarativeqt::lighter()
{
QDeclarativeComponent component(&engine, TEST_FILE("lighter.qml"));
- QString warning1 = component.url().toString() + ":5: Error: expected 1 parameter";
- QString warning2 = component.url().toString() + ":6: Error: expected 1 parameter";
+ QString warning1 = component.url().toString() + ":5: Error: Qt.lighter(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":6: Error: Qt.lighter(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
@@ -251,8 +253,8 @@ void tst_qdeclarativeqt::darker()
{
QDeclarativeComponent component(&engine, TEST_FILE("darker.qml"));
- QString warning1 = component.url().toString() + ":5: Error: expected 1 parameter";
- QString warning2 = component.url().toString() + ":6: Error: expected 1 parameter";
+ QString warning1 = component.url().toString() + ":5: Error: Qt.darker(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":6: Error: Qt.darker(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
@@ -273,8 +275,8 @@ void tst_qdeclarativeqt::tint()
{
QDeclarativeComponent component(&engine, TEST_FILE("tint.qml"));
- QString warning1 = component.url().toString() + ":7: Error: expected 2 parameters";
- QString warning2 = component.url().toString() + ":8: Error: expected 2 parameters";
+ QString warning1 = component.url().toString() + ":7: Error: Qt.tint(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":8: Error: Qt.tint(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
@@ -322,10 +324,13 @@ void tst_qdeclarativeqt::openUrlExternally()
void tst_qdeclarativeqt::md5()
{
QDeclarativeComponent component(&engine, TEST_FILE("md5.qml"));
+
+ QString warning1 = component.url().toString() + ":4: Error: Qt.md5(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+
QObject *object = component.create();
QVERIFY(object != 0);
- QCOMPARE(object->property("test1").toString(), QLatin1String(QCryptographicHash::hash(QByteArray(), QCryptographicHash::Md5).toHex()));
QCOMPARE(object->property("test2").toString(), QLatin1String(QCryptographicHash::hash("Hello World", QCryptographicHash::Md5).toHex()));
delete object;
@@ -335,8 +340,8 @@ void tst_qdeclarativeqt::createComponent()
{
QDeclarativeComponent component(&engine, TEST_FILE("createComponent.qml"));
- QString warning1 = component.url().toString() + ":9: Error: expected 1 parameter";
- QString warning2 = component.url().toString() + ":10: Error: expected 1 parameter";
+ QString warning1 = component.url().toString() + ":9: Error: Qt.createComponent(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":10: Error: Qt.createComponent(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
@@ -353,11 +358,11 @@ void tst_qdeclarativeqt::createQmlObject()
{
QDeclarativeComponent component(&engine, TEST_FILE("createQmlObject.qml"));
- QString warning1 = component.url().toString() + ":7: Error: expected 2 or 3 parameters";
+ QString warning1 = component.url().toString() + ":7: Error: Qt.createQmlObject(): Invalid arguments";
QString warning2 = component.url().toString()+ ":10: Error: Qt.createQmlObject() failed to create object: " + TEST_FILE("inline").toString() + ":2:10: Blah is not a type\n";
QString warning3 = component.url().toString()+ ":11: Error: Qt.createQmlObject() failed to create object: " + TEST_FILE("main.qml").toString() + ":4:1: Duplicate property name\n";
- QString warning4 = component.url().toString()+ ":9: Error: parent object not found";
- QString warning5 = component.url().toString()+ ":8: Error: expected 2 or 3 parameters";
+ QString warning4 = component.url().toString()+ ":9: Error: Qt.createQmlObject(): Missing parent object";
+ QString warning5 = component.url().toString()+ ":8: Error: Qt.createQmlObject(): Invalid arguments";
QString warning6 = "RunTimeError: Qt.createQmlObject() failed to create object: " + TEST_FILE("inline").toString() + ":3: Cannot assign object type QObject with no default method\n";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
@@ -433,6 +438,36 @@ void tst_qdeclarativeqt::isQtObject()
delete object;
}
+void tst_qdeclarativeqt::btoa()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("btoa.qml"));
+
+ QString warning1 = component.url().toString() + ":4: Error: Qt.btoa(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test2").toString(), QString("SGVsbG8gd29ybGQh"));
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::atob()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("atob.qml"));
+
+ QString warning1 = component.url().toString() + ":4: Error: Qt.atob(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test2").toString(), QString("Hello world!"));
+
+ delete object;
+}
+
QTEST_MAIN(tst_qdeclarativeqt)
#include "tst_qdeclarativeqt.moc"