MCPcopy Create free account
hub / github.com/commontk/CTK / testOutput

Method testOutput

Libs/CommandLineModules/Testing/Cpp/ctkCmdLineModuleFutureTest.cpp:358–454  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

356
357//-----------------------------------------------------------------------------
358void ctkCmdLineModuleFutureTester::testOutput()
359{
360 ctkCmdLineModuleSignalTester signalTester;
361
362 connect(signalTester.watcher(), SIGNAL(outputDataReady()), SLOT(ouputDataReady()));
363 connect(signalTester.watcher(), SIGNAL(errorDataReady()), SLOT(errorDataReady()));
364
365 this->currentWatcher = signalTester.watcher();
366
367 frontend->setValue("numOutputsVar", 2);
368 frontend->setValue("errorTextVar", "Final error msg.");
369 ctkCmdLineModuleFuture future = manager.run(frontend);
370 signalTester.setFuture(future);
371
372 future.waitForFinished();
373
374 // process pending events
375 QCoreApplication::processEvents();
376
377 QVERIFY(future.isFinished());
378
379 QList<QString> expectedSignals;
380 expectedSignals << "module.started"
381
382 // the following signals are send when connecting a QFutureWatcher to
383 // an already started QFuture
384 << "module.progressRangeChanged(0,0)"
385 << "module.progressValueChanged(0)"
386
387 << "module.progressRangeChanged(0,1002)"
388
389 // the test module always reports error data when starting
390 << "module.errorReady"
391
392 // the following two signals are send when the module reports "filter start"
393 << "module.progressValueChanged(1)"
394 << "module.progressTextChanged(Does nothing useful)"
395
396 // the output data on the standard output channel "Output 1"
397 << "module.outputReady"
398
399 // this signal is send when the module reports progress for "output1"
400 << "module.progressValueChanged(500)"
401 << "module.progressTextChanged(Calculating output 2...)"
402
403 // first resultNumberOutput result
404 << "module.resultReadyAt(0,1)"
405 << "module.resultReadyAt(0)"
406
407 // the output data on the standard output channel "Output 2"
408 << "module.outputReady"
409
410 // this signal is send when the module reports progress for "output2"
411 << "module.progressValueChanged(1000)"
412 << "module.progressTextChanged(Calculating output 3...)"
413
414 // second resultNumberOutput result
415 << "module.resultReadyAt(1,2)"

Callers

nothing calls this directly

Calls 11

processEventsFunction · 0.85
watcherMethod · 0.80
setValueMethod · 0.45
runMethod · 0.45
setFutureMethod · 0.45
checkSignalsMethod · 0.45
dataMethod · 0.45
readAllOutputDataMethod · 0.45
readAllErrorDataMethod · 0.45
resultsMethod · 0.45

Tested by

no test coverage detected