| 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 #include "skia/ext/skia_utils_ios.h" | 5 #include "skia/ext/skia_utils_ios.h" |
| 6 | 6 |
| 7 #import <ImageIO/ImageIO.h> | 7 #import <ImageIO/ImageIO.h> |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 | 742 |
| 743 TEST_F(SkiaUtilsIosTest, Image88x88OrLarger) { | 743 TEST_F(SkiaUtilsIosTest, Image88x88OrLarger) { |
| 744 std::vector<SkBitmap> bitmaps( | 744 std::vector<SkBitmap> bitmaps( |
| 745 gfx::ImageDataToSkBitmaps(StringToNSData(kIco88x88EncodedData))); | 745 gfx::ImageDataToSkBitmaps(StringToNSData(kIco88x88EncodedData))); |
| 746 if (base::ios::IsRunningOnOrLater(8, 1, 1)) | 746 if (base::ios::IsRunningOnOrLater(8, 1, 1)) |
| 747 EXPECT_EQ(0UL, bitmaps.size()); | 747 EXPECT_EQ(0UL, bitmaps.size()); |
| 748 else | 748 else |
| 749 EXPECT_EQ(1UL, bitmaps.size()); | 749 EXPECT_EQ(1UL, bitmaps.size()); |
| 750 } | 750 } |
| 751 | 751 |
| 752 TEST_F(SkiaUtilsIosTest, UIColorFromSkColor) { |
| 753 SkColor color = SkColorSetARGB(50, 100, 150, 200); |
| 754 UIColor* ios_color = gfx::UIColorFromSkColor(color); |
| 755 CGFloat red, green, blue, alpha; |
| 756 [ios_color getRed:&red green:&green blue:&blue alpha:&alpha]; |
| 757 EXPECT_EQ(50, static_cast<int>(alpha * 255 + 0.5f)); |
| 758 EXPECT_EQ(100, static_cast<int>(red * 255 + 0.5f)); |
| 759 EXPECT_EQ(150, static_cast<int>(green * 255 + 0.5f)); |
| 760 EXPECT_EQ(200, static_cast<int>(blue * 255 + 0.5f)); |
| 761 } |
| 762 |
| 752 } // namespace | 763 } // namespace |
| 753 | 764 |
| OLD | NEW |