feat(GODT-2791): Add Unitary test.

This commit is contained in:
Romain LE JEUNE
2023-07-26 10:22:21 +02:00
committed by Romain Le Jeune
parent 86e115b2f3
commit 2c2f816f3a
6 changed files with 259 additions and 18 deletions

View File

@ -26,6 +26,10 @@ namespace {
}
namespace bridgepp {
//****************************************************************************************************************************************************
//
//****************************************************************************************************************************************************
@ -46,12 +50,28 @@ bool BugReportFlow::parse(const QString& filepath) {
}
//****************************************************************************************************************************************************
/// \return The value for the 'bugCategories' property.
//****************************************************************************************************************************************************
QStringList BugReportFlow::categories() const {
return categories_;
}
//****************************************************************************************************************************************************
/// \return The value for the 'bugQuestions' property.
//****************************************************************************************************************************************************
QVariantList BugReportFlow::questions() const {
return questions_;
}
//****************************************************************************************************************************************************
/// \param[in] categoryId The id of the bug category.
/// \return Set of question for this category.
//****************************************************************************************************************************************************
QVariantList BugReportFlow::questionSet(quint8 categoryId) const {
if (categoryId >= questionsSet_.count() - 1)
if (categoryId > questionsSet_.count() - 1)
return QVariantList();
return questionsSet_[categoryId];
};
@ -63,7 +83,7 @@ QVariantList BugReportFlow::questionSet(quint8 categoryId) const {
/// \return true iff questionId match an existing question.
//****************************************************************************************************************************************************
bool BugReportFlow::setAnswer(quint8 questionId, QString const &answer) {
if (questionId >= questions_.count() - 1)
if (questionId > questions_.count() - 1)
return false;
this->answers_[questionId] = answer;
@ -91,18 +111,10 @@ QString BugReportFlow::collectAnswers(quint8 categoryId) const {
//****************************************************************************************************************************************************
/// \return The value for the 'bugCategories' property.
//
//****************************************************************************************************************************************************
QStringList BugReportFlow::categories() const {
return categories_;
}
//****************************************************************************************************************************************************
/// \return The value for the 'bugQuestions' property.
//****************************************************************************************************************************************************
QVariantList BugReportFlow::questions() const {
return questions_;
void BugReportFlow::clearAnswers() {
answers_.clear();
}
@ -169,4 +181,6 @@ QJsonObject BugReportFlow::migrateData(const QJsonObject& data, const QString& v
return QJsonObject();
// nothing to migrate now but migration should be done here.
return data;
}
}
} // namespace bridgepp