30void TabModelTest::initTestCase()
34void TabModelTest::cleanupTestCase()
38void TabModelTest::basicTest()
45 QSignalSpy rowsInsertedSpy(&model1, &TabModel::rowsInserted);
46 QSignalSpy rowsRemovedSpy(&model1, &TabModel::rowsRemoved);
48 QCOMPARE(model1.rowCount(), 0);
50 rowsInsertedSpy.wait();
52 QCOMPARE(rowsInsertedSpy.count(), 1);
54 QCOMPARE(rowsInsertedSpy.at(0).at(0).value<QModelIndex>(), QModelIndex());
55 QCOMPARE(rowsInsertedSpy.at(0).at(1).toInt(), 0);
56 QCOMPARE(rowsInsertedSpy.at(0).at(2).toInt(), 0);
59 rowsInsertedSpy.clear();
63 QCOMPARE(rowsInsertedSpy.count(), 1);
65 QCOMPARE(rowsInsertedSpy.at(0).at(0).value<QModelIndex>(), QModelIndex());
66 QCOMPARE(rowsInsertedSpy.at(0).at(1).toInt(), 1);
67 QCOMPARE(rowsInsertedSpy.at(0).at(2).toInt(), 1);
82 QCOMPARE(rowsRemovedSpy.count(), 0);
86 QCOMPARE(rowsRemovedSpy.count(), 1);
87 QCOMPARE(rowsRemovedSpy.at(0).at(0).value<QModelIndex>(), QModelIndex());
88 QCOMPARE(rowsRemovedSpy.at(0).at(1).toInt(), 1);
89 QCOMPARE(rowsRemovedSpy.at(0).at(2).toInt(), 1);
91 QCOMPARE(model1.rowCount(), 1);
95 QCOMPARE(model2.rowCount(), 1);
100void TabModelTest::dataTest()
106 QTRY_COMPARE(model.rowCount(), 1);
110 QCOMPARE(model.index(0, 0).data(Qt::DisplayRole).toString(), tab0->
title());
112 QCOMPARE(model.index(0, 0).data(Qt::DecorationRole).value<QIcon>().pixmap(16), tab0->
icon().pixmap(16));
121void TabModelTest::pinTabTest()
130 QTRY_COMPARE(model.rowCount(), 2);
146void TabModelTest::treeModelTest()
152 model.setSourceModel(&sourceModel);
161 QTRY_COMPARE(model.rowCount(QModelIndex()), 6);
177 QPersistentModelIndex tab1index = model.index(0, 0);
178 QPersistentModelIndex tab2index = model.index(1, 0);
179 QPersistentModelIndex tab3index = model.index(2, 0);
180 QPersistentModelIndex tab4index = model.index(3, 0);
181 QPersistentModelIndex tab5index = model.index(4, 0);
182 QPersistentModelIndex tab6index = model.index(5, 0);
184 QCOMPARE(model.rowCount(tab1index), 0);
187 QCOMPARE(model.rowCount(tab1index), 1);
191 QCOMPARE(model.rowCount(tab1index), 2);
196 QCOMPARE(model.rowCount(tab1index), 3);
204 QCOMPARE(model.rowCount(tab4index), 2);
210 QCOMPARE(model.rowCount(tab1index), 4);
218 QCOMPARE(model.rowCount(tab1index), 4);
226 QCOMPARE(model.rowCount(tab1index), 3);
234 QCOMPARE(model.rowCount(QModelIndex()), 4);
243void TabModelTest::resetTreeModelTest()
249 model.setSourceModel(&sourceModel);
252 QTRY_COMPARE(model.rowCount(QModelIndex()), 1);
256 QCOMPARE(model.rowCount(QModelIndex()), 0);
258void TabModelTest::mruModelTest()
264 model.setSourceModel(&sourceModel);
273 QTRY_COMPARE(model.rowCount(QModelIndex()), 6);
#define FALKONTEST_MAIN(Test)
TabWidget * tabWidget() const
void setParentTab(WebTab *tab)
QString title(bool allowEmpty=false) const
void addChildTab(WebTab *tab, int index=-1)
QIcon icon(bool allowNull=false) const