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

Unified Diff: skia/public/interfaces/test/struct_traits_unittest.cc

Issue 2044313002: Add basic SkBitmap StructTraitsTest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 4 years, 6 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 | « no previous file | skia/public/interfaces/test/traits_test_service.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/public/interfaces/test/struct_traits_unittest.cc
diff --git a/skia/public/interfaces/test/struct_traits_unittest.cc b/skia/public/interfaces/test/struct_traits_unittest.cc
index db45ba86357b62161c2bba6b4615de6fb8eadeb4..976e2f09bc8e2a1e837d64c7a64d80a2e4534615 100644
--- a/skia/public/interfaces/test/struct_traits_unittest.cc
+++ b/skia/public/interfaces/test/struct_traits_unittest.cc
@@ -9,6 +9,7 @@
#include "third_party/skia/include/core/SkColorFilter.h"
#include "third_party/skia/include/core/SkString.h"
#include "third_party/skia/include/effects/SkColorFilterImageFilter.h"
+#include "ui/gfx/skia_util.h"
namespace skia {
@@ -25,6 +26,10 @@ class StructTraitsTest : public testing::Test, public mojom::TraitsTestService {
private:
// TraitsTestService:
+ void EchoBitmap(const SkBitmap& b,
+ const EchoBitmapCallback& callback) override {
+ callback.Run(b);
+ }
void EchoImageFilter(const sk_sp<SkImageFilter>& i,
const EchoImageFilterCallback& callback) override {
callback.Run(i);
@@ -48,6 +53,22 @@ static sk_sp<SkImageFilter> make_scale(float amount,
} // namespace
+TEST_F(StructTraitsTest, Bitmap) {
+ SkBitmap input;
+ input.allocN32Pixels(10, 5);
+ input.eraseColor(SK_ColorYELLOW);
+ input.erase(SK_ColorTRANSPARENT, SkIRect::MakeXYWH(0, 1, 2, 3));
+ mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
+ SkBitmap output;
+ proxy->EchoBitmap(input, &output);
+ EXPECT_EQ(input.colorType(), output.colorType());
+ EXPECT_EQ(input.alphaType(), output.alphaType());
+ EXPECT_EQ(input.profileType(), output.profileType());
+ EXPECT_EQ(input.width(), output.width());
+ EXPECT_EQ(input.height(), output.height());
+ EXPECT_TRUE(gfx::BitmapsAreEqual(input, output));
+}
+
TEST_F(StructTraitsTest, ImageFilter) {
sk_sp<SkImageFilter> input(make_scale(0.5f, nullptr));
SkString input_str;
« no previous file with comments | « no previous file | skia/public/interfaces/test/traits_test_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698