Lines Matching refs:reporter
27 static void assert_equal(skiatest::Reporter* reporter, SkImage* a, const SkIRect* subsetA, in assert_equal() argument
32 REPORTER_ASSERT(reporter, widthA == b->width()); in assert_equal()
33 REPORTER_ASSERT(reporter, heightA == b->height()); in assert_equal()
38 REPORTER_ASSERT(reporter, AO == BO); in assert_equal()
50 REPORTER_ASSERT(reporter, a->readPixels(pmapA, srcX, srcY)); in assert_equal()
51 REPORTER_ASSERT(reporter, b->readPixels(pmapB, 0, 0)); in assert_equal()
55 REPORTER_ASSERT(reporter, !memcmp(pmapA.addr32(0, y), pmapB.addr32(0, y), widthBytes)); in assert_equal()
134 static void test_encode(skiatest::Reporter* reporter, SkImage* image) { in test_encode() argument
137 REPORTER_ASSERT(reporter, origEncoded); in test_encode()
138 REPORTER_ASSERT(reporter, origEncoded->size() > 0); in test_encode()
141 REPORTER_ASSERT(reporter, decoded); in test_encode()
142 assert_equal(reporter, image, nullptr, decoded); in test_encode()
147 REPORTER_ASSERT(reporter, decoded); in test_encode()
148 assert_equal(reporter, image, &ir, decoded); in test_encode()
151 DEF_TEST(ImageEncode, reporter) { in DEF_TEST() argument
153 test_encode(reporter, image); in DEF_TEST()
157 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageEncode_Gpu, reporter, context) { in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() argument
159 test_encode(reporter, image); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
193 DEF_TEST(Image_Encode_Serializer, reporter) { in DEF_TEST() argument
199 REPORTER_ASSERT(reporter, serializer.didEncode()); in DEF_TEST()
200 REPORTER_ASSERT(reporter, encoded); in DEF_TEST()
201 REPORTER_ASSERT(reporter, encoded->size() > 0); in DEF_TEST()
202 REPORTER_ASSERT(reporter, encoded->equals(reference)); in DEF_TEST()
206 DEF_TEST(Image_Serialize_Encoding_Failure, reporter) { in DEF_TEST() argument
210 REPORTER_ASSERT(reporter, image); in DEF_TEST()
216 REPORTER_ASSERT(reporter, picture); in DEF_TEST()
217 REPORTER_ASSERT(reporter, picture->approximateOpCount() > 0); in DEF_TEST()
225 REPORTER_ASSERT(reporter, !serializers[i]->didEncode()); in DEF_TEST()
227 REPORTER_ASSERT(reporter, serializers[i]->didEncode()); in DEF_TEST()
231 REPORTER_ASSERT(reporter, deserialized); in DEF_TEST()
232 REPORTER_ASSERT(reporter, deserialized->approximateOpCount() > 0); in DEF_TEST()
236 DEF_TEST(Image_NewRasterCopy, reporter) { in DEF_TEST() argument
257 REPORTER_ASSERT(reporter, red == pixels[0]); in DEF_TEST()
258 REPORTER_ASSERT(reporter, green == pixels[1]); in DEF_TEST()
259 REPORTER_ASSERT(reporter, blue == pixels[2]); in DEF_TEST()
260 REPORTER_ASSERT(reporter, 0 == pixels[3]); in DEF_TEST()
266 DEF_TEST(Image_RetainSnapshot, reporter) { in DEF_TEST() argument
279 REPORTER_ASSERT(reporter, image1->readPixels(dstInfo, pixels, dstRowBytes, 0, 0)); in DEF_TEST()
281 REPORTER_ASSERT(reporter, pixels[i] == green); in DEF_TEST()
291 REPORTER_ASSERT(reporter, image2->readPixels(dstInfo, pixels, dstRowBytes, 0, 0)); in DEF_TEST()
292 REPORTER_ASSERT(reporter, pixels[0] == green); in DEF_TEST()
293 REPORTER_ASSERT(reporter, pixels[1] == green); in DEF_TEST()
294 REPORTER_ASSERT(reporter, pixels[2] == green); in DEF_TEST()
295 REPORTER_ASSERT(reporter, pixels[3] == red); in DEF_TEST()
309 DEF_TEST(image_newfrombitmap, reporter) { in DEF_TEST() argument
328 REPORTER_ASSERT(reporter, sharedID == rec[i].fExpectSharedID); in DEF_TEST()
331 REPORTER_ASSERT(reporter, peekSuccess == rec[i].fExpectPeekSuccess); in DEF_TEST()
334 REPORTER_ASSERT(reporter, lazy == rec[i].fExpectLazy); in DEF_TEST()
351 DEF_GPUTEST_FOR_NATIVE_CONTEXT(SkImage_Gpu2Cpu, reporter, context) { in DEF_GPUTEST_FOR_NATIVE_CONTEXT() argument
362 REPORTER_ASSERT(reporter, !SkBitmapCache::Find(uniqueID, &cachedBitmap)); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
369 REPORTER_ASSERT(reporter, cachedBitmap.getGenerationID() == uniqueID); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
370 REPORTER_ASSERT(reporter, cachedBitmap.isImmutable()); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
371 REPORTER_ASSERT(reporter, cachedBitmap.getPixels()); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
382 REPORTER_ASSERT(reporter, !SkBitmapCache::Find(uniqueID, &cachedBitmap)); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
386 DEF_GPUTEST_FOR_NATIVE_CONTEXT(SkImage_newTextureImage, reporter, context, glContext) { in DEF_GPUTEST_FOR_NATIVE_CONTEXT() argument
412 ERRORF(reporter, "Error creating image."); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
421 ERRORF(reporter, "newTextureImage failed."); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
427 ERRORF(reporter, "newTextureImage returned non-texture image."); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
432 ERRORF(reporter, "newTextureImage made unnecessary texture copy."); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
436 ERRORF(reporter, "newTextureImage changed the image size."); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
439 ERRORF(reporter, "newTextureImage changed image opaqueness."); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
465 DEF_TEST(ImageEmpty, reporter) { in DEF_TEST() argument
467 REPORTER_ASSERT(reporter, nullptr == SkImage::NewRasterCopy(info, nullptr, 0)); in DEF_TEST()
468 REPORTER_ASSERT(reporter, nullptr == SkImage::NewRasterData(info, nullptr, 0)); in DEF_TEST()
469 … REPORTER_ASSERT(reporter, nullptr == SkImage::NewFromRaster(info, nullptr, 0, nullptr, nullptr)); in DEF_TEST()
470 REPORTER_ASSERT(reporter, nullptr == SkImage::NewFromGenerator(new EmptyGenerator)); in DEF_TEST()
473 DEF_TEST(ImageDataRef, reporter) { in DEF_TEST() argument
478 REPORTER_ASSERT(reporter, data->unique()); in DEF_TEST()
480 REPORTER_ASSERT(reporter, !data->unique()); in DEF_TEST()
482 REPORTER_ASSERT(reporter, data->unique()); in DEF_TEST()
495 static void test_read_pixels(skiatest::Reporter* reporter, SkImage* image) { in test_read_pixels() argument
506 REPORTER_ASSERT(reporter, !image->readPixels(info, pixels, rowBytes, 0, 0)); in test_read_pixels()
510 REPORTER_ASSERT(reporter, !image->readPixels(info, pixels, rowBytes, -w, 0)); in test_read_pixels()
511 REPORTER_ASSERT(reporter, !image->readPixels(info, pixels, rowBytes, 0, -h)); in test_read_pixels()
512 REPORTER_ASSERT(reporter, !image->readPixels(info, pixels, rowBytes, image->width(), 0)); in test_read_pixels()
513 REPORTER_ASSERT(reporter, !image->readPixels(info, pixels, rowBytes, 0, image->height())); in test_read_pixels()
517 REPORTER_ASSERT(reporter, image->readPixels(info, pixels, rowBytes, 0, 0)); in test_read_pixels()
518 REPORTER_ASSERT(reporter, has_pixels(pixels, w*h, expected)); in test_read_pixels()
522 REPORTER_ASSERT(reporter, image->readPixels(info, pixels, rowBytes, in test_read_pixels()
524 REPORTER_ASSERT(reporter, has_pixels(pixels, w*h, expected)); in test_read_pixels()
528 REPORTER_ASSERT(reporter, image->readPixels(info, pixels, rowBytes, -1, -1)); in test_read_pixels()
529 REPORTER_ASSERT(reporter, pixels[3] == expected); in test_read_pixels()
530 REPORTER_ASSERT(reporter, has_pixels(pixels, w*h - 1, notExpected)); in test_read_pixels()
534 REPORTER_ASSERT(reporter, image->readPixels(info, pixels, rowBytes, in test_read_pixels()
536 REPORTER_ASSERT(reporter, pixels[0] == expected); in test_read_pixels()
537 REPORTER_ASSERT(reporter, has_pixels(&pixels[1], w*h - 1, notExpected)); in test_read_pixels()
539 DEF_TEST(ImageReadPixels, reporter) { in DEF_TEST() argument
541 test_read_pixels(reporter, image); in DEF_TEST()
544 test_read_pixels(reporter, image); in DEF_TEST()
548 test_read_pixels(reporter, image); in DEF_TEST()
550 REPORTER_ASSERT(reporter, 1 == dataHolder.fReleaseCount); in DEF_TEST()
553 test_read_pixels(reporter, image); in DEF_TEST()
556 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageReadPixels_Gpu, reporter, context) { in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() argument
558 test_read_pixels(reporter, image); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
562 static void check_legacy_bitmap(skiatest::Reporter* reporter, const SkImage* image, in check_legacy_bitmap() argument
564 REPORTER_ASSERT(reporter, image->width() == bitmap.width()); in check_legacy_bitmap()
565 REPORTER_ASSERT(reporter, image->height() == bitmap.height()); in check_legacy_bitmap()
566 REPORTER_ASSERT(reporter, image->isOpaque() == bitmap.isOpaque()); in check_legacy_bitmap()
569 REPORTER_ASSERT(reporter, bitmap.isImmutable()); in check_legacy_bitmap()
573 REPORTER_ASSERT(reporter, bitmap.getPixels()); in check_legacy_bitmap()
577 REPORTER_ASSERT(reporter, image->readPixels(info, &imageColor, sizeof(SkPMColor), 0, 0)); in check_legacy_bitmap()
578 REPORTER_ASSERT(reporter, imageColor == *bitmap.getAddr32(0, 0)); in check_legacy_bitmap()
581 static void test_legacy_bitmap(skiatest::Reporter* reporter, const SkImage* image, SkImage::LegacyB… in test_legacy_bitmap() argument
583 REPORTER_ASSERT(reporter, image->asLegacyBitmap(&bitmap, mode)); in test_legacy_bitmap()
584 check_legacy_bitmap(reporter, image, bitmap, mode); in test_legacy_bitmap()
588 REPORTER_ASSERT(reporter, bitmap.extractSubset(&tmp, SkIRect::MakeWH(image->width() / 2, in test_legacy_bitmap()
591 REPORTER_ASSERT(reporter, subsetImage); in test_legacy_bitmap()
594 REPORTER_ASSERT(reporter, subsetImage->asLegacyBitmap(&subsetBitmap, mode)); in test_legacy_bitmap()
595 check_legacy_bitmap(reporter, subsetImage, subsetBitmap, mode); in test_legacy_bitmap()
597 DEF_TEST(ImageLegacyBitmap, reporter) { in DEF_TEST() argument
604 test_legacy_bitmap(reporter, image, mode); in DEF_TEST()
607 test_legacy_bitmap(reporter, image, mode); in DEF_TEST()
611 test_legacy_bitmap(reporter, image, mode); in DEF_TEST()
613 REPORTER_ASSERT(reporter, 1 == dataHolder.fReleaseCount); in DEF_TEST()
616 test_legacy_bitmap(reporter, image, mode); in DEF_TEST()
620 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageLegacyBitmap_Gpu, reporter, context) { in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() argument
627 test_legacy_bitmap(reporter, image, mode); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
632 static void test_peek(skiatest::Reporter* reporter, SkImage* image, bool expectPeekSuccess) { in test_peek() argument
637 REPORTER_ASSERT(reporter, expectPeekSuccess == success); in test_peek()
639 REPORTER_ASSERT(reporter, 20 == info.width()); in test_peek()
640 REPORTER_ASSERT(reporter, 20 == info.height()); in test_peek()
641 REPORTER_ASSERT(reporter, kN32_SkColorType == info.colorType()); in test_peek()
642 REPORTER_ASSERT(reporter, kPremul_SkAlphaType == info.alphaType() || in test_peek()
644 REPORTER_ASSERT(reporter, info.minRowBytes() <= rowBytes); in test_peek()
645 REPORTER_ASSERT(reporter, SkPreMultiplyColor(SK_ColorWHITE) == *(const SkPMColor*)addr); in test_peek()
648 DEF_TEST(ImagePeek, reporter) { in DEF_TEST() argument
650 test_peek(reporter, image, true); in DEF_TEST()
653 test_peek(reporter, image, true); in DEF_TEST()
657 test_peek(reporter, image, true); in DEF_TEST()
659 REPORTER_ASSERT(reporter, 1 == dataHolder.fReleaseCount); in DEF_TEST()
662 test_peek(reporter, image, false); in DEF_TEST()
665 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImagePeek_Gpu, reporter, context) { in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() argument
667 test_peek(reporter, image, false); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
679 static void check_image_color(skiatest::Reporter* reporter, SkImage* image, SkPMColor expected) { in check_image_color() argument
682 REPORTER_ASSERT(reporter, image->readPixels(info, &pixel, sizeof(pixel), 0, 0)); in check_image_color()
683 REPORTER_ASSERT(reporter, pixel == expected); in check_image_color()
685 DEF_GPUTEST_FOR_NATIVE_CONTEXT(SkImage_NewFromTexture, reporter, context) { in DEF_GPUTEST_FOR_NATIVE_CONTEXT() argument
701 REPORTER_ASSERT(reporter, false); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
719 check_image_color(reporter, refImg, expected0); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
720 check_image_color(reporter, cpyImg, expected0); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
731 check_image_color(reporter, refImg, expected1); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
733 check_image_color(reporter, cpyImg, expected0); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
736 REPORTER_ASSERT(reporter, 0 == releaseChecker.fReleaseCount); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
738 REPORTER_ASSERT(reporter, 1 == releaseChecker.fReleaseCount); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()