test: add new test to Task test
Also adds one more check to setStatus test
This commit is contained in:
parent
d0cda6d605
commit
eeae3eca67
@ -6,23 +6,49 @@
|
||||
/* Does nothing. Only used for testing. */
|
||||
class BasicTask : public Task {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BasicTask() : Task() {};
|
||||
|
||||
friend class TaskTest;
|
||||
|
||||
private:
|
||||
void executeTask() override {};
|
||||
};
|
||||
|
||||
/* Does nothing. Only used for testing. */
|
||||
class BasicTask_MultiStep : public Task {
|
||||
Q_OBJECT
|
||||
|
||||
friend class TaskTest;
|
||||
|
||||
private:
|
||||
auto isMultiStep() const -> bool override { return true; }
|
||||
|
||||
void executeTask() override {};
|
||||
};
|
||||
|
||||
class TaskTest : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void test_SetStatus(){
|
||||
void test_SetStatus_NoMultiStep(){
|
||||
BasicTask t;
|
||||
QString status {"test status"};
|
||||
|
||||
t.setStatus(status);
|
||||
|
||||
QCOMPARE(t.getStatus(), status);
|
||||
QCOMPARE(t.getStepStatus(), status);
|
||||
}
|
||||
|
||||
void test_SetStatus_MultiStep(){
|
||||
BasicTask_MultiStep t;
|
||||
QString status {"test status"};
|
||||
|
||||
t.setStatus(status);
|
||||
|
||||
QCOMPARE(t.getStatus(), status);
|
||||
// Even though it is multi step, it does not override the getStepStatus method,
|
||||
// so it should remain the same.
|
||||
QCOMPARE(t.getStepStatus(), status);
|
||||
}
|
||||
|
||||
void test_SetProgress(){
|
||||
|
Loading…
Reference in New Issue
Block a user