19     void FuturesTest::testSequencer ()
 
   27             .Then ([&loop, &res] (
int cnt)
 
   35         QCoreApplication::processEvents ();
 
   40     void FuturesTest::testHeterogeneousTypes ()
 
   46         bool executed = 
false;
 
   47         Sequence (
nullptr, 
MkWaiter () (50)) >>
 
   48                 [] (int) { 
return MakeReadyFuture<Bar> ({}); } >>
 
   49                 [] (Bar) { 
return MakeReadyFuture<Baz> ({}); } >>
 
   50                 [&executed, &loop] (Baz)
 
   58         QCoreApplication::processEvents ();
 
   60         QCOMPARE (executed, 
true);
 
   63     void FuturesTest::testDestruction ()
 
   66         bool executed = 
false;
 
   70             Sequence (&obj, MakeReadyFuture (0)) >>
 
   71                     [&executed, &loop] (int)
 
   78         QTimer::singleShot (100, &loop, SLOT (quit ()));
 
   82         QCoreApplication::processEvents ();
 
   84         QCOMPARE (executed, 
false);
 
   87     void FuturesTest::testDestructionHandler ()
 
   89         const auto finished = 1;
 
   90         const auto destructed = 2;
 
   93         bool executed = 
false;
 
   99             future = Sequence (&obj, 
MkWaiter () (100))
 
  100                     .DestructionValue ([] { 
return destructed; }) >>
 
  101                     [=] (
int) { 
return MakeReadyFuture (finished); };
 
  103         Sequence (
nullptr, future) >>
 
  104                 [&executed, &value, &loop] (
int val)
 
  111         QTimer::singleShot (10, &loop, SLOT (quit ()));
 
  115         QCoreApplication::processEvents ();
 
  117         QCOMPARE (executed, 
true);
 
  118         QCOMPARE (value, destructed);
 
  121     void FuturesTest::testNoDestrHandler ()
 
  127         bool executed = 
false;
 
  128         Sequence (
nullptr, 
MkWaiter () (50))
 
  129                 .DestructionValue ([&executed] { executed = 
true; }) >>
 
  130                 [] (
int) { 
return MakeReadyFuture<Bar> ({}); } >>
 
  131                 [] (Bar) { 
return MakeReadyFuture<Baz> ({}); } >>
 
  132                 [&loop] (Baz) { loop.quit (); };
 
  136         QCoreApplication::processEvents ();
 
  138         QCOMPARE (executed, 
false);
 
  141     void FuturesTest::testNoDestrHandlerSetBuildable ()
 
  143         const auto finished = 1;
 
  146         bool executed = 
false;
 
  150                 [=] (int) { 
return MakeReadyFuture (finished); };
 
  151         Sequence (
nullptr, future) >>
 
  152                 [&executed, &value, &loop] (
int val)
 
  161         QCoreApplication::processEvents ();
 
  163         QCOMPARE (executed, 
true);
 
  164         QCOMPARE (value, finished);
 
  167     void FuturesTest::testMulti ()
 
  175         Sequence (
nullptr, iface.future ())
 
  176                 .MultipleResults ([&] (
int sub)
 
  181                         [&] { loop.quit (); });
 
  183         iface.reportStarted ();
 
  184         iface.setExpectedResultCount (3);
 
  185         while (iface.resultCount () < iface.expectedResultCount ())
 
  186             iface.reportResult (iface.resultCount () + 1, iface.resultCount ());
 
  187         iface.reportFinished ();
 
  191         QCoreApplication::processEvents ();
 
  197     void FuturesTest::testMultiRange ()
 
  205         Sequence (
nullptr, iface.future ())
 
  206                 .MultipleResults ([&] (
int sub)
 
  211                         [&] { loop.quit (); });
 
  213         iface.reportStarted ();
 
  214         iface.setProgressRange (0, 2);
 
  215         iface.reportResult (1, 0);
 
  216         iface.reportResult (2, 1);
 
  217         iface.reportResult (3, 2);
 
  218         iface.reportFinished ();
 
  222         QCoreApplication::processEvents ();