diff options
author | Thomas Senyk <thomas.senyk@nokia.com> | 2010-11-25 12:16:42 (GMT) |
---|---|---|
committer | Thomas Senyk <thomas.senyk@nokia.com> | 2010-11-25 14:42:53 (GMT) |
commit | 985832eaf110d3decb32e7f984429e09e6bd6271 (patch) | |
tree | d15faa82e525d5f26f66b1c7df1c800c345080b8 /tests/auto | |
parent | d9e6d9ca595c3ec1f1c2b66b365e51ee34d29bf3 (diff) | |
download | Qt-985832eaf110d3decb32e7f984429e09e6bd6271.zip Qt-985832eaf110d3decb32e7f984429e09e6bd6271.tar.gz Qt-985832eaf110d3decb32e7f984429e09e6bd6271.tar.bz2 |
QtScript variant conversion: Convert numbers to (u)int if applicable (reviewed by khansen)
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index 97bbf26..5a50e49 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -1254,6 +1254,10 @@ void tst_QScriptValue::toVariant() QCOMPARE(number.toVariant(), QVariant(123.0)); QCOMPARE(qscriptvalue_cast<QVariant>(number), QVariant(123.0)); + QScriptValue intNumber = QScriptValue(&eng, (qint32)123); + QCOMPARE(intNumber.toVariant().type(), QVariant((qint32)123).type()); + QCOMPARE((qscriptvalue_cast<QVariant>(number)).type(), QVariant((qint32)123).type()); + QScriptValue falskt = QScriptValue(&eng, false); QCOMPARE(falskt.toVariant(), QVariant(false)); QCOMPARE(qscriptvalue_cast<QVariant>(falskt), QVariant(false)); |