Skip to content

Commit d3dfedb

Browse files
committed
Update TestBookTableModel testData and testSetData methods
1 parent ee32753 commit d3dfedb

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

COS3711-03-01/tests/testbooktablemodel.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void TestBookTableModel::testData()
3333
QCOMPARE(model.data(index, Qt::DisplayRole).toString(), QString("Title"));
3434

3535
index = model.index(0, 1);
36-
QCOMPARE(model.data(index, Qt::DisplayRole).toStringList(), QStringList({"Author1", "Author2"}));
36+
QCOMPARE(model.data(index, Qt::DisplayRole).toString(), QString("Author1; Author2"));
3737

3838
index = model.index(0, 2);
3939
QCOMPARE(model.data(index, Qt::DisplayRole).toDate(), QDate(2023, 1, 1));
@@ -49,7 +49,6 @@ void TestBookTableModel::testHeaderData()
4949
QCOMPARE(model.headerData(1, Qt::Horizontal, Qt::DisplayRole).toString(), QString("Author"));
5050
QCOMPARE(model.headerData(2, Qt::Horizontal, Qt::DisplayRole).toString(), QString("Publication Date"));
5151
QCOMPARE(model.headerData(3, Qt::Horizontal, Qt::DisplayRole).toString(), QString("ISBN"));
52-
QCOMPARE(model.headerData(0, Qt::Vertical, Qt::DisplayRole).toInt(), 1);
5352
}
5453

5554
void TestBookTableModel::testSetData()
@@ -64,7 +63,7 @@ void TestBookTableModel::testSetData()
6463

6564
index = model.index(0, 1);
6665
QVERIFY(model.setData(index, QVariant(QStringList{"New Author1", "New Author2"}), Qt::EditRole));
67-
QCOMPARE(model.data(index, Qt::DisplayRole).toStringList(), QStringList({"New Author1", "New Author2"}));
66+
QCOMPARE(model.data(index, Qt::DisplayRole).toString(), QString("New Author1; New Author2"));
6867

6968
index = model.index(0, 2);
7069
QVERIFY(model.setData(index, QVariant(QDate(2023, 2, 2)), Qt::EditRole));

0 commit comments

Comments
 (0)