summaryrefslogtreecommitdiff
path: root/tests/backend/models
diff options
context:
space:
mode:
authorTeus Benschop <teusjannette@gmail.com>2017-10-06 12:24:31 +0200
committerTeus Benschop <teusjannette@gmail.com>2017-10-06 12:24:31 +0200
commit90d2181239761f8950b95768d3b037843e9e8b50 (patch)
tree6cc667ab420cc04029de2de7e361d2305e214595 /tests/backend/models
parent1ea03c0fce8066c1e22188447b4a6ca4dcef1201 (diff)
New upstream version 2.11.0
Diffstat (limited to 'tests/backend/models')
-rw-r--r--tests/backend/models/btlistmodel/test_btlistmodel.cpp45
-rw-r--r--tests/backend/models/btlistmodel/test_btlistmodel.h14
2 files changed, 59 insertions, 0 deletions
diff --git a/tests/backend/models/btlistmodel/test_btlistmodel.cpp b/tests/backend/models/btlistmodel/test_btlistmodel.cpp
new file mode 100644
index 0000000..3af5c21
--- /dev/null
+++ b/tests/backend/models/btlistmodel/test_btlistmodel.cpp
@@ -0,0 +1,45 @@
+
+#include "test_btlistmodel.h"
+#include "backend/models/btlistmodel.h"
+#include <QtTest/QtTest>
+
+void test_BtListModel::initTestCase() {
+}
+
+void test_BtListModel::appendItem_data() {
+ QTest::addColumn<bool>("checkable");
+ QTest::addColumn<QString>("title1");
+ QTest::addColumn<QString>("title2");
+ QTest::addColumn<QString>("tip1");
+ QTest::addColumn<QString>("tip2");
+ QTest::addColumn<int>("columns");
+ QTest::newRow("T1") << false << "a" << "b" << "c" << "d" << 1;
+ QTest::newRow("T2") << false << "a" << "b" << "c" << "d" << 2;
+ QTest::newRow("T3") << true << "a" << "b" << "c" << "d" << 1;
+ QTest::newRow("T4") << true << "a" << "b" << "c" << "d" << 2;
+}
+
+void test_BtListModel::appendItem() {
+ QFETCH(bool, checkable);
+ QFETCH(QString, title1);
+ QFETCH(QString, title2);
+ QFETCH(QString, tip1);
+ QFETCH(QString, tip2);
+ QFETCH(int, columns);
+
+ BtListModel model(checkable, this, columns);
+ QCOMPARE(model.columnCount(), columns);
+ model.appendItem(title1, tip1);
+ model.appendItem(title2, tip2);
+
+ QStandardItem* item0 = model.item(0,0);
+ QCOMPARE(item0->text(), title1);
+ QCOMPARE(item0->toolTip(),tip1);
+ QStandardItem* item1 = model.item(1,0);
+ QCOMPARE(item1->text(), title2);
+ QCOMPARE(item1->toolTip(),tip2);
+ QCOMPARE(item0->isCheckable(),checkable);
+}
+
+QTEST_MAIN(test_BtListModel)
+
diff --git a/tests/backend/models/btlistmodel/test_btlistmodel.h b/tests/backend/models/btlistmodel/test_btlistmodel.h
new file mode 100644
index 0000000..cbb14ab
--- /dev/null
+++ b/tests/backend/models/btlistmodel/test_btlistmodel.h
@@ -0,0 +1,14 @@
+
+#include <QObject>
+
+class test_BtListModel : public QObject {
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+
+ void appendItem_data();
+ void appendItem();
+
+};
+