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

Side by Side Diff: testing/gtest_mac.mm

Issue 1211283003: Overload EXPECT_NSEQ to handle NSRect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also handle NSPoint. Created 5 years, 5 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') | testing/gtest_mac_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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "gtest_mac.h" 5 #import "gtest_mac.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include <gtest/gtest.h> 9 #include <gtest/gtest.h>
10 #include <gtest/internal/gtest-port.h> 10 #include <gtest/internal/gtest-port.h>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 if (expected != actual && ![expected isEqual:actual]) { 48 if (expected != actual && ![expected isEqual:actual]) {
49 return AssertionSuccess(); 49 return AssertionSuccess();
50 } 50 }
51 Message msg; 51 Message msg;
52 msg << "Expected: (" << expected_expression << ") != (" << actual_expression 52 msg << "Expected: (" << expected_expression << ") != (" << actual_expression
53 << "), actual: " << StringDescription(expected) 53 << "), actual: " << StringDescription(expected)
54 << " vs " << StringDescription(actual); 54 << " vs " << StringDescription(actual);
55 return AssertionFailure(msg); 55 return AssertionFailure(msg);
56 } 56 }
57 57
58 #if !defined(GTEST_OS_IOS)
59
60 GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
61 const char* actual_expression,
62 const NSRect& expected,
63 const NSRect& actual) {
64 if (NSEqualRects(expected, actual)) {
65 return AssertionSuccess();
66 }
67 return EqFailure(expected_expression,
68 actual_expression,
69 [NSStringFromRect(expected) UTF8String],
70 [NSStringFromRect(actual) UTF8String],
71 false);
72
73 }
74
75 GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
76 const char* actual_expression,
77 const NSRect& expected,
78 const NSRect& actual) {
79 if (!NSEqualRects(expected, actual)) {
80 return AssertionSuccess();
81 }
82 Message msg;
83 msg << "Expected: (" << expected_expression << ") != (" << actual_expression
84 << "), actual: " << [NSStringFromRect(expected) UTF8String]
85 << " vs " << [NSStringFromRect(actual) UTF8String];
86 return AssertionFailure(msg);
87
88 }
89
90 GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
91 const char* actual_expression,
92 const NSPoint& expected,
93 const NSPoint& actual) {
94 if (NSEqualPoints(expected, actual)) {
95 return AssertionSuccess();
96 }
97 return EqFailure(expected_expression,
98 actual_expression,
99 [NSStringFromPoint(expected) UTF8String],
100 [NSStringFromPoint(actual) UTF8String],
101 false);
102
103 }
104
105 GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
106 const char* actual_expression,
107 const NSPoint& expected,
108 const NSPoint& actual) {
109 if (!NSEqualPoints(expected, actual)) {
110 return AssertionSuccess();
111 }
112 Message msg;
113 msg << "Expected: (" << expected_expression << ") != (" << actual_expression
114 << "), actual: " << [NSStringFromPoint(expected) UTF8String]
115 << " vs " << [NSStringFromPoint(actual) UTF8String];
116 return AssertionFailure(msg);
117
118 }
119
120 #endif // !GTEST_OS_IOS
121
58 } // namespace internal 122 } // namespace internal
59 } // namespace testing 123 } // namespace testing
60 124
61 #endif // GTEST_OS_MAC 125 #endif // GTEST_OS_MAC
OLDNEW
« no previous file with comments | « testing/gtest_mac.h ('k') | testing/gtest_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698