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 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 namespace test { | 14 namespace test { |
15 | 15 |
16 #if defined(OS_MACOSX) | 16 #if defined(OS_MACOSX) |
17 typedef NSImage* PlatformImage; | 17 typedef NSImage* PlatformImage; |
18 #elif defined(TOOLKIT_GTK) | 18 #elif defined(TOOLKIT_GTK) |
19 typedef GdkPixbuf* PlatformImage; | 19 typedef GdkPixbuf* PlatformImage; |
20 #else | 20 #else |
21 typedef const SkBitmap PlatformImage; | 21 typedef const SkBitmap PlatformImage; |
22 #endif | 22 #endif |
23 | 23 |
24 #if defined(OS_MACOSX) | |
25 void SetSupportedScaleFactorsTo1xAnd2x(); | 24 void SetSupportedScaleFactorsTo1xAnd2x(); |
26 #endif | |
27 | 25 |
28 const SkBitmap CreateBitmap(int width, int height); | 26 const SkBitmap CreateBitmap(int width, int height); |
29 | 27 |
30 // TODO(rohitrao): Remove the no-argument version of CreateImage(). | 28 // TODO(rohitrao): Remove the no-argument version of CreateImage(). |
31 gfx::Image CreateImage(); | 29 gfx::Image CreateImage(); |
32 gfx::Image CreateImage(int width, int height); | 30 gfx::Image CreateImage(int width, int height); |
33 | 31 |
34 bool IsEqual(const gfx::Image& image1, const gfx::Image& image2); | 32 bool IsEqual(const gfx::Image& image1, const gfx::Image& image2); |
35 | 33 |
36 bool IsEmpty(const gfx::Image& image); | 34 bool IsEmpty(const gfx::Image& image); |
37 | 35 |
38 PlatformImage CreatePlatformImage(); | 36 PlatformImage CreatePlatformImage(); |
39 | 37 |
40 gfx::Image::RepresentationType GetPlatformRepresentationType(); | 38 gfx::Image::RepresentationType GetPlatformRepresentationType(); |
41 | 39 |
42 PlatformImage ToPlatformType(const gfx::Image& image); | 40 PlatformImage ToPlatformType(const gfx::Image& image); |
43 | 41 |
44 bool IsPlatformImageValid(PlatformImage image); | 42 bool IsPlatformImageValid(PlatformImage image); |
45 | 43 |
46 bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2); | 44 bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2); |
47 | 45 |
48 } // namespace test | 46 } // namespace test |
49 } // namespace gfx | 47 } // namespace gfx |
50 | 48 |
51 #endif // UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_ | 49 #endif // UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_ |
OLD | NEW |