summaryrefslogtreecommitdiffstats
path: root/tests/auto/qvariant/tst_qvariant.cpp
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-03-04 18:22:02 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-03-04 18:22:02 (GMT)
commit2542f8b565e90378145c048b3a6982f4749c6392 (patch)
treed48a2a8988a778e16cf73aac4d0b5709b82f0082 /tests/auto/qvariant/tst_qvariant.cpp
parent4f2203e481cc1663776e7b87b082cf0dd42849fd (diff)
parent364ba2bfeeab574d2ae940e4387d3c90b2a46dcd (diff)
downloadQt-2542f8b565e90378145c048b3a6982f4749c6392.zip
Qt-2542f8b565e90378145c048b3a6982f4749c6392.tar.gz
Qt-2542f8b565e90378145c048b3a6982f4749c6392.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'tests/auto/qvariant/tst_qvariant.cpp')
-rw-r--r--tests/auto/qvariant/tst_qvariant.cpp14
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);