OLD | NEW |
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 Loading... |
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 GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression, |
| 59 const char* actual_expression, |
| 60 const NSRect& expected, |
| 61 const NSRect& actual) { |
| 62 if (NSEqualRects(expected, actual)) { |
| 63 return AssertionSuccess(); |
| 64 } |
| 65 return EqFailure(expected_expression, |
| 66 actual_expression, |
| 67 [NSStringFromRect(expected) UTF8String], |
| 68 [NSStringFromRect(actual) UTF8String], |
| 69 false); |
| 70 |
| 71 } |
| 72 |
| 73 GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression, |
| 74 const char* actual_expression, |
| 75 const NSRect& expected, |
| 76 const NSRect& actual) { |
| 77 if (!NSEqualRects(expected, actual)) { |
| 78 return AssertionSuccess(); |
| 79 } |
| 80 Message msg; |
| 81 msg << "Expected: (" << expected_expression << ") != (" << actual_expression |
| 82 << "), actual: " << [NSStringFromRect(expected) UTF8String] |
| 83 << " vs " << [NSStringFromRect(actual) UTF8String]; |
| 84 return AssertionFailure(msg); |
| 85 |
| 86 } |
| 87 |
58 } // namespace internal | 88 } // namespace internal |
59 } // namespace testing | 89 } // namespace testing |
60 | 90 |
61 #endif // GTEST_OS_MAC | 91 #endif // GTEST_OS_MAC |
OLD | NEW |