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

Side by Side Diff: ui/gfx/test/ui_cocoa_test_helper.h

Issue 1168523004: Revert of Added CGFloat comparison functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « testing/gtest_mac.h ('k') | ui/message_center/cocoa/tray_view_controller_unittest.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 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 #ifndef UI_GFX_TEST_UI_COCOA_TEST_HELPER_H_ 5 #ifndef UI_GFX_TEST_UI_COCOA_TEST_HELPER_H_
6 #define UI_GFX_TEST_UI_COCOA_TEST_HELPER_H_ 6 #define UI_GFX_TEST_UI_COCOA_TEST_HELPER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #import <Cocoa/Cocoa.h> 10 #import <Cocoa/Cocoa.h>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 #else 123 #else
124 #define CGFLOAT_EPSILON FLT_EPSILON 124 #define CGFLOAT_EPSILON FLT_EPSILON
125 #endif 125 #endif
126 126
127 // A macro which which determines if two CGFloats are equal taking a 127 // A macro which which determines if two CGFloats are equal taking a
128 // proper epsilon into consideration. 128 // proper epsilon into consideration.
129 #define CGFLOAT_EQ(expected, actual) \ 129 #define CGFLOAT_EQ(expected, actual) \
130 (actual >= (expected - CGFLOAT_EPSILON) && \ 130 (actual >= (expected - CGFLOAT_EPSILON) && \
131 actual <= (expected + CGFLOAT_EPSILON)) 131 actual <= (expected + CGFLOAT_EPSILON))
132 132
133 // A test support macro which ascertains if two CGFloats are equal.
134 #define EXPECT_CGFLOAT_EQ(expected, actual) \
135 EXPECT_TRUE(CGFLOAT_EQ(expected, actual)) << \
136 expected << " != " << actual
137
133 // A test support macro which compares two NSRects for equality taking 138 // A test support macro which compares two NSRects for equality taking
134 // the float epsilon into consideration. 139 // the float epsilon into consideration.
135 #define EXPECT_NSRECT_EQ(expected, actual) \ 140 #define EXPECT_NSRECT_EQ(expected, actual) \
136 EXPECT_TRUE(CGFLOAT_EQ(expected.origin.x, actual.origin.x) && \ 141 EXPECT_TRUE(CGFLOAT_EQ(expected.origin.x, actual.origin.x) && \
137 CGFLOAT_EQ(expected.origin.y, actual.origin.y) && \ 142 CGFLOAT_EQ(expected.origin.y, actual.origin.y) && \
138 CGFLOAT_EQ(expected.size.width, actual.size.width) && \ 143 CGFLOAT_EQ(expected.size.width, actual.size.width) && \
139 CGFLOAT_EQ(expected.size.height, actual.size.height)) << \ 144 CGFLOAT_EQ(expected.size.height, actual.size.height)) << \
140 "Rects do not match: " << \ 145 "Rects do not match: " << \
141 [NSStringFromRect(expected) UTF8String] << \ 146 [NSStringFromRect(expected) UTF8String] << \
142 " != " << [NSStringFromRect(actual) UTF8String] 147 " != " << [NSStringFromRect(actual) UTF8String]
143 148
144 #endif // UI_GFX_TEST_UI_COCOA_TEST_HELPER_H_ 149 #endif // UI_GFX_TEST_UI_COCOA_TEST_HELPER_H_
OLDNEW
« no previous file with comments | « testing/gtest_mac.h ('k') | ui/message_center/cocoa/tray_view_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698