From d24f813f3f2a05c112e803e4256b53535895fc98 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Wed, 14 Jul 2021 11:49:10 +1200 Subject: Initial mirror commit --- tests/unit/CardSideView/CardSideView_test.cpp | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/unit/CardSideView/CardSideView_test.cpp (limited to 'tests/unit/CardSideView/CardSideView_test.cpp') diff --git a/tests/unit/CardSideView/CardSideView_test.cpp b/tests/unit/CardSideView/CardSideView_test.cpp new file mode 100644 index 0000000..9b08dc0 --- /dev/null +++ b/tests/unit/CardSideView/CardSideView_test.cpp @@ -0,0 +1,49 @@ +#include +#include +#include + +#include "CardSideView_test.h" +#include "../../common/printQtTypes.h" +#include "../../../src/dictionary/Card.h" +#include "../../../src/study/CardSideView.h" + +void CardSideViewTest::SetUp() + { + cardPack.addField(new Field("English", "Normal")); + cardPack.addField(new Field("Example", "Example")); + cardPack.addField(new Field("Russian", "Normal")); + } + +TEST_F(CardSideViewTest, getFormattedQuestion) + { + CardSideView view; + view.setPack(&cardPack); + view.setQstAnsr("First", QStringList()); + ASSERT_EQ("First", + view.getFormattedText()); + } + +TEST_F(CardSideViewTest, getFormattedAnswer) + { + CardSideView view(CardSideView::AnsMode); + view.setPack(&cardPack); + QStringList answers = QStringList() << "First example" << "Pervyj"; + view.setQstAnsr("First", answers); + ASSERT_EQ("First example

"\ + "Pervyj", + view.getFormattedText()); + } + +TEST_F(CardSideViewTest, getFormattedAnswer_1missing) + { + CardSideView view(CardSideView::AnsMode); + view.setPack(&cardPack); + QStringList answers = QStringList() << "" << "Pervyj"; + view.setQstAnsr("First", answers); + ASSERT_EQ("

Pervyj", + view.getFormattedText()); + } -- cgit