summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-04-15 04:15:49 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2011-04-15 04:39:24 (GMT)
commit1750a4351a8125756bf38a53d6d8312993c7d85e (patch)
treec744c89f7273f15b26a7a78200e5a0086f58468a
parent3475168550c1a804f04f2a4edfeb30c04cd36551 (diff)
downloadQt-1750a4351a8125756bf38a53d6d8312993c7d85e.zip
Qt-1750a4351a8125756bf38a53d6d8312993c7d85e.tar.gz
Qt-1750a4351a8125756bf38a53d6d8312993c7d85e.tar.bz2
Remove Q_ASSERT calls that wrap side-effecting code.
In release mode builds, code inside Q_ASSERT macros is not executed, so putting code with side-effects inside Q_ASSERT is not a good idea. Task-number: QTBUG-17582 Change-Id: I1a5d8ccce666ee7b7f120bf9cbb49e30dac9add4 Reviewed-by: Rohan McGovern
-rw-r--r--tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
index 2dbed3b..50c634f 100644
--- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
+++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
@@ -185,16 +185,22 @@ QString tst_qmlvisual::toTestScript(const QString &file, Mode mode)
if (platformsuffix && (mode == UpdatePlatformVisuals || QFile::exists(testdata+QLatin1String(platformsuffix)+QDir::separator()+testname+".qml"))) {
QString platformdir = testdata + QLatin1String(platformsuffix);
if (mode == UpdatePlatformVisuals) {
- Q_ASSERT(QDir().mkpath(platformdir));
+ if (!QDir().mkpath(platformdir)) {
+ qFatal("Cannot make path %s", qPrintable(platformdir));
+ }
// Copy from base
QDir dir(testdata,testname+".*");
dir.setFilter(QDir::Files);
QFileInfoList list = dir.entryInfoList();
for (int i = 0; i < list.size(); ++i) {
QFile in(list.at(i).filePath());
- Q_ASSERT(in.open(QIODevice::ReadOnly));
+ if (!in.open(QIODevice::ReadOnly)) {
+ qFatal("Cannot open file %s: %s", qPrintable(in.fileName()), qPrintable(in.errorString()));
+ }
QFile out(platformdir + QDir::separator() + list.at(i).fileName());
- Q_ASSERT(out.open(QIODevice::WriteOnly));
+ if (!out.open(QIODevice::WriteOnly)) {
+ qFatal("Cannot open file %s: %s", qPrintable(out.fileName()), qPrintable(out.errorString()));
+ }
out.write(in.readAll());
}
}