Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1524)

Unified Diff: tests/TextureCompressionTest.cpp

Issue 444093002: - Add astcbitmap to gm slides (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Decode trits/quints into temp buffers Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698