summaryrefslogtreecommitdiffstats
path: root/tests/auto/qitemmodel/modelstotest.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-05-20 19:45:38 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-05-20 19:46:19 +0200
commitd671acd5b296b83440db9836a92189c501c87ff3 (patch)
treebd9c1a000e17c70124c207666cfb3276b5518ffd /tests/auto/qitemmodel/modelstotest.cpp
parent42f5786104f9eef9542df2c7469a03324978281d (diff)
parent4f2138ecfbdc58e5cb5b0c7d762197ef69752957 (diff)
Merge remote branch 'staging/master' into refactor
Conflicts: src/opengl/qgl_qpa.cpp src/plugins/platforms/glxconvenience/qglxconvenience.cpp src/plugins/platforms/platforms.pro src/plugins/platforms/wayland/qwaylandwindow.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/plugins/platforms/xcb/qxcbwindow.h src/plugins/platforms/xcb/qxcbwindowsurface.cpp src/widgets/kernel/qwidget_qpa.cpp tests/auto/qvariant/tst_qvariant.cpp
Diffstat (limited to 'tests/auto/qitemmodel/modelstotest.cpp')
-rw-r--r--tests/auto/qitemmodel/modelstotest.cpp35
1 files changed, 25 insertions, 10 deletions
diff --git a/tests/auto/qitemmodel/modelstotest.cpp b/tests/auto/qitemmodel/modelstotest.cpp
index c4c2cbb521..df06c95254 100644
--- a/tests/auto/qitemmodel/modelstotest.cpp
+++ b/tests/auto/qitemmodel/modelstotest.cpp
@@ -227,7 +227,6 @@ QAbstractItemModel *ModelsToTest::createModel(const QString &modelType)
return widget->model();
}
- Q_ASSERT(false);
return 0;
}
@@ -309,15 +308,23 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model)
*/
}
QModelIndex returnIndex = model->index(0,0);
- Q_ASSERT(returnIndex.isValid());
+ if (!returnIndex.isValid())
+ qFatal("%s: model index to be returned is invalid", Q_FUNC_INFO);
return returnIndex;
}
if (QDirModel *dirModel = qobject_cast<QDirModel *>(model)) {
- // Don't risk somthing bad happening, assert if this fails
- Q_ASSERT(QDir(QDir::currentPath()).mkdir("test"));
- for (int i = 0; i < 26; ++i)
- Q_ASSERT(QDir(QDir::currentPath()).mkdir(QString("test/foo_%1").arg(i)));
+ if (!QDir::current().mkdir("test"))
+ qFatal("%s: cannot create directory %s",
+ Q_FUNC_INFO,
+ qPrintable(QDir::toNativeSeparators(QDir::currentPath()+"/test")));
+ for (int i = 0; i < 26; ++i) {
+ QString subdir = QString("test/foo_%1").arg(i);
+ if (!QDir::current().mkdir(subdir))
+ qFatal("%s: cannot create directory %s",
+ Q_FUNC_INFO,
+ qPrintable(QDir::toNativeSeparators(QDir::currentPath()+"/"+subdir)));
+ }
return dirModel->index(QDir::currentPath()+"/test");
}
@@ -373,7 +380,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model)
return QModelIndex();
}
- Q_ASSERT(false);
+ qFatal("%s: unknown type of model", Q_FUNC_INFO);
return QModelIndex();
}
@@ -387,9 +394,17 @@ void ModelsToTest::cleanupTestArea(QAbstractItemModel *model)
{
if (QDir(QDir::currentPath()+"/test").exists())
{
- for (int i = 0; i < 26; ++i)
- QDir::current().rmdir(QString("test/foo_%1").arg(i));
- Q_ASSERT(QDir::current().rmdir("test"));
+ for (int i = 0; i < 26; ++i) {
+ QString subdir(QString("test/foo_%1").arg(i));
+ if (!QDir::current().rmdir(subdir))
+ qFatal("%s: cannot remove directory %s",
+ Q_FUNC_INFO,
+ qPrintable(QDir::toNativeSeparators(QDir::currentPath()+"/"+subdir)));
+ }
+ if (!QDir::current().rmdir("test"))
+ qFatal("%s: cannot remove directory %s",
+ Q_FUNC_INFO,
+ qPrintable(QDir::toNativeSeparators(QDir::currentPath()+"/test")));
}
} else if (qobject_cast<QSqlQueryModel *>(model)) {
QSqlQuery q("DROP TABLE test");