| 1357 | } |
| 1358 | |
| 1359 | double progressTest(DeviceRef& device, FilterRef& filter, double nMax = 1000) |
| 1360 | { |
| 1361 | Progress progress(nMax); |
| 1362 | filter.setProgressMonitorFunction(progressCallback, &progress); |
| 1363 | |
| 1364 | filter.commit(); |
| 1365 | REQUIRE(device.getError() == Error::None); |
| 1366 | |
| 1367 | Timer timer; |
| 1368 | progress.running = true; |
| 1369 | filter.execute(); |
| 1370 | progress.running = false; |
| 1371 | const double time = timer.query(); |
| 1372 | |
| 1373 | if (nMax <= 1) |
| 1374 | { |
| 1375 | // Execution should be cancelled but it's not guaranteed |
| 1376 | Error error = device.getError(); |
| 1377 | REQUIRE((error == Error::None || error == Error::Cancelled)); |
| 1378 | REQUIRE((progress.n >= nMax && progress.n <= 1)); |
| 1379 | } |
| 1380 | else |
| 1381 | { |
| 1382 | // Execution should be finished |
| 1383 | REQUIRE(device.getError() == Error::None); |
| 1384 | REQUIRE(progress.n == 1); // progress must be 100% at the end |
| 1385 | } |
| 1386 | |
| 1387 | return time; |
| 1388 | } |
| 1389 | |
| 1390 | TEST_CASE("progress monitor", "[progress]") |
| 1391 | { |
no test coverage detected