summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-27 12:28:21 +0200
committerKent Hansen <khansen@trolltech.com>2009-08-27 13:33:35 +0200
commita5c4c8453ac68f847b1bc3b4e01f710b757e7e1b (patch)
treeef689c4d9619665b224c374d5d18816ba4484034 /tests/auto/qscriptvalue/tst_qscriptvalue.cpp
parent2c18dd72d51efffa64ed54f058c64f6e4fc5c597 (diff)
fix whacky behavior of QScriptValue::toString() for QVariant
For some types, an empty string is the correct and complete conversion of the type. If the result is an empty string, use QVariant::canConvert() to determine if that is indeed correct, before falling back to the "string-conversion-not-available" path.
Diffstat (limited to 'tests/auto/qscriptvalue/tst_qscriptvalue.cpp')
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index f9ce79f27b..1c09693d34 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -447,6 +447,8 @@ void tst_QScriptValue::toString()
variant = eng.newVariant(QVariant(QPoint(10, 20)));
QVERIFY(variant.isVariant());
QCOMPARE(variant.toString(), QString::fromLatin1("QVariant(QPoint)"));
+ variant = eng.newVariant(QUrl());
+ QVERIFY(variant.toString().isEmpty());
}
void tst_QScriptValue::toNumber()