OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Because the unit tests for gfx::Image are spread across multiple | 5 // Because the unit tests for gfx::Image are spread across multiple |
6 // implementation files, this header contains the reusable components. | 6 // implementation files, this header contains the reusable components. |
7 | 7 |
8 #ifndef UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_ | 8 #ifndef UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_ |
9 #define UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_ | 9 #define UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_ |
10 | 10 |
11 #include "ui/gfx/image/image.h" | 11 #include "ui/gfx/image/image.h" |
12 #include "third_party/skia/include/core/SkColor.h" | 12 #include "third_party/skia/include/core/SkColor.h" |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 namespace test { | 15 namespace test { |
16 | 16 |
17 #if defined(OS_MACOSX) | 17 #if defined(OS_MACOSX) |
18 typedef NSImage* PlatformImage; | 18 typedef NSImage* PlatformImage; |
19 #elif defined(TOOLKIT_GTK) | 19 #elif defined(TOOLKIT_GTK) |
20 typedef GdkPixbuf* PlatformImage; | 20 typedef GdkPixbuf* PlatformImage; |
21 #else | 21 #else |
22 typedef const SkBitmap PlatformImage; | 22 typedef const SkBitmap PlatformImage; |
23 #endif | 23 #endif |
24 | 24 |
25 #if defined(OS_MACOSX) | |
26 void SetSupportedScaleFactorsTo1xAnd2x(); | 25 void SetSupportedScaleFactorsTo1xAnd2x(); |
27 #endif | |
28 | 26 |
29 const SkBitmap CreateBitmap(int width, int height); | 27 const SkBitmap CreateBitmap(int width, int height); |
30 | 28 |
31 // TODO(rohitrao): Remove the no-argument version of CreateImage(). | 29 // TODO(rohitrao): Remove the no-argument version of CreateImage(). |
32 gfx::Image CreateImage(); | 30 gfx::Image CreateImage(); |
33 gfx::Image CreateImage(int width, int height); | 31 gfx::Image CreateImage(int width, int height); |
34 | 32 |
35 bool IsEqual(const gfx::Image& image1, const gfx::Image& image2); | 33 bool IsEqual(const gfx::Image& image1, const gfx::Image& image2); |
36 | 34 |
37 bool IsEmpty(const gfx::Image& image); | 35 bool IsEmpty(const gfx::Image& image); |
38 | 36 |
39 PlatformImage CreatePlatformImage(); | 37 PlatformImage CreatePlatformImage(); |
40 | 38 |
41 gfx::Image::RepresentationType GetPlatformRepresentationType(); | 39 gfx::Image::RepresentationType GetPlatformRepresentationType(); |
42 | 40 |
43 PlatformImage ToPlatformType(const gfx::Image& image); | 41 PlatformImage ToPlatformType(const gfx::Image& image); |
44 PlatformImage CopyPlatformType(const gfx::Image& image); | 42 PlatformImage CopyPlatformType(const gfx::Image& image); |
45 | 43 |
46 SkColor GetPlatformImageColor(PlatformImage image); | 44 SkColor GetPlatformImageColor(PlatformImage image); |
47 void CheckColor(SkColor color, bool is_red); | 45 void CheckColor(SkColor color, bool is_red); |
48 | 46 |
49 bool IsPlatformImageValid(PlatformImage image); | 47 bool IsPlatformImageValid(PlatformImage image); |
50 | 48 |
51 bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2); | 49 bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2); |
52 | 50 |
53 } // namespace test | 51 } // namespace test |
54 } // namespace gfx | 52 } // namespace gfx |
55 | 53 |
56 #endif // UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_ | 54 #endif // UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_ |
OLD | NEW |