chromium/ui/gfx/skbitmap_operations_unittest.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/354829279): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "ui/gfx/skbitmap_operations.h"

#include <stdint.h>

#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColorPriv.h"
#include "third_party/skia/include/core/SkRect.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "third_party/skia/include/core/SkUnPreMultiply.h"

namespace {

// Returns true if each channel of the given two colors are "close." This is
// used for comparing colors where rounding errors may cause off-by-one.
inline bool ColorsClose(uint32_t a, uint32_t b) {}

inline bool MultipliedColorsClose(uint32_t a, uint32_t b) {}

bool BitmapsClose(const SkBitmap& a, const SkBitmap& b) {}

void FillDataToBitmap(int w, int h, SkBitmap* bmp) {}

// The reference (i.e., old) implementation of |CreateHSLShiftedBitmap()|.
SkBitmap ReferenceCreateHSLShiftedBitmap(
    const SkBitmap& bitmap,
    color_utils::HSL hsl_shift) {}

}  // namespace

// Invert bitmap and verify the each pixel is inverted and the alpha value is
// not changed.
TEST(SkBitmapOperationsTest, CreateInvertedBitmap) {}

// Blend two bitmaps together at 50% alpha and verify that the result
// is the middle-blend of the two.
TEST(SkBitmapOperationsTest, CreateBlendedBitmap) {}

// Test our masking functions.
TEST(SkBitmapOperationsTest, CreateMaskedBitmap) {}

// Make sure that when shifting a bitmap without any shift parameters,
// the end result is close enough to the original (rounding errors
// notwithstanding).
TEST(SkBitmapOperationsTest, CreateHSLShiftedBitmapToSame) {}

// Shift a blue bitmap to red.
TEST(SkBitmapOperationsTest, CreateHSLShiftedBitmapHueOnly) {}

// Validate HSL shift.
TEST(SkBitmapOperationsTest, ValidateHSLShift) {}

// Test our cropping.
TEST(SkBitmapOperationsTest, CreateCroppedBitmap) {}

// Test whether our cropping correctly wraps across image boundaries.
TEST(SkBitmapOperationsTest, CreateCroppedBitmapWrapping) {}

TEST(SkBitmapOperationsTest, DownsampleByTwo) {}

// Test edge cases for DownsampleByTwo.
TEST(SkBitmapOperationsTest, DownsampleByTwoSmall) {}

// Here we assume DownsampleByTwo works correctly (it's tested above) and
// just make sure that the wrapper function does the right thing.
TEST(SkBitmapOperationsTest, DownsampleByTwoUntilSize) {}

TEST(SkBitmapOperationsTest, UnPreMultiply) {}

TEST(SkBitmapOperationsTest, UnPreMultiplyOpaque) {}

TEST(SkBitmapOperationsTest, UnPreMultiplyAlreadyUnPreMultiplied) {}

TEST(SkBitmapOperationsTest, CreateTransposedBitmap) {}

void DrawRectWithColor(SkCanvas* canvas,
                       int left,
                       int top,
                       int right,
                       int bottom,
                       SkColor color) {}

// Check that Rotate provides the desired results
TEST(SkBitmapOperationsTest, RotateImage) {}