Skip to content

Commit

Permalink
Fix testing of sync result error activities in sorted activity list test
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Jul 25, 2023
1 parent 68d8921 commit de4ae7c
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions test/testsortedactivitylistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ class TestSortedActivityListModel : public QObject
QCOMPARE(model->rowCount(), originalRowCount + 1);
}

void addActivity(QSharedPointer<OCC::SortedActivityListModel> model,
void (OCC::ActivityListModel::*addingMethod)(const OCC::Activity &, OCC::ActivityListModel::ErrorType),
OCC::Activity &activity,
OCC::ActivityListModel::ErrorType type)
{
const auto originalRowCount = model->rowCount();
const auto sourceModel = dynamic_cast<TestingALM *>(model->sourceModel());

(sourceModel->*addingMethod)(activity, type);
QCOMPARE(model->rowCount(), originalRowCount + 1);

const auto index = model->index(0, 0);
QVERIFY(index.isValid());
}

private slots:
void initTestCase()
{
Expand Down Expand Up @@ -125,7 +140,7 @@ private slots:

addActivity(model, &TestingALM::addSyncFileItemToActivityList, testSyncFileItemActivity);
addActivity(model, &TestingALM::addNotificationToActivityList, testNotificationActivity);
addActivity(model, &TestingALM::addErrorToActivityList, testSyncResultErrorActivity);
addActivity(model, &TestingALM::addErrorToActivityList, testSyncResultErrorActivity, OCC::ActivityListModel::ErrorType::SyncError);
addActivity(model, &TestingALM::addIgnoredFileToList, testFileIgnoredActivity);
}

Expand All @@ -147,7 +162,7 @@ private slots:
addActivity(model, &TestingALM::addSyncFileItemToActivityList, errorSyncFileItemActivity);
addActivity(model, &TestingALM::addSyncFileItemToActivityList, testSyncFileItemActivity);
addActivity(model, &TestingALM::addNotificationToActivityList, testNotificationActivity);
addActivity(model, &TestingALM::addErrorToActivityList, testSyncResultErrorActivity);
addActivity(model, &TestingALM::addErrorToActivityList, testSyncResultErrorActivity, OCC::ActivityListModel::ErrorType::SyncError);
addActivity(model, &TestingALM::addIgnoredFileToList, testFileIgnoredActivity);

const QVector<OCC::Activity::Type> activityDefaultTypeOrder {
Expand Down

0 comments on commit de4ae7c

Please sign in to comment.