From 4c1469f7da33dd65eb5e8e9a50b79d935eb4add0 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 29 Dec 2011 15:45:04 +1000 Subject: [PATCH] Improve QTextCodec::codecForLocale() test. 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 --- .../codecs/qtextcodec/tst_qtextcodec.cpp | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp index deb983c262..9c5a15d92c 100644 --- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp +++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp @@ -356,17 +356,18 @@ void tst_QTextCodec::codecForLocale() break; } } - if (!codec2) { - QSKIP("Could not find a codec that is not already the codecForLocale()"); + + // 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); } - - // 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); #endif }