summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-27 10:28:21 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-27 11:33:35 (GMT)
commita5c4c8453ac68f847b1bc3b4e01f710b757e7e1b (patch)
treeef689c4d9619665b224c374d5d18816ba4484034 /tests
parent2c18dd72d51efffa64ed54f058c64f6e4fc5c597 (diff)
downloadQt-a5c4c8453ac68f847b1bc3b4e01f710b757e7e1b.zip
Qt-a5c4c8453ac68f847b1bc3b4e01f710b757e7e1b.tar.gz
Qt-a5c4c8453ac68f847b1bc3b4e01f710b757e7e1b.tar.bz2
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')
-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 f9ce79f..1c09693 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()