diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2010-03-03 10:07:26 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2010-03-03 10:48:16 (GMT) |
commit | 7a6f492a6dcf9140eda309dcdff6e0f8d321df19 (patch) | |
tree | cde3260385069df41659cac82e6228ab956c2eee | |
parent | 24cf789b68f21b2d1ea31580e55c91a2cae25a12 (diff) | |
download | Qt-7a6f492a6dcf9140eda309dcdff6e0f8d321df19.zip Qt-7a6f492a6dcf9140eda309dcdff6e0f8d321df19.tar.gz Qt-7a6f492a6dcf9140eda309dcdff6e0f8d321df19.tar.bz2 |
Fix QVariant autotest
After 03daf059647c0a0222e8774b0a083f58c8e64934, typedef of int are just
aliases to int, and therefor we need to use a real custom type for the test now
Reviewed-by: Thierry
-rw-r--r-- | tests/auto/qvariant/tst_qvariant.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp index a316dda..1a4182f 100644 --- a/tests/auto/qvariant/tst_qvariant.cpp +++ b/tests/auto/qvariant/tst_qvariant.cpp @@ -2518,15 +2518,23 @@ void tst_QVariant::variant_to() QCOMPARE(qVariantFromValue(0.25f).toDouble(), 0.25); } +struct Blah { int i; }; + +QDataStream& operator>>(QDataStream& s, Blah& c) +{ return (s >> c.i); } + +QDataStream& operator<<(QDataStream& s, const Blah& c) +{ return (s << c.i); } + void tst_QVariant::saveLoadCustomTypes() { QByteArray data; - int i = 42; - int tp = qRegisterMetaType<int>("Blah"); + Blah i = { 42 }; + int tp = qRegisterMetaType<Blah>("Blah"); QVariant v = QVariant(tp, &i); - qRegisterMetaTypeStreamOperators<int>("Blah"); + qRegisterMetaTypeStreamOperators<Blah>("Blah"); QCOMPARE(v.userType(), tp); QVERIFY(v.type() == QVariant::UserType); |