Remove Q_ASSERT from QMetaObject autotest.
authorJason McDonald <jason.mcdonald@nokia.com>
Tue, 3 May 2011 01:44:16 +0000 (11:44 +1000)
committerRohan McGovern <rohan.mcgovern@nokia.com>
Wed, 18 May 2011 00:46:42 +0000 (10:46 +1000)
Issue a helpful warning rather than ignoring the error in release mode
builds.

Change-Id: Iea7bf4d63f8227abaf7dcf1700c5fef62763afad
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
(cherry picked from commit 6f082a3fdd368cd7a969b7f324354583d081da82)

tests/auto/qmetaobject/tst_qmetaobject.cpp

index 13e3bcd..f1a909a 100644 (file)
@@ -244,7 +244,12 @@ public:
     QObject *child;
 
 public slots:
-    void on_child1_destroyed(QObject *obj = 0) { ++invokeCount1; Q_ASSERT(obj && obj == child); }
+    void on_child1_destroyed(QObject *obj = 0)
+    {
+        ++invokeCount1;
+        if (!obj || obj != child)
+            qWarning() << "on_child1_destroyed invoked with wrong child object";
+    }
     void on_child2_destroyed() { ++invokeCount2; }
 };
 
@@ -268,7 +273,12 @@ public:
     }
 
 private slots:
-    void on_child1_destroyed(QObject *obj) { ++invokeCount1; Q_ASSERT(obj && obj == child); }
+    void on_child1_destroyed(QObject *obj)
+    {
+        ++invokeCount1;
+        if (!obj || obj != child)
+            qWarning() << "on_child1_destroyed invoked with wrong child object";
+    }
     void on_child1_destroyed() { ++invokeCount2; }
 };