diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-03 05:58:24 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-04 04:29:23 (GMT) |
commit | a8dc321b6669dd263a25a0cb5766e5b7150c6e20 (patch) | |
tree | 16bf20ceaa4cd22ad757947be371e0e88f7e9fe7 /tests/auto/qvariant/tst_qvariant.cpp | |
parent | a88dd1c5f62b5ded8ea0d76d185127ef28549c72 (diff) | |
download | Qt-a8dc321b6669dd263a25a0cb5766e5b7150c6e20.zip Qt-a8dc321b6669dd263a25a0cb5766e5b7150c6e20.tar.gz Qt-a8dc321b6669dd263a25a0cb5766e5b7150c6e20.tar.bz2 |
Remove Q_ASSERT's from QVariant autotest.
Print a meaningful warning message instead of aborting in debug
mode builds and failing silently in release mode builds.
Change-Id: I44143c5fbe6b6af87bdf5bd231cfaf9a3c9c33f8
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
Diffstat (limited to 'tests/auto/qvariant/tst_qvariant.cpp')
-rw-r--r-- | tests/auto/qvariant/tst_qvariant.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp index 62babdb..fef7ec2 100644 --- a/tests/auto/qvariant/tst_qvariant.cpp +++ b/tests/auto/qvariant/tst_qvariant.cpp @@ -3232,18 +3232,21 @@ struct MyData { void *ptr; MyData() : ptr(this) {} - ~MyData() { Q_ASSERT(ptr == this); } + ~MyData() + { + if (ptr != this) qWarning("MyData::~MyData(): object has moved"); + } MyData(const MyData& o) : ptr(this) { Q_ASSERT(o.ptr == &o); } MyData &operator=(const MyData &o) { - Q_ASSERT(ptr == this); - Q_ASSERT(o.ptr == &o); + if (ptr != this) qWarning("MyData::operator=(): object has moved"); + if (o.ptr != &o) qWarning("MyData::operator=(): other object has moved"); return *this; } bool operator==(const MyData &o) const { - Q_ASSERT(ptr == this); - Q_ASSERT(o.ptr == &o); + if (ptr != this) qWarning("MyData::operator==(): object has moved"); + if (o.ptr != &o) qWarning("MyData::operator==(): other object has moved"); return true; } }; |