From 904788e3c6e800e4a8b641b549cbfd86f2045f80 Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Thu, 27 Apr 2017 19:08:56 +0200 Subject: Add swap and move operator to QHostInfo Also mark as shared-come-qt6, [ChangeLog][QtNetwork][QHostInfo] Added swap() and move operator. Change-Id: I8f422868f0487a37aeba3bc74685dc4912e9b3a4 Coverity-Id: 168204 Reviewed-by: Marc Mutz --- .../network/kernel/qhostinfo/tst_qhostinfo.cpp | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'tests') diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp index 2671c253cb..cb7e66bad4 100644 --- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp @@ -86,6 +86,8 @@ class tst_QHostInfo : public QObject private slots: void init(); void initTestCase(); + void swapFunction(); + void moveOperator(); void getSetCheck(); void staticInformation(); void lookupIPv4_data(); @@ -129,6 +131,29 @@ private: #endif }; +void tst_QHostInfo::swapFunction() +{ + QHostInfo obj1, obj2; + obj1.setError(QHostInfo::HostInfoError(0)); + obj2.setError(QHostInfo::HostInfoError(1)); + obj1.swap(obj2); + QCOMPARE(QHostInfo::HostInfoError(0), obj2.error()); + QCOMPARE(QHostInfo::HostInfoError(1), obj1.error()); +} + +void tst_QHostInfo::moveOperator() +{ + QHostInfo obj1, obj2, obj3(1); + obj1.setError(QHostInfo::HostInfoError(0)); + obj2.setError(QHostInfo::HostInfoError(1)); + obj1 = std::move(obj2); + obj2 = obj3; + QCOMPARE(QHostInfo::HostInfoError(1), obj1.error()); + QCOMPARE(obj3.lookupId(), obj2.lookupId()); +} + + + // Testing get/set functions void tst_QHostInfo::getSetCheck() { -- cgit v1.2.3