OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <Foundation/Foundation.h> | 5 #import <Foundation/Foundation.h> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "testing/platform_test.h" | 8 #include "testing/platform_test.h" |
9 #import "ui/ios/uikit_util.h" | 9 #import "ui/gfx/ios/uikit_util.h" |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 typedef PlatformTest UIKitUtilTest; | 13 typedef PlatformTest UIKitUtilTest; |
14 | 14 |
15 TEST_F(UIKitUtilTest, AlignValueToUpperPixel) { | 15 TEST_F(UIKitUtilTest, AlignValueToUpperPixel) { |
16 CGFloat scale = [[UIScreen mainScreen] scale]; | 16 CGFloat scale = [[UIScreen mainScreen] scale]; |
17 // Pick a few interesting values: already aligned, aligned on retina, and | 17 // Pick a few interesting values: already aligned, aligned on retina, and |
18 // some unaligned values that would round differently. Ensure that all are | 18 // some unaligned values that would round differently. Ensure that all are |
19 // "integer" values within <1 of the original value in the scaled space. | 19 // "integer" values within <1 of the original value in the scaled space. |
(...skipping 22 matching lines...) Expand all Loading... |
42 EXPECT_FLOAT_EQ(floor(alignedSize.width * scale), | 42 EXPECT_FLOAT_EQ(floor(alignedSize.width * scale), |
43 alignedSize.width * scale); | 43 alignedSize.width * scale); |
44 EXPECT_FLOAT_EQ(floor(alignedSize.height * scale), | 44 EXPECT_FLOAT_EQ(floor(alignedSize.height * scale), |
45 alignedSize.height * scale); | 45 alignedSize.height * scale); |
46 EXPECT_NEAR(width * scale, alignedSize.width * scale, kMaxAlignDelta); | 46 EXPECT_NEAR(width * scale, alignedSize.width * scale, kMaxAlignDelta); |
47 EXPECT_NEAR(height * scale, alignedSize.height * scale, kMaxAlignDelta); | 47 EXPECT_NEAR(height * scale, alignedSize.height * scale, kMaxAlignDelta); |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 } // namespace | 51 } // namespace |
OLD | NEW |