diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2020-07-24 12:30:00 +0200 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2020-08-03 16:47:31 +0200 |
commit | b3c1093751072110d34b9746d419e8070c80fc3f (patch) | |
tree | 6efa2be54684b03d57f3f299247f0a14f144d82e /tests/auto/corelib/thread/qfuture/tst_qfuture.cpp | |
parent | fddb0c895f9a12d61bbc4cf33149a8d1a93eaf19 (diff) |
Introduce swap functions for QPromise/QFutureInterface
Made QPromise::swap public, added free standing swap() for
QFutureInterface and QPromise. Updated QPromise special member
functions. Extended tests
Task-number: QTBUG-84977
Change-Id: I5daf6876df306d082441dbcdf5ae4dee3bfc0ead
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'tests/auto/corelib/thread/qfuture/tst_qfuture.cpp')
-rw-r--r-- | tests/auto/corelib/thread/qfuture/tst_qfuture.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp index cdb69ab3a3..cc2e2e0984 100644 --- a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp +++ b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -689,6 +689,16 @@ void tst_QFuture::futureInterface() VoidResult a; a.run().waitForFinished(); } + + { + QFutureInterface<int> i1; + i1.reportResult(1); + QFutureInterface<int> i2; + i2.reportResult(2); + swap(i1, i2); // ADL must resolve this + QCOMPARE(i1.resultReference(0), 2); + QCOMPARE(i2.resultReference(0), 1); + } } template <typename T> |