summaryrefslogtreecommitdiffstats
path: root/tests/auto/other
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-07-30 22:42:31 +0200
committerLars Knoll <lars.knoll@qt.io>2020-08-24 00:17:03 +0200
commited8acbeb7c6fd137486b5c8a6eec58a3b9db862c (patch)
treed92c3f06a07082e2cc40be366faac8bc58b82def /tests/auto/other
parent5282545589244c1a3e01442e3586d5666213f76d (diff)
Automatically register data/debug stream operations in QMetaType
And remove the old manual registration code for those operators. Add some special handling for long/ulong, as these types could be streamed as a QVariant so far, but are not directly streamable through QDataStream. [ChangeLog][QtCore][QMetaType] The QMetaType::registerStreamOperators() and QMetaType::registerDebugStreamOperator() methods have been removed. The streaming operators for a type are now automatically registered together with the type registration. This implies that the operators should be visible wherever the type is visible and being used. [ChangeLog][Behavior Incompatible Changes] Because the QDataStream and QDebug serialization operators are automatically registered with QMetaType, the declarations of those functions must be present at any point where the type is used with QMetaType and QVariant. Change-Id: I4a0732651b20319af4a8397ff90b848ca4580d99 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/other')
-rw-r--r--tests/auto/other/compiler/tst_compiler.cpp37
1 files changed, 0 insertions, 37 deletions
diff --git a/tests/auto/other/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp
index 10d91894b7..438058aa45 100644
--- a/tests/auto/other/compiler/tst_compiler.cpp
+++ b/tests/auto/other/compiler/tst_compiler.cpp
@@ -297,35 +297,6 @@ namespace QtTestInternal
};
#endif
};
-
- template<bool>
- struct DataStreamOpHelper
- {
- template <typename T>
- struct Getter {
- static QMetaType::SaveOperator saveOp() { return 0; }
- };
- };
-
- template<>
- struct DataStreamOpHelper<true>
- {
- template <typename T>
- struct Getter {
- static QMetaType::SaveOperator saveOp()
- {
- return ::QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Save;
- }
- };
-
- };
-
- template<typename T>
- inline QMetaType::SaveOperator getSaveOperator(T * = 0)
- {
- typedef typename DataStreamOpHelper<DataStreamChecker<T>::HasDataStream>::template Getter<T> GetterHelper;
- return GetterHelper::saveOp();
- }
};
struct MyString: public QString {};
@@ -344,14 +315,6 @@ void tst_Compiler::detectDataStream()
QVERIFY(QtTestInternal::DataStreamChecker<QString>::HasDataStream);
QVERIFY(QtTestInternal::DataStreamChecker<MyString>::HasDataStream);
QVERIFY(!QtTestInternal::DataStreamChecker<Qxxx>::HasDataStream);
-
- QVERIFY(QtTestInternal::getSaveOperator<int>() != 0);
- QVERIFY(QtTestInternal::getSaveOperator<uint>() != 0);
- QVERIFY(QtTestInternal::getSaveOperator<char *>() != 0);
- QVERIFY(QtTestInternal::getSaveOperator<double>() != 0);
- QVERIFY(QtTestInternal::getSaveOperator<QString>() != 0);
- QVERIFY(QtTestInternal::getSaveOperator<MyString>() != 0);
- QVERIFY(!QtTestInternal::getSaveOperator<Qxxx>());
}
#else
void tst_Compiler::detectDataStream()