Improve QTextCodec::codecForLocale() test.
authorJason McDonald <jason.mcdonald@nokia.com>
Thu, 29 Dec 2011 05:45:04 +0000 (15:45 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 29 Dec 2011 12:27:17 +0000 (13:27 +0100)
Don't call QSKIP when omitting the optional part of the test, as doing
so hides the fact that the rest of the test passed.

Change-Id: I9c102e8daeaf9586b2e510c4c9ce697ead290795
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp

index deb983c..9c5a15d 100644 (file)
@@ -356,17 +356,18 @@ void tst_QTextCodec::codecForLocale()
                 break;
         }
     }
-    if (!codec2) {
-        QSKIP("Could not find a codec that is not already the codecForLocale()");
-    }
 
-    // set it, codecForLocale() should return it now
-    QTextCodec::setCodecForLocale(codec2);
-    QCOMPARE(QTextCodec::codecForLocale(), codec2);
+    // Only run the rest of the test if we could find a codec that is not
+    // already the codecForLocale().
+    if (codec2) {
+        // set it, codecForLocale() should return it now
+        QTextCodec::setCodecForLocale(codec2);
+        QCOMPARE(QTextCodec::codecForLocale(), codec2);
 
-    // reset back to the default
-    QTextCodec::setCodecForLocale(0);
-    QCOMPARE(QTextCodec::codecForLocale(), codec);
+        // reset back to the default
+        QTextCodec::setCodecForLocale(0);
+        QCOMPARE(QTextCodec::codecForLocale(), codec);
+    }
 #endif
 }