summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/testlauncher.cpp26
-rw-r--r--src/test/testmain.cpp42
2 files changed, 34 insertions, 34 deletions
diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp
index 19b378b8c..3dcda87e0 100644
--- a/src/test/testlauncher.cpp
+++ b/src/test/testlauncher.cpp
@@ -138,7 +138,7 @@ int TestLauncher::testBackend() const
{
const Image *const img = Theme::getImageFromTheme(
"graphics/sprites/arrow_up.png");
- if (!img)
+ if (img == nullptr)
return 1;
const int cnt = 100;
@@ -168,7 +168,7 @@ int TestLauncher::testRescale() const
Wallpaper::loadWallpapers();
const std::string wallpaperName = Wallpaper::getWallpaper(800, 600);
const volatile Image *const img = Theme::getImageFromTheme(wallpaperName);
- if (!img)
+ if (img == nullptr)
return 1;
sleep(1);
@@ -342,7 +342,7 @@ int TestLauncher::testTextures()
mainGraphics->clearScreen();
SDL_Surface *const surface = imageHelper->create32BitSurface(
nextSize, nextSize);
- if (!surface)
+ if (surface == nullptr)
break;
uint32_t *pixels = static_cast<uint32_t*>(surface->pixels);
for (int f = 0; f < 6; f ++)
@@ -351,7 +351,7 @@ int TestLauncher::testTextures()
graphicsManager.resetCachedError();
Image *const image = imageHelper->loadSurface(surface);
SDL_FreeSurface(surface);
- if (!image)
+ if (image == nullptr)
break;
if (graphicsManager.getLastErrorCached() != GL_NO_ERROR)
@@ -360,7 +360,7 @@ int TestLauncher::testTextures()
break;
}
Image *const subImage = image->getSubImage(0, 0, 10, 10);
- if (!subImage)
+ if (subImage == nullptr)
{
delete image;
break;
@@ -372,7 +372,7 @@ int TestLauncher::testTextures()
SDL_Surface *const screen1 = screenshortHelper->getScreenshot();
SDL_Surface *const screen2 = imageHelper->convertTo32Bit(screen1);
SDL_FreeSurface(screen1);
- if (!screen2)
+ if (screen2 == nullptr)
break;
pixels = static_cast<uint32_t*>(screen2->pixels);
bool fail(false);
@@ -460,16 +460,16 @@ int TestLauncher::testDye()
"graphics/sprites/arrow_up.png");
Dye *d = nullptr;
- if (rw)
+ if (rw != nullptr)
{
- Image *image = d ? surfaceImageHelper->load(rw, *d)
+ Image *image = d != nullptr ? surfaceImageHelper->load(rw, *d)
: surfaceImageHelper->load(rw);
- if (image)
+ if (image != nullptr)
{
const SDL_Rect &rect = image->mBounds;
SDL_Surface *surface = surfaceImageHelper->create32BitSurface(
rect.w, rect.h);
- if (surface)
+ if (surface != nullptr)
{
SurfaceImageHelper::combineSurface(image->mSDLSurface, nullptr,
surface, nullptr);
@@ -483,11 +483,11 @@ int TestLauncher::testDye()
"graphics/sprites/arrow_up.png");
d = new Dye("S:#0000ff,00ff00,5c5cff,ff0000");
image = surfaceImageHelper->load(rw, *d);
- if (image)
+ if (image != nullptr)
{
surface = surfaceImageHelper->create32BitSurface(
rect.w, rect.h);
- if (surface)
+ if (surface != nullptr)
{
SurfaceImageHelper::combineSurface(image->mSDLSurface,
nullptr, surface, nullptr);
@@ -732,7 +732,7 @@ int TestLauncher::testDraw()
img[1] = Theme::getImageFromTheme("graphics/sprites/arrow_right.png");
img[2] = Theme::getImageFromTheme("graphics/sprites/arrow_up.png");
Skin *skin = theme->load("button.xml", "button.xml");
- if (!skin)
+ if (skin == nullptr)
return 0;
ImageCollection *const col = new ImageCollection;
diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp
index 540ec5cf5..dae875b5a 100644
--- a/src/test/testmain.cpp
+++ b/src/test/testmain.cpp
@@ -92,7 +92,7 @@ int TestMain::exec(const bool testAudio)
std::string info;
const int videoDetectTest = invokeTest("99");
- if (!videoDetectTest)
+ if (videoDetectTest == 0)
detectMode = readValue2(99);
int normalOpenGLTest = invokeNormalOpenGLRenderTest("2");
@@ -106,15 +106,15 @@ int TestMain::exec(const bool testAudio)
info.append(strprintf("%d.%d,%d,%d,%d.", soundTest, softwareTest,
normalOpenGLTest, safeOpenGLTest, modernOpenGLTest));
- if (!softwareTest)
+ if (softwareTest == 0)
{
int softFpsTest = invokeSoftwareRenderTest("8");
info.append(strprintf("%d", softFpsTest));
- if (!softFpsTest)
+ if (softFpsTest == 0)
{
softFps = readValue2(8);
info.append(strprintf(",%d", softFps));
- if (!softFps)
+ if (softFps == 0)
{
softwareTest = -1;
softFpsTest = -1;
@@ -131,15 +131,15 @@ int TestMain::exec(const bool testAudio)
}
}
info.append(".");
- if (!modernOpenGLTest)
+ if (modernOpenGLTest == 0)
{
int modernOpenGLFpsTest = invokeModernOpenGLRenderTest("17");
info.append(strprintf("%d", modernOpenGLFpsTest));
- if (!modernOpenGLFpsTest)
+ if (modernOpenGLFpsTest == 0)
{
modernOpenGLFps = readValue2(17);
info.append(strprintf(",%d", modernOpenGLFps));
- if (!modernOpenGLFps)
+ if (modernOpenGLFps == 0)
{
modernOpenGLTest = -1;
modernOpenGLFpsTest = -1;
@@ -156,15 +156,15 @@ int TestMain::exec(const bool testAudio)
}
}
info.append(".");
- if (!normalOpenGLTest)
+ if (normalOpenGLTest == 0)
{
int normalOpenGLFpsTest = invokeNormalOpenGLRenderTest("9");
info.append(strprintf("%d", normalOpenGLFpsTest));
- if (!normalOpenGLFpsTest)
+ if (normalOpenGLFpsTest == 0)
{
normalOpenGLFps = readValue2(9);
info.append(strprintf(",%d", normalOpenGLFps));
- if (!normalOpenGLFps)
+ if (normalOpenGLFps == 0)
{
normalOpenGLTest = -1;
normalOpenGLFpsTest = -1;
@@ -181,15 +181,15 @@ int TestMain::exec(const bool testAudio)
}
}
info.append(".");
- if (!safeOpenGLTest)
+ if (safeOpenGLTest == 0)
{
int safeOpenGLFpsTest = invokeSafeOpenGLRenderTest("10");
info.append(strprintf("%d", safeOpenGLFpsTest));
- if (!safeOpenGLFpsTest)
+ if (safeOpenGLFpsTest == 0)
{
safeOpenGLFps = readValue2(10);
info.append(strprintf(",%d", safeOpenGLFps));
- if (!safeOpenGLFps)
+ if (safeOpenGLFps == 0)
{
safeOpenGLTest = -1;
safeOpenGLFpsTest = -1;
@@ -226,27 +226,27 @@ int TestMain::exec(const bool testAudio)
int batchSize = 256;
- if (!invokeNormalOpenBatchTest("11"))
+ if (invokeNormalOpenBatchTest("11") == 0)
batchSize = readValue2(11);
if (batchSize < 256)
batchSize = 256;
- if (!invokeNormalOpenBatchTest("14"))
+ if (invokeNormalOpenBatchTest("14") == 0)
{
textureSize[CAST_SIZE(RENDER_NORMAL_OPENGL)]
= readValue2(14);
}
- if (!invokeModernOpenBatchTest("15"))
+ if (invokeModernOpenBatchTest("15") == 0)
{
textureSize[CAST_SIZE(RENDER_MODERN_OPENGL)]
= readValue2(15);
}
- if (!invokeSafeOpenBatchTest("16"))
+ if (invokeSafeOpenBatchTest("16") == 0)
{
textureSize[CAST_SIZE(RENDER_SAFE_OPENGL)]
= readValue2(16);
}
- if (!invokeMobileOpenBatchTest("20"))
+ if (invokeMobileOpenBatchTest("20") == 0)
{
textureSize[CAST_SIZE(RENDER_GLES_OPENGL)]
= readValue2(20);
@@ -260,7 +260,7 @@ int TestMain::exec(const bool testAudio)
textureSizeStr.append(strprintf(",%d", textureSize[f]));
// if OpenGL implimentation is not good, disable it.
- if (!(detectMode & 15))
+ if ((detectMode & 15) == 0)
openGLMode = RENDER_SOFTWARE;
writeConfig(openGLMode, rescaleTest[CAST_SIZE(openGLMode)],
@@ -282,8 +282,8 @@ void TestMain::writeConfig(const RenderType openGLMode,
// searched values
mConfig.setValue("opengl", CAST_S32(openGLMode));
- mConfig.setValue("showBackground", !rescale);
- mConfig.setValue("sound", !sound);
+ mConfig.setValue("showBackground", rescale == 0);
+ mConfig.setValue("sound", sound == 0);
// better performance
mConfig.setValue("hwaccel", true);