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

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

Issue 1155623002: Added CGFloat comparison functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Include gtest_mac.h from callers instead of adding it to ui_cocoa_test_helper.h 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
138 // A test support macro which compares two NSRects for equality taking 133 // A test support macro which compares two NSRects for equality taking
139 // the float epsilon into consideration. 134 // the float epsilon into consideration.
140 #define EXPECT_NSRECT_EQ(expected, actual) \ 135 #define EXPECT_NSRECT_EQ(expected, actual) \
141 EXPECT_TRUE(CGFLOAT_EQ(expected.origin.x, actual.origin.x) && \ 136 EXPECT_TRUE(CGFLOAT_EQ(expected.origin.x, actual.origin.x) && \
142 CGFLOAT_EQ(expected.origin.y, actual.origin.y) && \ 137 CGFLOAT_EQ(expected.origin.y, actual.origin.y) && \
143 CGFLOAT_EQ(expected.size.width, actual.size.width) && \ 138 CGFLOAT_EQ(expected.size.width, actual.size.width) && \
144 CGFLOAT_EQ(expected.size.height, actual.size.height)) << \ 139 CGFLOAT_EQ(expected.size.height, actual.size.height)) << \
145 "Rects do not match: " << \ 140 "Rects do not match: " << \
146 [NSStringFromRect(expected) UTF8String] << \ 141 [NSStringFromRect(expected) UTF8String] << \
147 " != " << [NSStringFromRect(actual) UTF8String] 142 " != " << [NSStringFromRect(actual) UTF8String]
148 143
149 #endif // UI_GFX_TEST_UI_COCOA_TEST_HELPER_H_ 144 #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