From 7e8c5a980c2048c08de1d5955de65636b48d147d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20G=C3=A2teau?= Date: Fri, 18 Jul 2014 11:27:03 +0200 Subject: [PATCH] Make Runner::run() returns a bool indicating success or failure --- src/modules/partition/tests/JobTests.cpp | 9 ++++++--- src/modules/partition/tests/JobTests.h | 6 +++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/modules/partition/tests/JobTests.cpp b/src/modules/partition/tests/JobTests.cpp index 2bd9186bc..025a08f67 100644 --- a/src/modules/partition/tests/JobTests.cpp +++ b/src/modules/partition/tests/JobTests.cpp @@ -27,14 +27,16 @@ QueueRunner::QueueRunner( JobQueue* queue ) connect( m_queue, &JobQueue::failed, this, &QueueRunner::onFailed ); } -void +bool QueueRunner::run() { m_done = false; + m_success = false; m_queue->start(); QEventLoop loop; while ( !m_done ) loop.processEvents(); + return m_success; } void @@ -43,6 +45,7 @@ QueueRunner::onProgress( int current, int total, const QString& prettyName ) QVERIFY( current <= total ); if ( current < total ) return; + m_success = true; m_done = true; } @@ -147,7 +150,7 @@ JobTests::testCreatePartition() job->updatePreview(); m_queue.enqueue( job_ptr( job ) ); - m_runner.run(); + QVERIFY( m_runner.run() ); } void @@ -172,5 +175,5 @@ JobTests::testCreatePartitionExtended() job->updatePreview(); m_queue.enqueue( job_ptr( job ) ); - m_runner.run(); + QVERIFY( m_runner.run() ); } diff --git a/src/modules/partition/tests/JobTests.h b/src/modules/partition/tests/JobTests.h index 543a1425d..21ae63741 100644 --- a/src/modules/partition/tests/JobTests.h +++ b/src/modules/partition/tests/JobTests.h @@ -19,13 +19,17 @@ class QueueRunner : public QObject public: QueueRunner( Calamares::JobQueue* queue ); - void run(); + /** + * Synchronously runs the queue. Returns true on success + */ + bool run(); private: void onProgress( int current, int total, const QString& prettyName ); void onFailed( const QString& message, const QString& details ); Calamares::JobQueue* m_queue; bool m_done; + bool m_success; }; class JobTests : public QObject