Make tst_QGraphicsAnchorLayout1 pass on Mac OS X
authorBradley T. Hughes <bradley.hughes@nokia.com>
Fri, 13 Jan 2012 10:11:57 +0000 (11:11 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 17 Jan 2012 09:29:56 +0000 (10:29 +0100)
On Mac OS X, tests are build with QT_DEBUG defined, but run against
libraries built with QT_NO_DEBUG, so the expected warning output is not
seen. Use a run-time check instead to know whether or not to expect the
warning output.

Change-Id: Ifb772b764d4135cc8f896827727939fd8cff5388
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp

index 0fd19c4..57be32d 100644 (file)
@@ -559,10 +559,9 @@ void tst_QGraphicsAnchorLayout1::testSpecialCases()
 {
     // One widget, setLayout before defining layouts
     {
-#ifdef QT_DEBUG
-    QTest::ignoreMessage(QtWarningMsg, "QGraphicsLayout::addChildLayoutItem: QGraphicsWidget \"\""
-                                       " in wrong parent; moved to correct parent");
-#endif
+    if (QLibraryInfo::isDebugBuild())
+        QTest::ignoreMessage(QtWarningMsg, "QGraphicsLayout::addChildLayoutItem: QGraphicsWidget \"\""
+                                           " in wrong parent; moved to correct parent");
     QGraphicsWidget *widget = new QGraphicsWidget;
     TheAnchorLayout *layout = new TheAnchorLayout();
     widget->setLayout(layout);
@@ -581,10 +580,9 @@ void tst_QGraphicsAnchorLayout1::testSpecialCases()
 
     // One widget, layout inside layout, layout inside layout inside layout
     {
-#ifdef QT_DEBUG
-    QTest::ignoreMessage(QtWarningMsg, "QGraphicsLayout::addChildLayoutItem: QGraphicsWidget \"\""
-                                       " in wrong parent; moved to correct parent");
-#endif
+    if (QLibraryInfo::isDebugBuild())
+        QTest::ignoreMessage(QtWarningMsg, "QGraphicsLayout::addChildLayoutItem: QGraphicsWidget \"\""
+                                           " in wrong parent; moved to correct parent");
     QGraphicsWidget *widget = new QGraphicsWidget;
     TheAnchorLayout *layout = new TheAnchorLayout();
     widget->setLayout(layout);