summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/kernel/qobject/tst_qobject.cpp')
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 231cccc38d..83ec36253a 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -1405,6 +1405,20 @@ struct CustomType
int value() { return i1 + i2 + i3; }
};
+QDataStream &operator<<(QDataStream &stream, const CustomType &ct)
+{
+ stream << ct.i1 << ct.i2 << ct.i3;
+ return stream;
+}
+
+QDataStream &operator>>(QDataStream &stream, CustomType &ct)
+{
+ stream >> ct.i1;
+ stream >> ct.i2;
+ stream >> ct.i3;
+ return stream;
+}
+
Q_DECLARE_METATYPE(CustomType*)
Q_DECLARE_METATYPE(CustomType)
@@ -1475,26 +1489,11 @@ void tst_QObject::customTypes()
QCOMPARE(instanceCount, 3);
}
-QDataStream &operator<<(QDataStream &stream, const CustomType &ct)
-{
- stream << ct.i1 << ct.i2 << ct.i3;
- return stream;
-}
-
-QDataStream &operator>>(QDataStream &stream, CustomType &ct)
-{
- stream >> ct.i1;
- stream >> ct.i2;
- stream >> ct.i3;
- return stream;
-}
-
void tst_QObject::streamCustomTypes()
{
QByteArray ba;
int idx = qRegisterMetaType<CustomType>("CustomType");
- qRegisterMetaTypeStreamOperators<CustomType>("CustomType");
{
CustomType t1(1, 2, 3);