From 003ed73811987b1ec5d9496e8ba382c1dc421e79 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 22 Sep 2009 14:22:21 +0200 Subject: Workaround a bug in QDirModel in tst_QDirModel::task196768_sorting The test was reported failing by pulse on many platform, but noone of us was able to reproduce it locally. The problem was that pulse runs the tests in a hidden dirrectory. And this exposed a bug in the QDirModel. We decided anyway that the bug was not worth fixing considered that QDirModel is kind of deprecated in favor of QFileSystemModel. (The bug is the one reported in task 255066) Reviewed-by: mbm Reviewed-by: Thierry --- tests/auto/qdirmodel/tst_qdirmodel.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/auto/qdirmodel/tst_qdirmodel.cpp b/tests/auto/qdirmodel/tst_qdirmodel.cpp index a8c298d..7ecadfc 100644 --- a/tests/auto/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/qdirmodel/tst_qdirmodel.cpp @@ -611,27 +611,24 @@ void tst_QDirModel::task196768_sorting() QString path = SRCDIR; QDirModel model; - QTreeView view; - QPersistentModelIndex index = model.index(path); - qDebug() << "Path" << path << "count" << model.rowCount(index) << "index" << index; + /* QDirModel has a bug if we show the content of the subdirectory inside a hidden directory + and we don't add QDir::Hidden. But as QDirModel is deprecated, we decided not to fix it. */ + model.setFilter(QDir::AllEntries | QDir::Hidden | QDir::AllDirs); + QTreeView view; + QPersistentModelIndex index = model.index(path); view.setModel(&model); - qDebug() << "After setModel" << index; QModelIndex index2 = model.index(path); - qDebug() << "A" << index << index2; QCOMPARE(index.data(), index2.data()); view.setRootIndex(index); index2 = model.index(path); - qDebug() << "B" << index << index2; QCOMPARE(index.data(), index2.data()); view.setCurrentIndex(index); index2 = model.index(path); - qDebug() << "C" << index << index2; QCOMPARE(index.data(), index2.data()); view.setSortingEnabled(true); index2 = model.index(path); - qDebug() << "After sorting" << index << index2 << "count" << model.rowCount(index2); QCOMPARE(index.data(), index2.data()); } -- cgit v0.12