aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2011-12-14 11:27:18 +0100
committerQt by Nokia <qt-info@nokia.com>2011-12-15 12:17:28 +0100
commitb21f63763d43cecf96c9359d95705411dbdc4ecd (patch)
treea7172e42145431a0b0cede37a02d5517f6f98c09 /tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
parentb6291c914d9a6f24dbfb0e92e8caedae889b709b (diff)
Add support for QUrl types to V4
Extended the V4 instruction set with instructions to `fast convert' url registers to string and bool registers and `resolve' urls using QDeclarativeContext::resolvedUrl. Also, made IR::UrlType a special `string' type. It's a little trick to ensure that the compiler will generate correct conversions for the binary expressions. Change-Id: Ibc9e5b99302bd513f0cc52b598a1b198b11d4d30 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index a01c80b7e3..f3d810ed9d 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -220,6 +220,7 @@ private slots:
void aliasWritesOverrideBindings();
void aliasToCompositeElement();
void realToInt();
+ void urlProperty();
void dynamicString();
void include();
void signalHandlers();
@@ -5462,6 +5463,21 @@ void tst_qdeclarativeecmascript::realToInt()
QMetaObject::invokeMethod(object, "test2");
QCOMPARE(object->value(), int(8));
}
+
+void tst_qdeclarativeecmascript::urlProperty()
+{
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("urlProperty.1.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+ object->setStringProperty("http://qt-project.org");
+ QCOMPARE(object->urlProperty(), QUrl("http://qt-project.org/index.html"));
+ QCOMPARE(object->intProperty(), 123);
+ QCOMPARE(object->value(), 1);
+ QCOMPARE(object->property("result").toBool(), true);
+ }
+}
+
void tst_qdeclarativeecmascript::dynamicString()
{
QDeclarativeComponent component(&engine, TEST_FILE("dynamicString.qml"));