Make Runner::run() returns a bool indicating success or failure
This commit is contained in:
parent
eebc71257f
commit
7e8c5a980c
@ -27,14 +27,16 @@ QueueRunner::QueueRunner( JobQueue* queue )
|
|||||||
connect( m_queue, &JobQueue::failed, this, &QueueRunner::onFailed );
|
connect( m_queue, &JobQueue::failed, this, &QueueRunner::onFailed );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
QueueRunner::run()
|
QueueRunner::run()
|
||||||
{
|
{
|
||||||
m_done = false;
|
m_done = false;
|
||||||
|
m_success = false;
|
||||||
m_queue->start();
|
m_queue->start();
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
while ( !m_done )
|
while ( !m_done )
|
||||||
loop.processEvents();
|
loop.processEvents();
|
||||||
|
return m_success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -43,6 +45,7 @@ QueueRunner::onProgress( int current, int total, const QString& prettyName )
|
|||||||
QVERIFY( current <= total );
|
QVERIFY( current <= total );
|
||||||
if ( current < total )
|
if ( current < total )
|
||||||
return;
|
return;
|
||||||
|
m_success = true;
|
||||||
m_done = true;
|
m_done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +150,7 @@ JobTests::testCreatePartition()
|
|||||||
job->updatePreview();
|
job->updatePreview();
|
||||||
m_queue.enqueue( job_ptr( job ) );
|
m_queue.enqueue( job_ptr( job ) );
|
||||||
|
|
||||||
m_runner.run();
|
QVERIFY( m_runner.run() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -172,5 +175,5 @@ JobTests::testCreatePartitionExtended()
|
|||||||
job->updatePreview();
|
job->updatePreview();
|
||||||
m_queue.enqueue( job_ptr( job ) );
|
m_queue.enqueue( job_ptr( job ) );
|
||||||
|
|
||||||
m_runner.run();
|
QVERIFY( m_runner.run() );
|
||||||
}
|
}
|
||||||
|
@ -19,13 +19,17 @@ class QueueRunner : public QObject
|
|||||||
public:
|
public:
|
||||||
QueueRunner( Calamares::JobQueue* queue );
|
QueueRunner( Calamares::JobQueue* queue );
|
||||||
|
|
||||||
void run();
|
/**
|
||||||
|
* Synchronously runs the queue. Returns true on success
|
||||||
|
*/
|
||||||
|
bool run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onProgress( int current, int total, const QString& prettyName );
|
void onProgress( int current, int total, const QString& prettyName );
|
||||||
void onFailed( const QString& message, const QString& details );
|
void onFailed( const QString& message, const QString& details );
|
||||||
Calamares::JobQueue* m_queue;
|
Calamares::JobQueue* m_queue;
|
||||||
bool m_done;
|
bool m_done;
|
||||||
|
bool m_success;
|
||||||
};
|
};
|
||||||
|
|
||||||
class JobTests : public QObject
|
class JobTests : public QObject
|
||||||
|
Loading…
Reference in New Issue
Block a user