Tests: Do not rely on qCompare(bool, int,...).

The overload was added for NokiaX86 and RVCT and is bound for
removal.

Task-number: QTBUG-47260
Change-Id: Ic67cee8769847956e16cd0470ebcd663a9e98a40
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Friedemann Kleint 2015-07-16 16:40:42 +02:00
parent 524ae251bb
commit ce7fb157f0
2 changed files with 35 additions and 35 deletions

View File

@ -479,34 +479,34 @@ void tst_QAtomicInt::testAndSet_data()
QTest::addColumn<int>("value");
QTest::addColumn<int>("expected");
QTest::addColumn<int>("newval");
QTest::addColumn<int>("result");
QTest::addColumn<bool>("result");
// these should succeed
QTest::newRow("success0") << 0 << 0 << 0 << 1;
QTest::newRow("success1") << 0 << 0 << 1 << 1;
QTest::newRow("success2") << 0 << 0 << -1 << 1;
QTest::newRow("success3") << 1 << 1 << 0 << 1;
QTest::newRow("success4") << 1 << 1 << 1 << 1;
QTest::newRow("success5") << 1 << 1 << -1 << 1;
QTest::newRow("success6") << -1 << -1 << 0 << 1;
QTest::newRow("success7") << -1 << -1 << 1 << 1;
QTest::newRow("success8") << -1 << -1 << -1 << 1;
QTest::newRow("success9") << INT_MIN+1 << INT_MIN+1 << INT_MIN+1 << 1;
QTest::newRow("successA") << INT_MIN+1 << INT_MIN+1 << 1 << 1;
QTest::newRow("successB") << INT_MIN+1 << INT_MIN+1 << -1 << 1;
QTest::newRow("successC") << INT_MAX << INT_MAX << INT_MAX << 1;
QTest::newRow("successD") << INT_MAX << INT_MAX << 1 << 1;
QTest::newRow("successE") << INT_MAX << INT_MAX << -1 << 1;
QTest::newRow("success0") << 0 << 0 << 0 << true;
QTest::newRow("success1") << 0 << 0 << 1 << true;
QTest::newRow("success2") << 0 << 0 << -1 << true;
QTest::newRow("success3") << 1 << 1 << 0 << true;
QTest::newRow("success4") << 1 << 1 << 1 << true;
QTest::newRow("success5") << 1 << 1 << -1 << true;
QTest::newRow("success6") << -1 << -1 << 0 << true;
QTest::newRow("success7") << -1 << -1 << 1 << true;
QTest::newRow("success8") << -1 << -1 << -1 << true;
QTest::newRow("success9") << INT_MIN+1 << INT_MIN+1 << INT_MIN+1 << true;
QTest::newRow("successA") << INT_MIN+1 << INT_MIN+1 << 1 << true;
QTest::newRow("successB") << INT_MIN+1 << INT_MIN+1 << -1 << true;
QTest::newRow("successC") << INT_MAX << INT_MAX << INT_MAX << true;
QTest::newRow("successD") << INT_MAX << INT_MAX << 1 << true;
QTest::newRow("successE") << INT_MAX << INT_MAX << -1 << true;
// these should fail
QTest::newRow("failure0") << 0 << 1 << ~0 << 0;
QTest::newRow("failure1") << 0 << -1 << ~0 << 0;
QTest::newRow("failure2") << 1 << 0 << ~0 << 0;
QTest::newRow("failure3") << -1 << 0 << ~0 << 0;
QTest::newRow("failure4") << 1 << -1 << ~0 << 0;
QTest::newRow("failure5") << -1 << 1 << ~0 << 0;
QTest::newRow("failure6") << INT_MIN+1 << INT_MAX << ~0 << 0;
QTest::newRow("failure7") << INT_MAX << INT_MIN+1 << ~0 << 0;
QTest::newRow("failure0") << 0 << 1 << ~0 << false;
QTest::newRow("failure1") << 0 << -1 << ~0 << false;
QTest::newRow("failure2") << 1 << 0 << ~0 << false;
QTest::newRow("failure3") << -1 << 0 << ~0 << false;
QTest::newRow("failure4") << 1 << -1 << ~0 << false;
QTest::newRow("failure5") << -1 << 1 << ~0 << false;
QTest::newRow("failure6") << INT_MIN+1 << INT_MAX << ~0 << false;
QTest::newRow("failure7") << INT_MAX << INT_MIN+1 << ~0 << false;
}
void tst_QAtomicInt::testAndSet()
@ -517,26 +517,26 @@ void tst_QAtomicInt::testAndSet()
{
QAtomicInt atomic = value;
QTEST(atomic.testAndSetRelaxed(expected, newval) ? 1 : 0, "result");
QTEST(atomic.testAndSetRelaxed(expected, newval), "result");
}
{
QAtomicInt atomic = value;
QTEST(atomic.testAndSetAcquire(expected, newval) ? 1 : 0, "result");
QTEST(atomic.testAndSetAcquire(expected, newval), "result");
}
{
QAtomicInt atomic = value;
QTEST(atomic.testAndSetRelease(expected, newval) ? 1 : 0, "result");
QTEST(atomic.testAndSetRelease(expected, newval), "result");
}
{
QAtomicInt atomic = value;
QTEST(atomic.testAndSetOrdered(expected, newval) ? 1 : 0, "result");
QTEST(atomic.testAndSetOrdered(expected, newval), "result");
}
#ifdef Q_ATOMIC_INT32_IS_SUPPORTED
QFETCH(int, result);
QFETCH(bool, result);
// the new implementation has the version that loads the current value
{

View File

@ -2115,25 +2115,25 @@ void tst_QGL::qglContextDefaultBindTexture()
QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
// Make sure the texture IDs returned are valid:
QCOMPARE((bool)funcs->glIsTexture(boundImageTextureId), GL_TRUE);
QCOMPARE((bool)funcs->glIsTexture(boundPixmapTextureId), GL_TRUE);
QCOMPARE(funcs->glIsTexture(boundImageTextureId), GLboolean(GL_TRUE));
QCOMPARE(funcs->glIsTexture(boundPixmapTextureId), GLboolean(GL_TRUE));
// Make sure the textures are still valid after we delete the image/pixmap:
// Also check that although the textures are left intact, the cache entries are removed:
delete boundImage;
boundImage = 0;
QCOMPARE((bool)funcs->glIsTexture(boundImageTextureId), GL_TRUE);
QCOMPARE(funcs->glIsTexture(boundImageTextureId), GLboolean(GL_TRUE));
QCOMPARE(QGLTextureCache::instance()->size(), startCacheItemCount+1);
delete boundPixmap;
boundPixmap = 0;
QCOMPARE((bool)funcs->glIsTexture(boundPixmapTextureId), GL_TRUE);
QCOMPARE(funcs->glIsTexture(boundPixmapTextureId), GLboolean(GL_TRUE));
QCOMPARE(QGLTextureCache::instance()->size(), startCacheItemCount);
// Finally, make sure QGLContext::deleteTexture deletes the texture IDs:
ctx->deleteTexture(boundImageTextureId);
ctx->deleteTexture(boundPixmapTextureId);
QCOMPARE((bool)funcs->glIsTexture(boundImageTextureId), GL_FALSE);
QCOMPARE((bool)funcs->glIsTexture(boundPixmapTextureId), GL_FALSE);
QCOMPARE(funcs->glIsTexture(boundImageTextureId), GLboolean(GL_FALSE));
QCOMPARE(funcs->glIsTexture(boundPixmapTextureId), GLboolean(GL_FALSE));
}
#endif