#include <stddef.h>
#include <utility>
#include <vector>
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "ui/base/resource/resource_scale_factor.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_png_rep.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_rep.h"
#include "ui/gfx/image/image_unittest_util.h"
#if BUILDFLAG(IS_IOS)
#include "base/apple/foundation_util.h"
#include "skia/ext/skia_utils_ios.h"
#elif BUILDFLAG(IS_MAC)
#include <CoreGraphics/CoreGraphics.h>
#include "base/apple/foundation_util.h"
#include "base/apple/scoped_cftyperef.h"
#include "base/mac/mac_util.h"
#include "skia/ext/skia_utils_mac.h"
#endif
namespace {
#if BUILDFLAG(IS_APPLE)
constexpr bool kUsesSkiaNatively = false;
#else
constexpr bool kUsesSkiaNatively = …;
#endif
#if BUILDFLAG(IS_MAC)
bool IsSystemColorSpaceSRGB() {
base::apple::ScopedCFTypeRef<CGColorSpaceRef> color_space(
CGDisplayCopyColorSpace(CGMainDisplayID()));
base::apple::ScopedCFTypeRef<CFStringRef> name(
CGColorSpaceCopyName(color_space.get()));
return name &&
CFStringCompare(name.get(), kCGColorSpaceSRGB, 0) == kCFCompareEqualTo;
}
#endif
class ImageTest : public testing::Test { … };
gt;
TEST_F(ImageTest, EmptyImage) { … }
TEST_F(ImageTest, EmptyImageFromEmptyPlatformImage) { … }
TEST_F(ImageTest, EmptyImageFromObviouslyInvalidPNGImage) { … }
TEST_F(ImageTest, ImageSize) { … }
TEST_F(ImageTest, SkiaToSkia) { … }
TEST_F(ImageTest, EmptyImageToPNG) { … }
TEST_F(ImageTest, ImageNo1xToPNG) { … }
TEST_F(ImageTest, CreateExtractPNGBytes) { … }
TEST_F(ImageTest, MultiResolutionImageSkiaToPNG) { … }
TEST_F(ImageTest, MultiResolutionPNGToImageSkia) { … }
#if !BUILDFLAG(IS_IOS)
TEST_F(ImageTest, PreferDownscaleToUpscale) { … }
#endif
TEST_F(ImageTest, MultiResolutionPNGToPlatform) { … }
TEST_F(ImageTest, PlatformToPNGEncodeAndDecode) { … }
TEST_F(ImageTest, PNGEncodeFromSkiaDecodeToPlatform) { … }
TEST_F(ImageTest, PNGEncodeFromPlatformDecodeToSkia) { … }
TEST_F(ImageTest, PNGDecodeToSkiaFailure) { … }
TEST_F(ImageTest, PNGDecodeToPlatformFailure) { … }
TEST_F(ImageTest, SkiaToPlatform) { … }
TEST_F(ImageTest, PlatformToSkia) { … }
TEST_F(ImageTest, PlatformToPlatform) { … }
TEST_F(ImageTest, CheckSkiaColor) { … }
TEST_F(ImageTest, SkBitmapConversionPreservesOrientation) { … }
TEST_F(ImageTest, SkBitmapConversionPreservesTransparency) { … }
TEST_F(ImageTest, Copy) { … }
TEST_F(ImageTest, Assign) { … }
TEST_F(ImageTest, Move) { … }
TEST_F(ImageTest, MoveAssign) { … }
TEST_F(ImageTest, Copy_PreservesRepresentation) { … }
TEST_F(ImageTest, Copy_PreventsDuplication) { … }
TEST_F(ImageTest, Copy_PreservesBackingStore) { … }
TEST_F(ImageTest, MultiResolutionImageSkia) { … }
TEST_F(ImageTest, RemoveFromMultiResolutionImageSkia) { … }
TEST_F(ImageTest, OwnershipTest) { … }
}