| Index: tests/TextureCompressionTest.cpp
|
| diff --git a/tests/TextureCompressionTest.cpp b/tests/TextureCompressionTest.cpp
|
| index 8694389fe7ad0e4b1ea7dfd199630076cb223c36..da7a87bd41d36530e5b48283f2cd675a59f45e33 100644
|
| --- a/tests/TextureCompressionTest.cpp
|
| +++ b/tests/TextureCompressionTest.cpp
|
| @@ -12,6 +12,32 @@
|
| #include "SkTextureCompressor.h"
|
| #include "Test.h"
|
|
|
| +// TODO: Create separate tests for RGB and RGBA data once
|
| +// ASTC and ETC1 decompression is implemented.
|
| +
|
| +static bool decompresses_a8(SkTextureCompressor::Format fmt) {
|
| + switch (fmt) {
|
| + case SkTextureCompressor::kLATC_Format:
|
| + case SkTextureCompressor::kR11_EAC_Format:
|
| + return true;
|
| +
|
| + default:
|
| + return false;
|
| + }
|
| +}
|
| +
|
| +static bool compresses_a8(SkTextureCompressor::Format fmt) {
|
| + switch (fmt) {
|
| + case SkTextureCompressor::kLATC_Format:
|
| + case SkTextureCompressor::kR11_EAC_Format:
|
| + case SkTextureCompressor::kASTC_12x12_Format:
|
| + return true;
|
| +
|
| + default:
|
| + return false;
|
| + }
|
| +}
|
| +
|
| /**
|
| * Make sure that we properly fail when we don't have multiple of four image dimensions.
|
| */
|
| @@ -38,6 +64,9 @@ DEF_TEST(CompressAlphaFailDimensions, reporter) {
|
|
|
| for (int i = 0; i < SkTextureCompressor::kFormatCnt; ++i) {
|
| const SkTextureCompressor::Format fmt = static_cast<SkTextureCompressor::Format>(i);
|
| + if (!compresses_a8(fmt)) {
|
| + continue;
|
| + }
|
| SkAutoDataUnref data(SkTextureCompressor::CompressBitmapToFormat(bitmap, fmt));
|
| REPORTER_ASSERT(reporter, NULL == data);
|
| }
|
| @@ -69,6 +98,9 @@ DEF_TEST(CompressAlphaFailColorType, reporter) {
|
|
|
| for (int i = 0; i < SkTextureCompressor::kFormatCnt; ++i) {
|
| const SkTextureCompressor::Format fmt = static_cast<SkTextureCompressor::Format>(i);
|
| + if (!compresses_a8(fmt)) {
|
| + continue;
|
| + }
|
| SkAutoDataUnref data(SkTextureCompressor::CompressBitmapToFormat(bitmap, fmt));
|
| REPORTER_ASSERT(reporter, NULL == data);
|
| }
|
| @@ -134,10 +166,7 @@ DEF_TEST(CompressCheckerboard, reporter) {
|
|
|
| // Ignore formats for RGBA data, since the decompressed buffer
|
| // won't match the size and contents of the original.
|
| - // TODO: Create separate tests for RGB and RGBA data once
|
| - // ASTC and ETC1 decompression is implemented.
|
| - if (SkTextureCompressor::kASTC_12x12_Format == fmt ||
|
| - SkTextureCompressor::kETC1_Format == fmt) {
|
| + if (!decompresses_a8(fmt) || !compresses_a8(fmt)) {
|
| continue;
|
| }
|
|
|
|
|