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

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

Issue 1544743002: Switch to standard integer types in ios/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/background_generator.mm ('k') | ios/chrome/browser/ui/uikit_ui_util.mm » ('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/ui_util.h" 5 #import "ios/chrome/browser/ui/ui_util.h"
6 6
7 #include <stddef.h>
7 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
8 9
9 #include "base/basictypes.h" 10 #include "base/macros.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/gtest_mac.h" 12 #include "testing/gtest_mac.h"
12 13
13 TEST(UIUtilTest, AlignToPixel) { 14 TEST(UIUtilTest, AlignToPixel) {
14 CGFloat scale = [[UIScreen mainScreen] scale]; 15 CGFloat scale = [[UIScreen mainScreen] scale];
15 // Pick a few interesting values: already aligned, aligned on retina, and 16 // Pick a few interesting values: already aligned, aligned on retina, and
16 // some unaligned values that would round differently. Ensure that all are 17 // some unaligned values that would round differently. Ensure that all are
17 // "integer" values within <1 of the original value in the scaled space. 18 // "integer" values within <1 of the original value in the scaled space.
18 CGFloat test_values[] = {10.0, 55.5, 3.14159, 2.71828}; 19 CGFloat test_values[] = {10.0, 55.5, 3.14159, 2.71828};
19 const CGFloat kMaxAlignDelta = 0.9999; 20 const CGFloat kMaxAlignDelta = 0.9999;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 originalSize = CGSizeMake(50, 100); 267 originalSize = CGSizeMake(50, 100);
267 targetSize = CGSizeMake(40, 60); 268 targetSize = CGSizeMake(40, 60);
268 expectedProjection = CGRectMake(0, 0, 40, 80); 269 expectedProjection = CGRectMake(0, 0, 40, 80);
269 expectedRevisedSize = expectedProjection.size; 270 expectedRevisedSize = expectedProjection.size;
270 CalculateProjection(originalSize, targetSize, 271 CalculateProjection(originalSize, targetSize,
271 ProjectionMode::kAspectFillNoClipping, revisedSize, 272 ProjectionMode::kAspectFillNoClipping, revisedSize,
272 projection); 273 projection);
273 EXPECT_EQ_RECT(expectedProjection, projection); 274 EXPECT_EQ_RECT(expectedProjection, projection);
274 EXPECT_EQ_SIZE(expectedRevisedSize, revisedSize); 275 EXPECT_EQ_SIZE(expectedRevisedSize, revisedSize);
275 } 276 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/background_generator.mm ('k') | ios/chrome/browser/ui/uikit_ui_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698