forked from Silverfish/proton-bridge
feat(GODT-2791): Add Unitary test.
This commit is contained in:
committed by
Romain Le Jeune
parent
86e115b2f3
commit
2c2f816f3a
@ -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
|
||||
@ -19,6 +19,9 @@
|
||||
#ifndef BRIDGE_GUI_BUG_REPORT_FLOW_H
|
||||
#define BRIDGE_GUI_BUG_REPORT_FLOW_H
|
||||
|
||||
namespace bridgepp {
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \brief Bug Report Flow parser.
|
||||
//****************************************************************************************************************************************************
|
||||
@ -32,11 +35,14 @@ public: // member functions.
|
||||
|
||||
bool parse(const QString& filepath); ///< Initialize the Bug Report Flow.
|
||||
|
||||
QVariantList questionSet(quint8 categoryId) const; ///< Retrieve the set of question for a given bug category.
|
||||
bool setAnswer(quint8 questionId, QString const &answer); ///< Feed an answer for a given question.
|
||||
QString collectAnswers(quint8 categoryId) const; ///< Collect answer for a given set of questions.
|
||||
QStringList categories() const; ///< Getter for the 'bugCategories' property.
|
||||
QVariantList questions() const; ///< Getter for the 'bugQuestions' property.
|
||||
QVariantList questionSet(quint8 categoryId) const; ///< Retrieve the set of question for a given bug category.
|
||||
|
||||
bool setAnswer(quint8 questionId, QString const &answer); ///< Feed an answer for a given question.
|
||||
QString collectAnswers(quint8 categoryId) const; ///< Collect answer for a given set of questions.
|
||||
void clearAnswers(); ///< Clear all collected answers.
|
||||
|
||||
|
||||
private: // member functions
|
||||
bool parseFile(); ///< Parse the bug report flow description file.
|
||||
@ -54,4 +60,6 @@ private: // data members
|
||||
};
|
||||
|
||||
|
||||
} // namespace bridgepp
|
||||
|
||||
#endif // BRIDGE_GUI_BUG_REPORT_FLOW_H
|
||||
|
||||
Reference in New Issue
Block a user