Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: ios/chrome/browser/ui/uikit_ui_util_unittest.mm

Issue 2645653003: Expose thumbnails of pages to iOS share extensions. (Closed)
Patch Set: Addressed comments. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/ui/ui_util_unittest.mm ('k') | ui/base/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #import "ios/chrome/browser/ui/uikit_ui_util.h" 5 #import "ios/chrome/browser/ui/uikit_ui_util.h"
6 6
7 #include "base/mac/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #import "ios/chrome/browser/ui/ui_util.h" 9 #import "ios/chrome/browser/ui/ui_util.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 UIImage* image = testImage(CGSizeMake(100, 50)); 94 UIImage* image = testImage(CGSizeMake(100, 50));
95 actual = ResizeImage(image, CGSizeZero, ProjectionMode::kAspectFit); 95 actual = ResizeImage(image, CGSizeZero, ProjectionMode::kAspectFit);
96 EXPECT_FALSE(actual); 96 EXPECT_FALSE(actual);
97 97
98 actual = ResizeImage(image, CGSizeMake(0.1, 0.1), ProjectionMode::kAspectFit); 98 actual = ResizeImage(image, CGSizeMake(0.1, 0.1), ProjectionMode::kAspectFit);
99 EXPECT_FALSE(actual); 99 EXPECT_FALSE(actual);
100 100
101 actual = 101 actual =
102 ResizeImage(image, CGSizeMake(-100, -100), ProjectionMode::kAspectFit); 102 ResizeImage(image, CGSizeMake(-100, -100), ProjectionMode::kAspectFit);
103 EXPECT_FALSE(actual); 103 EXPECT_FALSE(actual);
104
105 actual = ResizeImage(nil, CGSizeMake(100, 100), ProjectionMode::kAspectFit);
106 EXPECT_FALSE(actual);
104 } 107 }
105 108
106 TEST(UIKitUIUtilTest, TintImageKeepsImageProperties) { 109 TEST(UIKitUIUtilTest, TintImageKeepsImageProperties) {
107 UIImage* image = testImage(CGSizeMake(100, 75)); 110 UIImage* image = testImage(CGSizeMake(100, 75));
108 UIImage* tintedImage = TintImage(image, [UIColor blueColor]); 111 UIImage* tintedImage = TintImage(image, [UIColor blueColor]);
109 EXPECT_EQ(image.size.width, tintedImage.size.width); 112 EXPECT_EQ(image.size.width, tintedImage.size.width);
110 EXPECT_EQ(image.size.height, tintedImage.size.height); 113 EXPECT_EQ(image.size.height, tintedImage.size.height);
111 EXPECT_EQ(image.scale, tintedImage.scale); 114 EXPECT_EQ(image.scale, tintedImage.scale);
112 EXPECT_EQ(image.capInsets.top, tintedImage.capInsets.top); 115 EXPECT_EQ(image.capInsets.top, tintedImage.capInsets.top);
113 EXPECT_EQ(image.capInsets.left, tintedImage.capInsets.left); 116 EXPECT_EQ(image.capInsets.left, tintedImage.capInsets.left);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 ASSERT_EQ(kCGColorSpaceModelMonochrome, 156 ASSERT_EQ(kCGColorSpaceModelMonochrome,
154 CGColorSpaceGetModel(CGColorGetColorSpace(black.CGColor))); 157 CGColorSpaceGetModel(CGColorGetColorSpace(black.CGColor)));
155 158
156 // Interpolate between monochrome and rgb. 159 // Interpolate between monochrome and rgb.
157 ExpectInterpolatedColor(black, rgb, 0.5, 0.1); 160 ExpectInterpolatedColor(black, rgb, 0.5, 0.1);
158 // Interpolate between two monochrome colors. 161 // Interpolate between two monochrome colors.
159 ExpectInterpolatedColor(black, white, 0.3, 0.3); 162 ExpectInterpolatedColor(black, white, 0.3, 0.3);
160 } 163 }
161 164
162 } // namespace 165 } // namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/ui_util_unittest.mm ('k') | ui/base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698