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

Unified Diff: tests/ImageInfoTest.cpp

Issue 525113005: Revert of Add gamma/sRGB tag to SkImageInfo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« no previous file with comments | « src/core/SkImageInfo.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageInfoTest.cpp
diff --git a/tests/ImageInfoTest.cpp b/tests/ImageInfoTest.cpp
deleted file mode 100644
index 679b302ceb258bea5efc85c2a7ee4f255f099089..0000000000000000000000000000000000000000
--- a/tests/ImageInfoTest.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkImageInfo.h"
-
-#include "Test.h"
-
-struct ImageInfoRec {
- int fWidth;
- int fHeight;
- SkColorType fColorType;
- SkAlphaType fAlphaType;
- float fGamma;
- bool fIsSRGB;
-};
-
-static void check_info(skiatest::Reporter* reporter,
- const ImageInfoRec& expected, const SkImageInfo& info) {
- REPORTER_ASSERT(reporter, info.width() == expected.fWidth);
- REPORTER_ASSERT(reporter, info.height() == expected.fHeight);
- REPORTER_ASSERT(reporter, info.colorType() == expected.fColorType);
- REPORTER_ASSERT(reporter, info.alphaType() == expected.fAlphaType);
- REPORTER_ASSERT(reporter, info.gamma() == expected.fGamma);
- REPORTER_ASSERT(reporter, info.isSRGB() == expected.fIsSRGB);
-}
-
-DEF_TEST(ImageInfo, reporter) {
- const float nan = SK_ScalarNaN;
- const float nice_gamma = 1.5f;
- const int W = 100;
- const int H = 200;
- SkImageInfo info;
-
- const ImageInfoRec rec[] = {
- { 0, 0, kUnknown_SkColorType, kIgnore_SkAlphaType, 0, false }, // MakeUnknown()
- { W, H, kUnknown_SkColorType, kIgnore_SkAlphaType, 0, false }, // MakeUnknown(...)
- { W, H, kN32_SkColorType, kPremul_SkAlphaType, 1, false }, // MakeN32Premul(...)
- { W, H, kN32_SkColorType, kOpaque_SkAlphaType, 1, false }, // MakeN32(...)
- { W, H, kAlpha_8_SkColorType, kPremul_SkAlphaType, 0, false }, // MakeA8()
- { W, H, kRGBA_8888_SkColorType, kUnpremul_SkAlphaType, 1, false }, // Make()
- { W, H, kBGRA_8888_SkColorType, kPremul_SkAlphaType, 1, false }, // Make()
- { W, H, kBGRA_8888_SkColorType, kPremul_SkAlphaType, 0, true }, // MakeSRGB()
- { W, H, kN32_SkColorType, kPremul_SkAlphaType, 1, false }, // MakeWithGamma() NaN
- { W, H, kAlpha_8_SkColorType, kPremul_SkAlphaType, 0, false }, // MakeWithGamma() bad ct for gamma
- { W, H, kN32_SkColorType, kPremul_SkAlphaType, nice_gamma, false }, // MakeWithGamma() good
- };
-
- check_info(reporter, rec[ 0], SkImageInfo::MakeUnknown());
- check_info(reporter, rec[ 1], SkImageInfo::MakeUnknown(W, H));
- check_info(reporter, rec[ 2], SkImageInfo::MakeN32Premul(W, H));
- check_info(reporter, rec[ 3], SkImageInfo::MakeN32(W, H, rec[3].fAlphaType));
- check_info(reporter, rec[ 4], SkImageInfo::MakeA8(W, H));
- check_info(reporter, rec[ 5], SkImageInfo::Make(W, H, rec[5].fColorType, rec[5].fAlphaType));
- check_info(reporter, rec[ 6], SkImageInfo::Make(W, H, rec[6].fColorType, rec[6].fAlphaType));
- check_info(reporter, rec[ 7], SkImageInfo::MakeSRGB(W, H, rec[7].fColorType, rec[7].fAlphaType));
- check_info(reporter, rec[ 8], SkImageInfo::MakeWithGamma(W, H, rec[8].fColorType, rec[8].fAlphaType, nan));
- check_info(reporter, rec[ 9], SkImageInfo::MakeWithGamma(W, H, rec[9].fColorType, rec[9].fAlphaType, nice_gamma));
- check_info(reporter, rec[10], SkImageInfo::MakeWithGamma(W, H, rec[10].fColorType, rec[10].fAlphaType, rec[10].fGamma));
-}
-
« no previous file with comments | « src/core/SkImageInfo.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698