2014-07-17 17:57:55 +02:00
|
|
|
#ifndef JOBTESTS_H
|
|
|
|
#define JOBTESTS_H
|
|
|
|
|
|
|
|
#include <JobQueue.h>
|
|
|
|
|
|
|
|
// CalaPM
|
|
|
|
#include <core/device.h>
|
|
|
|
#include <core/partition.h>
|
|
|
|
#include <core/partitionrole.h>
|
2014-07-18 10:51:05 +02:00
|
|
|
#include <core/partitiontable.h>
|
2014-07-17 17:57:55 +02:00
|
|
|
#include <fs/filesystem.h>
|
|
|
|
|
|
|
|
// Qt
|
|
|
|
#include <QObject>
|
|
|
|
#include <QScopedPointer>
|
|
|
|
|
|
|
|
class QueueRunner : public QObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
QueueRunner( Calamares::JobQueue* queue );
|
|
|
|
|
2014-07-18 11:27:03 +02:00
|
|
|
/**
|
|
|
|
* Synchronously runs the queue. Returns true on success
|
|
|
|
*/
|
|
|
|
bool run();
|
2014-07-17 17:57:55 +02:00
|
|
|
|
|
|
|
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;
|
2014-07-18 11:27:03 +02:00
|
|
|
bool m_success;
|
2014-07-17 17:57:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class JobTests : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
JobTests();
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void initTestCase();
|
|
|
|
void testPartitionTable();
|
|
|
|
void testCreatePartition();
|
2014-07-18 10:51:05 +02:00
|
|
|
void testCreatePartitionExtended();
|
2014-07-17 17:57:55 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
QScopedPointer< Device > m_device;
|
|
|
|
Calamares::JobQueue m_queue;
|
|
|
|
QueueRunner m_runner;
|
|
|
|
|
2014-07-18 10:51:05 +02:00
|
|
|
void queuePartitionTableCreation( PartitionTable::TableType type );
|
2014-07-17 17:57:55 +02:00
|
|
|
CreatePartitionJob* newCreatePartitionJob( Partition* freeSpacePartition, PartitionRole, FileSystem::Type type, qint64 size );
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* JOBTESTS_H */
|