summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-17 15:49:39 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-17 15:49:39 (GMT)
commit6ed436a0bcbba1c04068c1dc48f7c74882bbf62e (patch)
tree886ac1167027f60afff7af757ca35ad9d1ea3a2f /tests
parenta1ed3535882455cd30d46f338d9823452b53434e (diff)
downloadQt-6ed436a0bcbba1c04068c1dc48f7c74882bbf62e.zip
Qt-6ed436a0bcbba1c04068c1dc48f7c74882bbf62e.tar.gz
Qt-6ed436a0bcbba1c04068c1dc48f7c74882bbf62e.tar.bz2
adopt variant-to-string conversion of the original qtscript back-end
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index a11b7b7..37f1c8a 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -435,6 +435,18 @@ void tst_QScriptValue::toString()
QCOMPARE(str.toString(), QString("ciao"));
QCOMPARE(qscriptvalue_cast<QString>(str), QString("ciao"));
}
+
+ // variant should use internal valueOf(), then fall back to QVariant::toString(),
+ // then fall back to "QVariant(typename)"
+ QScriptValue variant = eng.newVariant(123);
+ QVERIFY(variant.isVariant());
+ QCOMPARE(variant.toString(), QString::fromLatin1("123"));
+ variant = eng.newVariant(QByteArray("hello"));
+ QVERIFY(variant.isVariant());
+ QCOMPARE(variant.toString(), QString::fromLatin1("hello"));
+ variant = eng.newVariant(QVariant(QPoint(10, 20)));
+ QVERIFY(variant.isVariant());
+ QCOMPARE(variant.toString(), QString::fromLatin1("QVariant(QPoint)"));
}
void tst_QScriptValue::toNumber()