Rename qPromise() helper to QtPromise::resolve()

For consistency with other helpers, deprecate `qPromise()` in favor of `QtPromise::resolve()` but also add support for calling this helper with lvalue. Add extra unit tests to make sure that rvalue is not copied.
This commit is contained in:
Simon Brunel
2019-02-25 20:03:19 +01:00
parent 1f30224578
commit 963ec621e1
34 changed files with 880 additions and 253 deletions

View File

@ -29,7 +29,7 @@ namespace {
template <class E>
void verify()
{
auto p = qPromise(QtConcurrent::run([]() { throw E(); }));
auto p = QtPromise::resolve(QtConcurrent::run([]() { throw E(); }));
QCOMPARE(p.isPending(), true);
QCOMPARE(waitForRejected<E>(p), true);
QCOMPARE(p.isRejected(), true);