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 <thiago.macieira@intel.com>
bb10
Jason McDonald 2011-12-29 15:45:04 +10:00 committed by Qt by Nokia
parent 78c27380c6
commit 4c1469f7da
1 changed files with 11 additions and 10 deletions

View File

@ -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
}