diff options
Diffstat (limited to 'tests')
29 files changed, 94 insertions, 94 deletions
diff --git a/tests/BBoxHierarchyTest.cpp b/tests/BBoxHierarchyTest.cpp index b9cbbc4f9a..71b96994f2 100644 --- a/tests/BBoxHierarchyTest.cpp +++ b/tests/BBoxHierarchyTest.cpp @@ -86,7 +86,7 @@ static void tree_test_main(SkBBoxHierarchy* tree, int minChildren, int maxChildr skiatest::Reporter* reporter) { DataRect rects[NUM_RECTS]; SkRandom rand; - REPORTER_ASSERT(reporter, NULL != tree); + REPORTER_ASSERT(reporter, tree); int expectedDepthMin = -1; int expectedDepthMax = -1; diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp index 82789a1bfb..92e9d78549 100644 --- a/tests/CachedDecodingPixelRefTest.cpp +++ b/tests/CachedDecodingPixelRefTest.cpp @@ -63,8 +63,8 @@ static void compare_bitmaps(skiatest::Reporter* reporter, if (b1.isNull() || b1.empty()) { return; } - REPORTER_ASSERT(reporter, NULL != b1.getPixels()); - REPORTER_ASSERT(reporter, NULL != b2.getPixels()); + REPORTER_ASSERT(reporter, b1.getPixels()); + REPORTER_ASSERT(reporter, b2.getPixels()); if ((!(b1.getPixels())) || (!(b2.getPixels()))) { return; } @@ -122,7 +122,7 @@ static void test_three_encodings(skiatest::Reporter* reporter, REPORTER_ASSERT(reporter, NULL == lazy.getPixels()); { SkAutoLockPixels autoLockPixels(lazy); // now pixels are good. - REPORTER_ASSERT(reporter, NULL != lazy.getPixels()); + REPORTER_ASSERT(reporter, lazy.getPixels()); if (NULL == lazy.getPixels()) { continue; } @@ -131,7 +131,7 @@ static void test_three_encodings(skiatest::Reporter* reporter, REPORTER_ASSERT(reporter, NULL == lazy.getPixels()); { SkAutoLockPixels autoLockPixels(lazy); // now pixels are good. - REPORTER_ASSERT(reporter, NULL != lazy.getPixels()); + REPORTER_ASSERT(reporter, lazy.getPixels()); if (NULL == lazy.getPixels()) { continue; } @@ -184,7 +184,7 @@ public: protected: virtual bool onGetInfo(SkImageInfo* info) SK_OVERRIDE { - REPORTER_ASSERT(fReporter, NULL != info); + REPORTER_ASSERT(fReporter, info); if ((NULL == info) || (kFailGetInfo_TestType == fType)) { return false; } @@ -223,7 +223,7 @@ static void check_test_image_generator_bitmap(skiatest::Reporter* reporter, REPORTER_ASSERT(reporter, TestImageGenerator::Width() == bm.width()); REPORTER_ASSERT(reporter, TestImageGenerator::Height() == bm.height()); SkAutoLockPixels autoLockPixels(bm); - REPORTER_ASSERT(reporter, NULL != bm.getPixels()); + REPORTER_ASSERT(reporter, bm.getPixels()); if (NULL == bm.getPixels()) { return; } diff --git a/tests/CanvasStateTest.cpp b/tests/CanvasStateTest.cpp index 787f9afaec..8364a4b414 100644 --- a/tests/CanvasStateTest.cpp +++ b/tests/CanvasStateTest.cpp @@ -270,7 +270,7 @@ DEF_TEST(CanvasState_test_draw_filters, reporter) { SkCanvas* tmpCanvas = SkCanvasStateUtils::CreateFromCanvasState(state); REPORTER_ASSERT(reporter, tmpCanvas); - REPORTER_ASSERT(reporter, NULL != canvas.getDrawFilter()); + REPORTER_ASSERT(reporter, canvas.getDrawFilter()); REPORTER_ASSERT(reporter, NULL == tmpCanvas->getDrawFilter()); tmpCanvas->unref(); diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp index 0620df947b..662e68040e 100644 --- a/tests/ClipStackTest.cpp +++ b/tests/ClipStackTest.cpp @@ -980,12 +980,12 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) { // whether the result is bounded or not, the whole plane should start outside the clip. reducedStack.clipEmpty(); } - for (ElementList::Iter iter = reducedClips.headIter(); NULL != iter.get(); iter.next()) { + for (ElementList::Iter iter = reducedClips.headIter(); iter.get(); iter.next()) { add_elem_to_stack(*iter.get(), &reducedStack); } // GrReducedClipStack assumes that the final result is clipped to the returned bounds - if (NULL != tightBounds) { + if (tightBounds) { reducedStack.clipDevRect(*tightBounds, SkRegion::kIntersect_Op); } @@ -1191,7 +1191,7 @@ DEF_TEST(ClipStack, reporter) { SkRect answer; answer.iset(25, 25, 75, 75); - REPORTER_ASSERT(reporter, NULL != element); + REPORTER_ASSERT(reporter, element); REPORTER_ASSERT(reporter, SkClipStack::Element::kRect_Type == element->getType()); REPORTER_ASSERT(reporter, SkRegion::kIntersect_Op == element->getOp()); REPORTER_ASSERT(reporter, element->getRect() == answer); diff --git a/tests/DeferredCanvasTest.cpp b/tests/DeferredCanvasTest.cpp index b8b82b2e83..61af550e20 100644 --- a/tests/DeferredCanvasTest.cpp +++ b/tests/DeferredCanvasTest.cpp @@ -681,7 +681,7 @@ static PixelPtr get_surface_ptr(SkSurface* surface, bool useGpu) { static void TestDeferredCanvasSurface(skiatest::Reporter* reporter, GrContextFactory* factory) { SkImageInfo imageSpec = SkImageInfo::MakeN32Premul(10, 10); - bool useGpu = NULL != factory; + bool useGpu = SkToBool(factory); int cnt; #if SK_SUPPORT_GPU if (useGpu) { @@ -712,7 +712,7 @@ static void TestDeferredCanvasSurface(skiatest::Reporter* reporter, GrContextFac { surface = SkSurface::NewRaster(imageSpec); } - SkASSERT(NULL != surface); + SkASSERT(surface); SkAutoTUnref<SkSurface> aur(surface); SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface)); @@ -764,7 +764,7 @@ static void TestDeferredCanvasSetSurface(skiatest::Reporter* reporter, GrContext SkImageInfo imageSpec = SkImageInfo::MakeN32Premul(10, 10); SkSurface* surface; SkSurface* alternateSurface; - bool useGpu = NULL != factory; + bool useGpu = SkToBool(factory); int cnt; #if SK_SUPPORT_GPU if (useGpu) { @@ -796,8 +796,8 @@ static void TestDeferredCanvasSetSurface(skiatest::Reporter* reporter, GrContext surface = SkSurface::NewRaster(imageSpec); alternateSurface = SkSurface::NewRaster(imageSpec); } - SkASSERT(NULL != surface); - SkASSERT(NULL != alternateSurface); + SkASSERT(surface); + SkASSERT(alternateSurface); SkAutoTUnref<SkSurface> aur1(surface); SkAutoTUnref<SkSurface> aur2(alternateSurface); PixelPtr pixels1 = get_surface_ptr(surface, useGpu); diff --git a/tests/DequeTest.cpp b/tests/DequeTest.cpp index 5d5dc09176..04b1f4010e 100644 --- a/tests/DequeTest.cpp +++ b/tests/DequeTest.cpp @@ -19,8 +19,8 @@ static void assert_count(skiatest::Reporter* reporter, const SkDeque& deq, int c REPORTER_ASSERT(reporter, !deq.empty()); REPORTER_ASSERT(reporter, count == deq.count()); REPORTER_ASSERT(reporter, sizeof(int) == deq.elemSize()); - REPORTER_ASSERT(reporter, NULL != deq.front()); - REPORTER_ASSERT(reporter, NULL != deq.back()); + REPORTER_ASSERT(reporter, deq.front()); + REPORTER_ASSERT(reporter, deq.back()); if (1 == count) { REPORTER_ASSERT(reporter, deq.back() == deq.front()); } else { @@ -36,7 +36,7 @@ static void assert_iter(skiatest::Reporter* reporter, const SkDeque& deq, void* ptr; int value = max; - while (NULL != (ptr = iter.next())) { + while ((ptr = iter.next())) { REPORTER_ASSERT(reporter, value == *(int*)ptr); value -= 1; } @@ -46,7 +46,7 @@ static void assert_iter(skiatest::Reporter* reporter, const SkDeque& deq, iter.reset(deq, SkDeque::Iter::kBack_IterStart); value = min; - while (NULL != (ptr = iter.prev())) { + while ((ptr = iter.prev())) { REPORTER_ASSERT(reporter, value == *(int*)ptr); value += 1; } @@ -57,12 +57,12 @@ static void assert_iter(skiatest::Reporter* reporter, const SkDeque& deq, value = max; // forward iteration half-way - for (int i = 0; i < deq.count()/2 && NULL != (ptr = iter.next()); i++) { + for (int i = 0; i < deq.count()/2 && (ptr = iter.next()); i++) { REPORTER_ASSERT(reporter, value == *(int*)ptr); value -= 1; } // then back down w/ reverse iteration - while (NULL != (ptr = iter.prev())) { + while ((ptr = iter.prev())) { REPORTER_ASSERT(reporter, value == *(int*)ptr); value += 1; } diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp index c9aa778244..a1dc9dc0b3 100644 --- a/tests/FontMgrTest.cpp +++ b/tests/FontMgrTest.cpp @@ -16,7 +16,7 @@ static void test_font(skiatest::Reporter* reporter) { uint32_t flags = 0; SkAutoTUnref<SkFont> font(SkFont::Create(NULL, 24, SkFont::kA8_MaskType, flags)); - REPORTER_ASSERT(reporter, NULL != font->getTypeface()); + REPORTER_ASSERT(reporter, font->getTypeface()); REPORTER_ASSERT(reporter, 24 == font->getSize()); REPORTER_ASSERT(reporter, 1 == font->getScaleX()); REPORTER_ASSERT(reporter, 0 == font->getSkewX()); diff --git a/tests/GLInterfaceValidationTest.cpp b/tests/GLInterfaceValidationTest.cpp index 541af8fe92..797ba72cc0 100755 --- a/tests/GLInterfaceValidationTest.cpp +++ b/tests/GLInterfaceValidationTest.cpp @@ -22,14 +22,14 @@ DEF_GPUTEST(GLInterfaceValidation, reporter, factory) { // We're supposed to fail the NVPR context type when we the native context that does not // support the NVPR extension. if (GrContextFactory::kNVPR_GLContextType == glCtxType && - NULL != factory->getGLContext(GrContextFactory::kNative_GLContextType) && + factory->getGLContext(GrContextFactory::kNative_GLContextType) && !factory->getGLContext(GrContextFactory::kNative_GLContextType)->hasExtension("GL_NV_path_rendering")) { REPORTER_ASSERT(reporter, NULL == glCtxHelper); continue; } - REPORTER_ASSERT(reporter, NULL != glCtxHelper); - if (NULL != glCtxHelper) { + REPORTER_ASSERT(reporter, glCtxHelper); + if (glCtxHelper) { const GrGLInterface* interface = glCtxHelper->gl(); REPORTER_ASSERT(reporter, interface->validate()); } diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 6efd7d5b5b..a641fe2314 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -44,9 +44,9 @@ bool GrGLProgramDesc::setRandom(SkRandom* random, bool dstRead = false; bool fragPos = false; - bool vertexShader = (NULL != geometryProcessor); + bool vertexShader = SkToBool(geometryProcessor); int offset = 0; - if (NULL != geometryProcessor) { + if (geometryProcessor) { const GrEffectStage* stage = geometryProcessor; uint16_t* offsetAndSize = reinterpret_cast<uint16_t*>(fKey.begin() + kEffectKeyOffsetsAndLengthOffset + @@ -295,7 +295,7 @@ bool GrGpuGL::programUnitTest(int maxStages) { DEF_GPUTEST(GLPrograms, reporter, factory) { for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(type)); - if (NULL != context) { + if (context) { GrGpuGL* gpu = static_cast<GrGpuGL*>(context->getGpu()); int maxStages = 6; #if SK_ANGLE diff --git a/tests/GpuLayerCacheTest.cpp b/tests/GpuLayerCacheTest.cpp index 5e18197ed7..83f31f5f06 100644 --- a/tests/GpuLayerCacheTest.cpp +++ b/tests/GpuLayerCacheTest.cpp @@ -34,7 +34,7 @@ static void create_layers(skiatest::Reporter* reporter, GrCachedLayer* layer = cache->findLayerOrCreate(picture.uniqueID(), idOffset+i+1, idOffset+i+2, SkMatrix::I()); - REPORTER_ASSERT(reporter, NULL != layer); + REPORTER_ASSERT(reporter, layer); GrCachedLayer* temp = cache->findLayer(picture.uniqueID(), idOffset+i+1, idOffset+i+2, SkMatrix::I()); REPORTER_ASSERT(reporter, temp == layer); @@ -66,7 +66,7 @@ static void lock_layer(skiatest::Reporter* reporter, needsRerendering = cache->lock(layer, desc, false); REPORTER_ASSERT(reporter, !needsRerendering); - REPORTER_ASSERT(reporter, NULL != layer->texture()); + REPORTER_ASSERT(reporter, layer->texture()); REPORTER_ASSERT(reporter, layer->locked()); } @@ -100,7 +100,7 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) { for (int i = 0; i < kInitialNumLayers; ++i) { GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, i+2, SkMatrix::I()); - REPORTER_ASSERT(reporter, NULL != layer); + REPORTER_ASSERT(reporter, layer); lock_layer(reporter, &cache, layer); @@ -117,19 +117,19 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) { // Unlock the textures for (int i = 0; i < kInitialNumLayers; ++i) { GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, i+2, SkMatrix::I()); - REPORTER_ASSERT(reporter, NULL != layer); + REPORTER_ASSERT(reporter, layer); cache.unlock(layer); } for (int i = 0; i < kInitialNumLayers; ++i) { GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, i+2, SkMatrix::I()); - REPORTER_ASSERT(reporter, NULL != layer); + REPORTER_ASSERT(reporter, layer); REPORTER_ASSERT(reporter, !layer->locked()); // The first 4 layers should still be in the atlas. if (i < 4) { - REPORTER_ASSERT(reporter, NULL != layer->texture()); + REPORTER_ASSERT(reporter, layer->texture()); REPORTER_ASSERT(reporter, layer->isAtlased()); } else { // The final layer should be unlocked. @@ -145,7 +145,7 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) { GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), kInitialNumLayers+1, kInitialNumLayers+2, SkMatrix::I()); - REPORTER_ASSERT(reporter, NULL != layer); + REPORTER_ASSERT(reporter, layer); lock_layer(reporter, &cache, layer); cache.unlock(layer); @@ -155,13 +155,13 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) { GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, i+2, SkMatrix::I()); // 3 old layers plus the new one should be in the atlas. if (1 == i || 2 == i || 3 == i || 5 == i) { - REPORTER_ASSERT(reporter, NULL != layer); + REPORTER_ASSERT(reporter, layer); REPORTER_ASSERT(reporter, !layer->locked()); - REPORTER_ASSERT(reporter, NULL != layer->texture()); + REPORTER_ASSERT(reporter, layer->texture()); REPORTER_ASSERT(reporter, layer->isAtlased()); } else if (4 == i) { // The one that was never atlased should still be around - REPORTER_ASSERT(reporter, NULL != layer); + REPORTER_ASSERT(reporter, layer); REPORTER_ASSERT(reporter, NULL == layer->texture()); REPORTER_ASSERT(reporter, !layer->isAtlased()); diff --git a/tests/GrAllocatorTest.cpp b/tests/GrAllocatorTest.cpp index a05da8fc6c..c02a7ca9af 100644 --- a/tests/GrAllocatorTest.cpp +++ b/tests/GrAllocatorTest.cpp @@ -30,7 +30,7 @@ static void check_allocator_helper(GrTAllocator<C>* allocator, int cnt, int popC // again. Finally it resets the allocator and checks again. static void check_allocator(GrTAllocator<C>* allocator, int cnt, int popCnt, skiatest::Reporter* reporter) { - SkASSERT(NULL != allocator); + SkASSERT(allocator); SkASSERT(allocator->empty()); for (int i = 0; i < cnt; ++i) { // Try both variations of push_back(). diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index ff67b1b672..a2ed62928e 100644 --- a/tests/GrSurfaceTest.cpp +++ b/tests/GrSurfaceTest.cpp @@ -16,7 +16,7 @@ DEF_GPUTEST(GrSurface, reporter, factory) { GrContext* context = factory->get(GrContextFactory::kNull_GLContextType); - if (NULL != context) { + if (context) { GrTextureDesc desc; desc.fConfig = kSkia8888_GrPixelConfig; desc.fFlags = kRenderTarget_GrTextureFlagBit; diff --git a/tests/ImageCacheTest.cpp b/tests/ImageCacheTest.cpp index bda10a040a..317ed6da15 100644 --- a/tests/ImageCacheTest.cpp +++ b/tests/ImageCacheTest.cpp @@ -45,7 +45,7 @@ static void test_cache(skiatest::Reporter* reporter, SkResourceCache& cache, TestingRec* newRec = SkNEW_ARGS(TestingRec, (key, i)); const TestingRec* addedRec = (const TestingRec*)cache.addAndLock(newRec); - REPORTER_ASSERT(reporter, NULL != addedRec); + REPORTER_ASSERT(reporter, addedRec); const TestingRec* foundRec = (const TestingRec*)cache.findAndLock(key); REPORTER_ASSERT(reporter, foundRec == addedRec); @@ -59,7 +59,7 @@ static void test_cache(skiatest::Reporter* reporter, SkResourceCache& cache, for (size_t i = 0; i < COUNT * 100; ++i) { TestingKey key(i); SkResourceCache::ID id = cache.addAndLock(SkNEW_ARGS(TestingRec, (key, i))); - REPORTER_ASSERT(reporter, NULL != id); + REPORTER_ASSERT(reporter, id); cache.unlock(id); } } @@ -117,7 +117,7 @@ DEF_TEST(ImageCache_doubleAdd, r) { // Lookup can return either value. const TestingRec* rec = (const TestingRec*)cache.findAndLock(key); - REPORTER_ASSERT(r, NULL != rec); + REPORTER_ASSERT(r, rec); REPORTER_ASSERT(r, 2 == rec->fValue || 3 == rec->fValue); cache.unlock(rec); } diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp index 4d26167370..30665a6f8e 100644 --- a/tests/ImageDecodingTest.cpp +++ b/tests/ImageDecodingTest.cpp @@ -278,7 +278,7 @@ DEF_TEST(ImageDecoding_unpremul, reporter) { // This should never fail since we know the images we're decoding. SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream)); - REPORTER_ASSERT(reporter, NULL != decoder.get()); + REPORTER_ASSERT(reporter, decoder.get()); if (NULL == decoder.get()) { continue; } @@ -510,9 +510,9 @@ DEF_TEST(ImprovedBitmapFactory, reporter) { SkBitmap bm; SkAssertResult(bm.setInfo(SkImageInfo::MakeN32Premul(1, 1))); REPORTER_ASSERT(reporter, - NULL != install_pixel_ref(&bm, stream.detach(), 1, true)); + install_pixel_ref(&bm, stream.detach(), 1, true)); SkAutoLockPixels alp(bm); - REPORTER_ASSERT(reporter, NULL != bm.getPixels()); + REPORTER_ASSERT(reporter, bm.getPixels()); } } diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp index a8cd5d0cf9..ebe9c4dfef 100644 --- a/tests/ImageFilterTest.cpp +++ b/tests/ImageFilterTest.cpp @@ -152,7 +152,7 @@ DEF_TEST(ImageFilter, reporter) { // Check that a clipping color matrix followed by a grayscale does not concatenate into a single filter. SkAutoTUnref<SkImageFilter> doubleBrightness(make_scale(2.0f)); SkAutoTUnref<SkImageFilter> halfBrightness(make_scale(0.5f, doubleBrightness)); - REPORTER_ASSERT(reporter, NULL != halfBrightness->getInput(0)); + REPORTER_ASSERT(reporter, halfBrightness->getInput(0)); } { diff --git a/tests/KtxTest.cpp b/tests/KtxTest.cpp index 32dacd5a0f..1a61f3aa0b 100644 --- a/tests/KtxTest.cpp +++ b/tests/KtxTest.cpp @@ -31,7 +31,7 @@ DEF_TEST(KtxReadWrite, reporter) { bm8888.allocN32Pixels(128, 128); uint8_t *pixels = reinterpret_cast<uint8_t*>(bm8888.getPixels()); - REPORTER_ASSERT(reporter, NULL != pixels); + REPORTER_ASSERT(reporter, pixels); if (NULL == pixels) { return; @@ -53,10 +53,10 @@ DEF_TEST(KtxReadWrite, reporter) { REPORTER_ASSERT(reporter, !(bm8888.empty())); SkAutoDataUnref encodedData(SkImageEncoder::EncodeData(bm8888, SkImageEncoder::kKTX_Type, 0)); - REPORTER_ASSERT(reporter, NULL != encodedData); + REPORTER_ASSERT(reporter, encodedData); SkAutoTUnref<SkMemoryStream> stream(SkNEW_ARGS(SkMemoryStream, (encodedData))); - REPORTER_ASSERT(reporter, NULL != stream); + REPORTER_ASSERT(reporter, stream); SkBitmap decodedBitmap; bool imageDecodeSuccess = SkImageDecoder::DecodeStream(stream, &decodedBitmap); @@ -69,7 +69,7 @@ DEF_TEST(KtxReadWrite, reporter) { REPORTER_ASSERT(reporter, !(decodedBitmap.empty())); uint8_t *decodedPixels = reinterpret_cast<uint8_t*>(decodedBitmap.getPixels()); - REPORTER_ASSERT(reporter, NULL != decodedPixels); + REPORTER_ASSERT(reporter, decodedPixels); REPORTER_ASSERT(reporter, decodedBitmap.getSize() == bm8888.getSize()); if (NULL == decodedPixels) { @@ -109,7 +109,7 @@ DEF_TEST(KtxReadUnpremul, reporter) { SkAutoTUnref<SkMemoryStream> stream( SkNEW_ARGS(SkMemoryStream, (kHalfWhiteKTX, sizeof(kHalfWhiteKTX)))); - REPORTER_ASSERT(reporter, NULL != stream); + REPORTER_ASSERT(reporter, stream); SkBitmap decodedBitmap; bool imageDecodeSuccess = SkImageDecoder::DecodeStream(stream, &decodedBitmap); @@ -122,7 +122,7 @@ DEF_TEST(KtxReadUnpremul, reporter) { REPORTER_ASSERT(reporter, !(decodedBitmap.empty())); uint8_t *decodedPixels = reinterpret_cast<uint8_t*>(decodedBitmap.getPixels()); - REPORTER_ASSERT(reporter, NULL != decodedPixels); + REPORTER_ASSERT(reporter, decodedPixels); uint8_t *row = decodedPixels; for (int j = 0; j < decodedBitmap.height(); ++j) { @@ -145,7 +145,7 @@ DEF_TEST(KtxReexportPKM, reporter) { // Load PKM file into a bitmap SkBitmap etcBitmap; SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(pkmFilename.c_str())); - REPORTER_ASSERT(reporter, NULL != fileData); + REPORTER_ASSERT(reporter, fileData); if (NULL == fileData) { return; } @@ -159,7 +159,7 @@ DEF_TEST(KtxReexportPKM, reporter) { // Write the bitmap out to a KTX file. SkData *ktxDataPtr = SkImageEncoder::EncodeData(etcBitmap, SkImageEncoder::kKTX_Type, 0); SkAutoDataUnref newKtxData(ktxDataPtr); - REPORTER_ASSERT(reporter, NULL != ktxDataPtr); + REPORTER_ASSERT(reporter, ktxDataPtr); // See is this data is identical to data in existing ktx file. SkString ktxFilename = GetResourcePath("mandrill_128.ktx"); diff --git a/tests/LListTest.cpp b/tests/LListTest.cpp index 20151c33ec..8fb0117af8 100644 --- a/tests/LListTest.cpp +++ b/tests/LListTest.cpp @@ -73,12 +73,12 @@ static void TestTInternalLList(skiatest::Reporter* reporter) { Iter iter; ListElement* cur = iter.init(list, Iter::kHead_IterStart); - for (int i = 0; NULL != cur; ++i, cur = iter.next()) { + for (int i = 0; cur; ++i, cur = iter.next()) { REPORTER_ASSERT(reporter, cur->fID == 3-i); } cur = iter.init(list, Iter::kTail_IterStart); - for (int i = 0; NULL != cur; ++i, cur = iter.prev()) { + for (int i = 0; cur; ++i, cur = iter.prev()) { REPORTER_ASSERT(reporter, cur->fID == i); } @@ -114,7 +114,7 @@ static void TestTInternalLList(skiatest::Reporter* reporter) { check_list(list, reporter, false, 4, true, true, true, true, elements); cur = iter.init(list, Iter::kHead_IterStart); - for (int i = 0; NULL != cur; ++i, cur = iter.next()) { + for (int i = 0; cur; ++i, cur = iter.next()) { REPORTER_ASSERT(reporter, cur->fID == i); } } @@ -228,7 +228,7 @@ static void TestTLList(skiatest::Reporter* reporter) { next.next(); prev.prev(); - SkASSERT(NULL != iter.get()); + SkASSERT(iter.get()); // insert either before or after the iterator, then check that the // surrounding sequence is correct. if (2 == insertionMethod) { @@ -237,10 +237,10 @@ static void TestTLList(skiatest::Reporter* reporter) { newItem.prev(); REPORTER_ASSERT(reporter, newItem.get()->fID == id); - if (NULL != next.get()) { + if (next.get()) { REPORTER_ASSERT(reporter, next.prev()->fID == iter.get()->fID); } - if (NULL != prev.get()) { + if (prev.get()) { REPORTER_ASSERT(reporter, prev.next()->fID == id); } } else { @@ -249,10 +249,10 @@ static void TestTLList(skiatest::Reporter* reporter) { newItem.next(); REPORTER_ASSERT(reporter, newItem.get()->fID == id); - if (NULL != next.get()) { + if (next.get()) { REPORTER_ASSERT(reporter, next.prev()->fID == id); } - if (NULL != prev.get()) { + if (prev.get()) { REPORTER_ASSERT(reporter, prev.next()->fID == iter.get()->fID); } } @@ -276,10 +276,10 @@ static void TestTLList(skiatest::Reporter* reporter) { // find the element Iter iter(list1, start); while (n--) { - REPORTER_ASSERT(reporter, NULL != iter.get()); + REPORTER_ASSERT(reporter, iter.get()); (iter.*incrFunc)(); } - REPORTER_ASSERT(reporter, NULL != iter.get()); + REPORTER_ASSERT(reporter, iter.get()); // remember the prev and next elements from the element to be removed Iter prev = iter; diff --git a/tests/MallocPixelRefTest.cpp b/tests/MallocPixelRefTest.cpp index cf5e054220..c20c8836b2 100644 --- a/tests/MallocPixelRefTest.cpp +++ b/tests/MallocPixelRefTest.cpp @@ -64,7 +64,7 @@ DEF_TEST(MallocPixelRef, reporter) { SkAutoTUnref<SkMallocPixelRef> pr( SkMallocPixelRef::NewAllocate(info, rowBytes, NULL)); REPORTER_ASSERT(reporter, pr.get() != NULL); - REPORTER_ASSERT(reporter, NULL != pr->pixels()); + REPORTER_ASSERT(reporter, pr->pixels()); } { void* addr = static_cast<void*>(new uint8_t[size]); diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp index 57587c4a35..35fbf2fdc3 100644 --- a/tests/PathTest.cpp +++ b/tests/PathTest.cpp @@ -3377,7 +3377,7 @@ public: REPORTER_ASSERT(reporter, 2*kRepeatCnt == pathRef->countPoints()); REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countWeights()); REPORTER_ASSERT(reporter, SkPath::kConic_SegmentMask == pathRef->getSegmentMasks()); - REPORTER_ASSERT(reporter, NULL != weights); + REPORTER_ASSERT(reporter, weights); for (int i = 0; i < kRepeatCnt; ++i) { REPORTER_ASSERT(reporter, SkPath::kConic_Verb == pathRef->atVerb(i)); } diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp index eb85c94a69..b1cdf7e5d1 100644 --- a/tests/PictureTest.cpp +++ b/tests/PictureTest.cpp @@ -770,7 +770,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter, const char *reason = NULL; REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL, &reason)); - REPORTER_ASSERT(reporter, NULL != reason); + REPORTER_ASSERT(reporter, reason); canvas = GENERATE_CANVAS(recorder, useNewPath); { @@ -968,7 +968,7 @@ static void test_gpu_picture_optimization(skiatest::Reporter* reporter, SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); const SkPicture::AccelData* data = pict->EXPERIMENTAL_getAccelData(key); - REPORTER_ASSERT(reporter, NULL != data); + REPORTER_ASSERT(reporter, data); const GrAccelData *gpuData = static_cast<const GrAccelData*>(data); REPORTER_ASSERT(reporter, 8 == gpuData->numSaveLayers()); @@ -1023,7 +1023,7 @@ static void test_gpu_picture_optimization(skiatest::Reporter* reporter, kHeight == info3.fSize.fHeight); REPORTER_ASSERT(reporter, info3.fOriginXform.isIdentity()); REPORTER_ASSERT(reporter, 0 == info3.fOffset.fX && 0 == info3.fOffset.fY); - REPORTER_ASSERT(reporter, NULL != info3.fPaint); + REPORTER_ASSERT(reporter, info3.fPaint); REPORTER_ASSERT(reporter, !info3.fIsNested && !info3.fHasNestedLayers); REPORTER_ASSERT(reporter, info4.fValid); diff --git a/tests/RTreeTest.cpp b/tests/RTreeTest.cpp index 087f19a7ef..40af5fe55b 100644 --- a/tests/RTreeTest.cpp +++ b/tests/RTreeTest.cpp @@ -84,7 +84,7 @@ static void run_queries(skiatest::Reporter* reporter, SkRandom& rand, DataRect r static void rtree_test_main(SkRTree* rtree, skiatest::Reporter* reporter) { DataRect rects[NUM_RECTS]; SkRandom rand; - REPORTER_ASSERT(reporter, NULL != rtree); + REPORTER_ASSERT(reporter, rtree); int expectedDepthMin = -1; int expectedDepthMax = -1; diff --git a/tests/RecordTestUtils.h b/tests/RecordTestUtils.h index db3f02d3a2..0575b83cdd 100644 --- a/tests/RecordTestUtils.h +++ b/tests/RecordTestUtils.h @@ -24,7 +24,7 @@ static const T* assert_type(skiatest::Reporter* r, const SkRecord& record, unsig ReadAs<T> reader; record.visit<void>(index, reader); REPORTER_ASSERT(r, T::kType == reader.type); - REPORTER_ASSERT(r, NULL != reader.ptr); + REPORTER_ASSERT(r, SkToBool(reader.ptr)); return reader.ptr; } diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index c08e75f62c..a66b0360eb 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -74,7 +74,7 @@ public: ~TestResource() { --fAlive; - if (NULL != fToDelete) { + if (fToDelete) { // Breaks our little 2-element cycle below. fToDelete->setDeleteWhenDestroyed(NULL, NULL); fCache->deleteResource(fToDelete->getCacheEntry()); @@ -274,7 +274,7 @@ static void test_resource_size_changed(skiatest::Reporter* reporter, REPORTER_ASSERT(reporter, 300 == cache.getCachedResourceBytes()); REPORTER_ASSERT(reporter, 2 == cache.getCachedResourceCount()); - REPORTER_ASSERT(reporter, NULL != cache.find(key1)); + REPORTER_ASSERT(reporter, cache.find(key1)); // Internal resource cache validation will test the detached size (debug mode only). } } diff --git a/tests/SListTest.cpp b/tests/SListTest.cpp index 72a82814f9..78fcc65a27 100644 --- a/tests/SListTest.cpp +++ b/tests/SListTest.cpp @@ -27,7 +27,7 @@ static bool verifyEmptyList(skiatest::Reporter* reporter, ERRORF(reporter, "%s - List count is not zero, %d instead", stage, list.getCount()); return false; } - if (NULL != list.head()) { + if (list.head()) { ERRORF(reporter, "%s - List has elements when empty", stage); return false; } @@ -55,7 +55,7 @@ static bool verifyList(skiatest::Reporter* reporter, } next = next->next(); } - if (NULL != next) { + if (next) { ERRORF(reporter, "%s - List too long, should be %d", stage, count); return false; } diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp index b5582dccfc..23cc33dd4a 100644 --- a/tests/SerializationTest.cpp +++ b/tests/SerializationTest.cpp @@ -198,7 +198,7 @@ static T* TestFlattenableSerialization(T* testObj, bool shouldSucceed, // This should have succeeded, since there are enough bytes to read this REPORTER_ASSERT(reporter, buffer2.isValid()); REPORTER_ASSERT(reporter, static_cast<size_t>(peekAfter - peekBefore) == bytesWritten); - REPORTER_ASSERT(reporter, NULL != obj2); + REPORTER_ASSERT(reporter, obj2); } else { // If the deserialization was supposed to fail, make sure it did REPORTER_ASSERT(reporter, !buffer.isValid()); @@ -490,7 +490,7 @@ DEF_TEST(Serialization, reporter) { SkValidatingReadBuffer reader(static_cast<void*>(data.get()), size); SkAutoTUnref<SkPicture> readPict( SkPicture::CreateFromBuffer(reader)); - REPORTER_ASSERT(reporter, NULL != readPict.get()); + REPORTER_ASSERT(reporter, readPict.get()); } TestPictureTypefaceSerialization(reporter); diff --git a/tests/SkResourceCacheTest.cpp b/tests/SkResourceCacheTest.cpp index dbd327cd12..b660890e87 100644 --- a/tests/SkResourceCacheTest.cpp +++ b/tests/SkResourceCacheTest.cpp @@ -79,7 +79,7 @@ static SkBitmap createAllocatedBitmap(const SkImageInfo& info) { SkBitmap cachedBitmap; cachedBitmap.setInfo(info); SkBitmap::Allocator* allocator = SkBitmapCache::GetAllocator(); - if (NULL != allocator) { + if (allocator) { allocator->allocPixelRef(&cachedBitmap, 0); } else { cachedBitmap.allocPixels(); diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp index eca929e0cc..a175f64951 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -139,7 +139,7 @@ static void test_imagepeek(skiatest::Reporter* reporter) { continue; // gpu may not be enabled } const void* addr = image->peekPixels(&info, &rowBytes); - bool success = (NULL != addr); + bool success = SkToBool(addr); REPORTER_ASSERT(reporter, gRec[i].fPeekShouldSucceed == success); if (success) { REPORTER_ASSERT(reporter, 10 == info.width()); @@ -199,7 +199,7 @@ static void test_canvaspeek(skiatest::Reporter* reporter, surface->getCanvas()->clear(color); const void* addr = surface->getCanvas()->peekPixels(&info, &rowBytes); - bool success = (NULL != addr); + bool success = SkToBool(addr); REPORTER_ASSERT(reporter, gRec[i].fPeekShouldSucceed == success); SkImageInfo info2; @@ -389,7 +389,7 @@ static void TestGetTexture(skiatest::Reporter* reporter, SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); GrTexture* texture = image->getTexture(); if (surfaceType == kGpu_SurfaceType || surfaceType == kGpuScratch_SurfaceType) { - REPORTER_ASSERT(reporter, NULL != texture); + REPORTER_ASSERT(reporter, texture); REPORTER_ASSERT(reporter, 0 != texture->getTextureHandle()); } else { REPORTER_ASSERT(reporter, NULL == texture); @@ -444,14 +444,14 @@ DEF_GPUTEST(Surface, reporter, factory) { #if SK_SUPPORT_GPU TestGetTexture(reporter, kRaster_SurfaceType, NULL); - if (NULL != factory) { + if (factory) { for (int i= 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i; if (!GrContextFactory::IsRenderingGLContext(glCtxType)) { continue; } GrContext* context = factory->get(glCtxType); - if (NULL != context) { + if (context) { TestSurfaceInCache(reporter, kGpu_SurfaceType, context); TestSurfaceInCache(reporter, kGpuScratch_SurfaceType, context); Test_crbug263329(reporter, kGpu_SurfaceType, context); diff --git a/tests/TextBlobTest.cpp b/tests/TextBlobTest.cpp index 7495ef3166..70c9ddc861 100644 --- a/tests/TextBlobTest.cpp +++ b/tests/TextBlobTest.cpp @@ -175,9 +175,9 @@ private: } SkAutoTUnref<const SkTextBlob> blob(builder.build()); - REPORTER_ASSERT(reporter, (NULL != blob->fGlyphBuffer) == (glyphCount > 0)); - REPORTER_ASSERT(reporter, (NULL != blob->fPosBuffer) == (posCount > 0)); - REPORTER_ASSERT(reporter, (NULL != blob->fRuns.get()) == (inCount > 0)); + REPORTER_ASSERT(reporter, SkToBool(blob->fGlyphBuffer) == (glyphCount > 0)); + REPORTER_ASSERT(reporter, SkToBool(blob->fPosBuffer) == (posCount > 0)); + REPORTER_ASSERT(reporter, SkToBool(blob->fRuns.get()) == (inCount > 0)); SkTextBlob::RunIterator it(blob); for (unsigned i = 0; i < outCount; ++i) { diff --git a/tests/TextureCompressionTest.cpp b/tests/TextureCompressionTest.cpp index b93cabb4e0..7dd285d4f3 100644 --- a/tests/TextureCompressionTest.cpp +++ b/tests/TextureCompressionTest.cpp @@ -134,7 +134,7 @@ DEF_TEST(CompressCheckerboard, reporter) { SkAutoLockPixels alp(bitmap); uint8_t* pixels = reinterpret_cast<uint8_t*>(bitmap.getPixels()); - REPORTER_ASSERT(reporter, NULL != pixels); + REPORTER_ASSERT(reporter, pixels); if (NULL == pixels) { return; } @@ -153,7 +153,7 @@ DEF_TEST(CompressCheckerboard, reporter) { SkAutoMalloc decompMemory(kWidth*kHeight); uint8_t* decompBuffer = reinterpret_cast<uint8_t*>(decompMemory.get()); - REPORTER_ASSERT(reporter, NULL != decompBuffer); + REPORTER_ASSERT(reporter, decompBuffer); if (NULL == decompBuffer) { return; } @@ -168,7 +168,7 @@ DEF_TEST(CompressCheckerboard, reporter) { } SkAutoDataUnref data(SkTextureCompressor::CompressBitmapToFormat(bitmap, fmt)); - REPORTER_ASSERT(reporter, NULL != data); + REPORTER_ASSERT(reporter, data); if (NULL == data) { continue; } @@ -182,7 +182,7 @@ DEF_TEST(CompressCheckerboard, reporter) { SkAutoLockPixels alp(bitmap); uint8_t* pixels = reinterpret_cast<uint8_t*>(bitmap.getPixels()); - REPORTER_ASSERT(reporter, NULL != pixels); + REPORTER_ASSERT(reporter, pixels); if (NULL == pixels) { continue; } @@ -228,7 +228,7 @@ DEF_TEST(CompressLATC, reporter) { for (int lum = 0; lum < 256; ++lum) { bitmap.lockPixels(); uint8_t* pixels = reinterpret_cast<uint8_t*>(bitmap.getPixels()); - REPORTER_ASSERT(reporter, NULL != pixels); + REPORTER_ASSERT(reporter, pixels); if (NULL == pixels) { bitmap.unlockPixels(); continue; @@ -241,7 +241,7 @@ DEF_TEST(CompressLATC, reporter) { SkAutoDataUnref latcData( SkTextureCompressor::CompressBitmapToFormat(bitmap, kLATCFormat)); - REPORTER_ASSERT(reporter, NULL != latcData); + REPORTER_ASSERT(reporter, latcData); if (NULL == latcData) { continue; } |