e9da5cb6cb
Now uses a qreal for progress instead of current and total Also added a finished() signal because determining whether the queue is finished should not be done by comparing a qreal with 1.0 as this is not precise.
57 lines
1.2 KiB
C++
57 lines
1.2 KiB
C++
#ifndef JOBTESTS_H
|
|
#define JOBTESTS_H
|
|
|
|
#include <JobQueue.h>
|
|
|
|
// CalaPM
|
|
#include <core/device.h>
|
|
#include <core/partition.h>
|
|
#include <core/partitionrole.h>
|
|
#include <core/partitiontable.h>
|
|
#include <fs/filesystem.h>
|
|
|
|
// Qt
|
|
#include <QObject>
|
|
#include <QScopedPointer>
|
|
|
|
class QueueRunner : public QObject
|
|
{
|
|
public:
|
|
QueueRunner( Calamares::JobQueue* queue );
|
|
|
|
/**
|
|
* Synchronously runs the queue. Returns true on success
|
|
*/
|
|
bool run();
|
|
|
|
private:
|
|
void onFailed( const QString& message, const QString& details );
|
|
void onFinished();
|
|
Calamares::JobQueue* m_queue;
|
|
bool m_finished;
|
|
bool m_success;
|
|
};
|
|
|
|
class JobTests : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
JobTests();
|
|
|
|
private Q_SLOTS:
|
|
void initTestCase();
|
|
void testPartitionTable();
|
|
void testCreatePartition();
|
|
void testCreatePartitionExtended();
|
|
|
|
private:
|
|
QScopedPointer< Device > m_device;
|
|
Calamares::JobQueue m_queue;
|
|
QueueRunner m_runner;
|
|
|
|
void queuePartitionTableCreation( PartitionTable::TableType type );
|
|
CreatePartitionJob* newCreatePartitionJob( Partition* freeSpacePartition, PartitionRole, FileSystem::Type type, qint64 size );
|
|
};
|
|
|
|
#endif /* JOBTESTS_H */
|