Cleanup itemmodel autotests.

Avoid using bug tracker identifiers in test function names.  These
identifiers lose their meaning when the bug tracker is replaced.

Change-Id: Ia867f7c2ec2ab9ed546588843d532ac615a34031
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
bb10
Jason McDonald 2011-12-23 14:55:15 +10:00 committed by Qt by Nokia
parent 4ae3fea163
commit 79b64957b0
2 changed files with 96 additions and 96 deletions

View File

@ -77,18 +77,18 @@ private slots:
void selectedColumns();
void setCurrentIndex();
void splitOnInsert();
void task196285_rowIntersectsSelection();
void rowIntersectsSelection1();
void rowIntersectsSelection2();
void unselectable();
void task220420_selectedIndexes();
void task240734_layoutChanged();
void selectedIndexes();
void layoutChanged();
void merge_data();
void merge();
void task119433_isRowSelected();
void task252069_rowIntersectsSelection();
void task232634_childrenDeselectionSignal();
void task260134_layoutChangedWithAllSelected();
void QTBUG5671_layoutChangedWithAllSelected();
void QTBUG2804_layoutChangedTreeSelection();
void isRowSelected();
void childrenDeselectionSignal();
void layoutChangedWithAllSelected1();
void layoutChangedWithAllSelected2();
void layoutChangedTreeSelection();
void deselectRemovedMiddleRange();
void rangeOperatorLessThan_data();
void rangeOperatorLessThan();
@ -1964,7 +1964,7 @@ void tst_QItemSelectionModel::splitOnInsert()
QVERIFY(!selectionModel.isSelected(model.index(1, 0)));
}
void tst_QItemSelectionModel::task196285_rowIntersectsSelection()
void tst_QItemSelectionModel::rowIntersectsSelection1()
{
QTableWidget table;
table.setColumnCount(1);
@ -1991,6 +1991,52 @@ void tst_QItemSelectionModel::task196285_rowIntersectsSelection()
QVERIFY(!selectionModel->columnIntersectsSelection(0, QModelIndex()));
}
void tst_QItemSelectionModel::rowIntersectsSelection2()
{
QStandardItemModel m;
for (int i=0; i<8; ++i) {
for (int j=0; j<8; ++j) {
QStandardItem *item = new QStandardItem(QString("Item number %1").arg(i));
if ((i % 2 == 0 && j == 0) ||
(j % 2 == 0 && i == 0) ||
j == 5 || i == 5 ) {
item->setEnabled(false);
//item->setSelectable(false);
}
m.setItem(i, j, item);
}
}
QItemSelectionModel selected(&m);
//nothing is selected
QVERIFY(!selected.rowIntersectsSelection(0, QModelIndex()));
QVERIFY(!selected.rowIntersectsSelection(2, QModelIndex()));
QVERIFY(!selected.rowIntersectsSelection(3, QModelIndex()));
QVERIFY(!selected.rowIntersectsSelection(5, QModelIndex()));
QVERIFY(!selected.columnIntersectsSelection(0, QModelIndex()));
QVERIFY(!selected.columnIntersectsSelection(2, QModelIndex()));
QVERIFY(!selected.columnIntersectsSelection(3, QModelIndex()));
QVERIFY(!selected.columnIntersectsSelection(5, QModelIndex()));
selected.select(m.index(2, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows);
QVERIFY(!selected.rowIntersectsSelection(0, QModelIndex()));
QVERIFY( selected.rowIntersectsSelection(2, QModelIndex()));
QVERIFY(!selected.rowIntersectsSelection(3, QModelIndex()));
QVERIFY(!selected.rowIntersectsSelection(5, QModelIndex()));
QVERIFY(!selected.columnIntersectsSelection(0, QModelIndex()));
QVERIFY( selected.columnIntersectsSelection(2, QModelIndex()));
QVERIFY( selected.columnIntersectsSelection(3, QModelIndex()));
QVERIFY(!selected.columnIntersectsSelection(5, QModelIndex()));
selected.select(m.index(0, 5), QItemSelectionModel::Select | QItemSelectionModel::Columns);
QVERIFY(!selected.rowIntersectsSelection(0, QModelIndex()));
QVERIFY( selected.rowIntersectsSelection(2, QModelIndex()));
QVERIFY(!selected.rowIntersectsSelection(3, QModelIndex()));
QVERIFY(!selected.rowIntersectsSelection(5, QModelIndex()));
QVERIFY(!selected.columnIntersectsSelection(0, QModelIndex()));
QVERIFY( selected.columnIntersectsSelection(2, QModelIndex()));
QVERIFY( selected.columnIntersectsSelection(3, QModelIndex()));
QVERIFY(!selected.columnIntersectsSelection(5, QModelIndex()));
}
void tst_QItemSelectionModel::unselectable()
{
QTreeWidget w;
@ -2005,7 +2051,7 @@ void tst_QItemSelectionModel::unselectable()
QCOMPARE(w.selectionModel()->selectedRows().count(), 0);
}
void tst_QItemSelectionModel::task220420_selectedIndexes()
void tst_QItemSelectionModel::selectedIndexes()
{
QStandardItemModel model(2, 2);
QItemSelectionModel selectionModel(&model);
@ -2049,7 +2095,7 @@ public:
};
void tst_QItemSelectionModel::task240734_layoutChanged()
void tst_QItemSelectionModel::layoutChanged()
{
QtTestTableModel model(1,1);
QItemSelectionModel selectionModel(&model);
@ -2132,7 +2178,7 @@ void tst_QItemSelectionModel::merge()
QVERIFY(init.contains(idx));
}
void tst_QItemSelectionModel::task119433_isRowSelected()
void tst_QItemSelectionModel::isRowSelected()
{
QStandardItemModel model(2,2);
model.setData(model.index(0,0), 0, Qt::UserRole - 1);
@ -2142,53 +2188,7 @@ void tst_QItemSelectionModel::task119433_isRowSelected()
QVERIFY(sel.isRowSelected(0, QModelIndex()));
}
void tst_QItemSelectionModel::task252069_rowIntersectsSelection()
{
QStandardItemModel m;
for (int i=0; i<8; ++i) {
for (int j=0; j<8; ++j) {
QStandardItem *item = new QStandardItem(QString("Item number %1").arg(i));
if ((i % 2 == 0 && j == 0) ||
(j % 2 == 0 && i == 0) ||
j == 5 || i == 5 ) {
item->setEnabled(false);
//item->setSelectable(false);
}
m.setItem(i, j, item);
}
}
QItemSelectionModel selected(&m);
//nothing is selected
QVERIFY(!selected.rowIntersectsSelection(0, QModelIndex()));
QVERIFY(!selected.rowIntersectsSelection(2, QModelIndex()));
QVERIFY(!selected.rowIntersectsSelection(3, QModelIndex()));
QVERIFY(!selected.rowIntersectsSelection(5, QModelIndex()));
QVERIFY(!selected.columnIntersectsSelection(0, QModelIndex()));
QVERIFY(!selected.columnIntersectsSelection(2, QModelIndex()));
QVERIFY(!selected.columnIntersectsSelection(3, QModelIndex()));
QVERIFY(!selected.columnIntersectsSelection(5, QModelIndex()));
selected.select(m.index(2, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows);
QVERIFY(!selected.rowIntersectsSelection(0, QModelIndex()));
QVERIFY( selected.rowIntersectsSelection(2, QModelIndex()));
QVERIFY(!selected.rowIntersectsSelection(3, QModelIndex()));
QVERIFY(!selected.rowIntersectsSelection(5, QModelIndex()));
QVERIFY(!selected.columnIntersectsSelection(0, QModelIndex()));
QVERIFY( selected.columnIntersectsSelection(2, QModelIndex()));
QVERIFY( selected.columnIntersectsSelection(3, QModelIndex()));
QVERIFY(!selected.columnIntersectsSelection(5, QModelIndex()));
selected.select(m.index(0, 5), QItemSelectionModel::Select | QItemSelectionModel::Columns);
QVERIFY(!selected.rowIntersectsSelection(0, QModelIndex()));
QVERIFY( selected.rowIntersectsSelection(2, QModelIndex()));
QVERIFY(!selected.rowIntersectsSelection(3, QModelIndex()));
QVERIFY(!selected.rowIntersectsSelection(5, QModelIndex()));
QVERIFY(!selected.columnIntersectsSelection(0, QModelIndex()));
QVERIFY( selected.columnIntersectsSelection(2, QModelIndex()));
QVERIFY( selected.columnIntersectsSelection(3, QModelIndex()));
QVERIFY(!selected.columnIntersectsSelection(5, QModelIndex()));
}
void tst_QItemSelectionModel::task232634_childrenDeselectionSignal()
void tst_QItemSelectionModel::childrenDeselectionSignal()
{
QStandardItemModel model;
@ -2242,7 +2242,7 @@ void tst_QItemSelectionModel::task232634_childrenDeselectionSignal()
QVERIFY(selectionModel.selection().contains(sel2));
}
void tst_QItemSelectionModel::task260134_layoutChangedWithAllSelected()
void tst_QItemSelectionModel::layoutChangedWithAllSelected1()
{
QStringListModel model( QStringList() << "foo" << "bar" << "foo2");
QSortFilterProxyModel proxy;
@ -2273,8 +2273,9 @@ void tst_QItemSelectionModel::task260134_layoutChangedWithAllSelected()
QVERIFY(selection.isSelected(index));
}
void tst_QItemSelectionModel::QTBUG5671_layoutChangedWithAllSelected()
// Same as layoutChangedWithAllSelected1, but with a slightly bigger model.
// This test is a regression test for QTBUG-5671.
void tst_QItemSelectionModel::layoutChangedWithAllSelected2()
{
struct MyFilterModel : public QSortFilterProxyModel
{ // Override sort filter proxy to remove even numbered rows.
@ -2285,8 +2286,6 @@ void tst_QItemSelectionModel::QTBUG5671_layoutChangedWithAllSelected()
}
};
//same as task260134_layoutChangedWithAllSelected but with a sightly bigger model
enum { cNumRows=30, cNumCols=20 };
QStandardItemModel model(cNumRows, cNumCols);
@ -2325,7 +2324,8 @@ void tst_QItemSelectionModel::QTBUG5671_layoutChangedWithAllSelected()
QVERIFY(selection.isSelected(index));
}
void tst_QItemSelectionModel::QTBUG2804_layoutChangedTreeSelection()
// This test is a regression test for QTBUG-2804.
void tst_QItemSelectionModel::layoutChangedTreeSelection()
{
QStandardItemModel model;
QStandardItem top1("Child1"), top2("Child2"), top3("Child3");

View File

@ -121,20 +121,20 @@ private slots:
void sortStable();
void task236755_hiddenColumns();
void task247867_insertRowsSort();
void task248868_staticSorting();
void task248868_dynamicSorting();
void task250023_fetchMore();
void task251296_hiddenChildren();
void task252507_mapFromToSource();
void task255652_removeRowsRecursive();
void taskQTBUG_6205_doubleProxySelectionSetSourceModel();
void taskQTBUG_7537_appearsAndSort();
void taskQTBUG_7716_unnecessaryDynamicSorting();
void taskQTBUG_10287_unnecessaryMapCreation();
void taskQTBUG_17812_resetInvalidate_data();
void taskQTBUG_17812_resetInvalidate();
void hiddenColumns();
void insertRowsSort();
void staticSorting();
void dynamicSorting();
void fetchMore();
void hiddenChildren();
void mapFromToSource();
void removeRowsRecursive();
void doubleProxySelectionSetSourceModel();
void appearsAndSort();
void unnecessaryDynamicSorting();
void unnecessaryMapCreation();
void resetInvalidate_data();
void resetInvalidate();
void testMultipleProxiesWithSelection();
void mapSelectionFromSource();
@ -2409,7 +2409,7 @@ void tst_QSortFilterProxyModel::sortStable()
QCOMPARE(lastItemData, filterModel->index(2,0, firstRoot).data());
}
void tst_QSortFilterProxyModel::task236755_hiddenColumns()
void tst_QSortFilterProxyModel::hiddenColumns()
{
class MyStandardItemModel : public QStandardItemModel
{
@ -2433,12 +2433,12 @@ void tst_QSortFilterProxyModel::task236755_hiddenColumns()
model.blockSignals(false);
model.reset();
//in the initial task this would be false because resetting
//model would also reset the hidden columns
// In the initial bug report that spawned this test, this would be false
// because resetting model would also reset the hidden columns.
QVERIFY(view.isColumnHidden(0));
}
void tst_QSortFilterProxyModel::task247867_insertRowsSort()
void tst_QSortFilterProxyModel::insertRowsSort()
{
QStandardItemModel model(2,2);
QSortFilterProxyModel proxyModel;
@ -2454,7 +2454,7 @@ void tst_QSortFilterProxyModel::task247867_insertRowsSort()
QCOMPARE(proxyModel.sortColumn(), 0);
}
void tst_QSortFilterProxyModel::task248868_staticSorting()
void tst_QSortFilterProxyModel::staticSorting()
{
QStandardItemModel model(0, 1);
QSortFilterProxyModel proxy;
@ -2512,7 +2512,7 @@ void tst_QSortFilterProxyModel::task248868_staticSorting()
}
}
void tst_QSortFilterProxyModel::task248868_dynamicSorting()
void tst_QSortFilterProxyModel::dynamicSorting()
{
QStringListModel model1;
const QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(" ");
@ -2652,7 +2652,7 @@ public:
mutable QMap<QModelIndex,QModelIndex> parentHash;
};
void tst_QSortFilterProxyModel::task250023_fetchMore()
void tst_QSortFilterProxyModel::fetchMore()
{
QtTestModel model(10,10);
QSortFilterProxyModel proxy;
@ -2674,7 +2674,7 @@ void tst_QSortFilterProxyModel::task250023_fetchMore()
QCOMPARE(proxy.columnCount(idx), 10);
}
void tst_QSortFilterProxyModel::task251296_hiddenChildren()
void tst_QSortFilterProxyModel::hiddenChildren()
{
QStandardItemModel model;
QSortFilterProxyModel proxy;
@ -2725,7 +2725,7 @@ void tst_QSortFilterProxyModel::task251296_hiddenChildren()
QCOMPARE(proxy.rowCount(indexA) , 0);
}
void tst_QSortFilterProxyModel::task252507_mapFromToSource()
void tst_QSortFilterProxyModel::mapFromToSource()
{
QtTestModel source(10,10);
source.fetchMore(QModelIndex());
@ -2751,7 +2751,7 @@ static QStandardItem *addEntry(QStandardItem* pParent, const QString &descriptio
return pItem;
}
void tst_QSortFilterProxyModel::task255652_removeRowsRecursive()
void tst_QSortFilterProxyModel::removeRowsRecursive()
{
QStandardItemModel pModel;
QStandardItem *pItem1 = new QStandardItem("root");
@ -2801,7 +2801,7 @@ void tst_QSortFilterProxyModel::task255652_removeRowsRecursive()
delete pItem11;
}
void tst_QSortFilterProxyModel::taskQTBUG_6205_doubleProxySelectionSetSourceModel()
void tst_QSortFilterProxyModel::doubleProxySelectionSetSourceModel()
{
QStandardItemModel *model1 = new QStandardItemModel;
QStandardItem *parentItem = model1->invisibleRootItem();
@ -2837,7 +2837,7 @@ void tst_QSortFilterProxyModel::taskQTBUG_6205_doubleProxySelectionSetSourceMode
QVERIFY(ism.selection().isEmpty());
}
void tst_QSortFilterProxyModel::taskQTBUG_7537_appearsAndSort()
void tst_QSortFilterProxyModel::appearsAndSort()
{
class PModel : public QSortFilterProxyModel
{
@ -2910,7 +2910,7 @@ void tst_QSortFilterProxyModel::taskQTBUG_7537_appearsAndSort()
QCOMPARE(spyChanged2.count(), 1);
}
void tst_QSortFilterProxyModel::taskQTBUG_7716_unnecessaryDynamicSorting()
void tst_QSortFilterProxyModel::unnecessaryDynamicSorting()
{
QStringListModel model;
const QStringList initial = QString("bravo charlie delta echo").split(" ");
@ -3111,7 +3111,7 @@ protected:
}
};
void tst_QSortFilterProxyModel::taskQTBUG_10287_unnecessaryMapCreation()
void tst_QSortFilterProxyModel::unnecessaryMapCreation()
{
Model10287 m;
Proxy10287 p(&m);
@ -3152,7 +3152,7 @@ void tst_QSortFilterProxyModel::filteredColumns()
insertCommand->doCommand();
}
void tst_QSortFilterProxyModel::taskQTBUG_17812_resetInvalidate_data()
void tst_QSortFilterProxyModel::resetInvalidate_data()
{
QTest::addColumn<int>("test");
QTest::addColumn<bool>("works");
@ -3163,7 +3163,7 @@ void tst_QSortFilterProxyModel::taskQTBUG_17812_resetInvalidate_data()
QTest::newRow("invalidate_filter") << 3 << true;
}
void tst_QSortFilterProxyModel::taskQTBUG_17812_resetInvalidate()
void tst_QSortFilterProxyModel::resetInvalidate()
{
QFETCH(int, test);
QFETCH(bool, works);