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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « testing/gtest_mac.h ('k') | testing/gtest_mac_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/gtest_mac.mm
diff --git a/testing/gtest_mac.mm b/testing/gtest_mac.mm
index 6aee98901331a129f04f1189bd8cad5879a5db2f..62b51c5a5ad1d89f0e87e781019cd597db4cfd0d 100644
--- a/testing/gtest_mac.mm
+++ b/testing/gtest_mac.mm
@@ -55,6 +55,70 @@ GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
return AssertionFailure(msg);
}
+#if !defined(GTEST_OS_IOS)
+
+GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
+ const char* actual_expression,
+ const NSRect& expected,
+ const NSRect& actual) {
+ if (NSEqualRects(expected, actual)) {
+ return AssertionSuccess();
+ }
+ return EqFailure(expected_expression,
+ actual_expression,
+ [NSStringFromRect(expected) UTF8String],
+ [NSStringFromRect(actual) UTF8String],
+ false);
+
+}
+
+GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
+ const char* actual_expression,
+ const NSRect& expected,
+ const NSRect& actual) {
+ if (!NSEqualRects(expected, actual)) {
+ return AssertionSuccess();
+ }
+ Message msg;
+ msg << "Expected: (" << expected_expression << ") != (" << actual_expression
+ << "), actual: " << [NSStringFromRect(expected) UTF8String]
+ << " vs " << [NSStringFromRect(actual) UTF8String];
+ return AssertionFailure(msg);
+
+}
+
+GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
+ const char* actual_expression,
+ const NSPoint& expected,
+ const NSPoint& actual) {
+ if (NSEqualPoints(expected, actual)) {
+ return AssertionSuccess();
+ }
+ return EqFailure(expected_expression,
+ actual_expression,
+ [NSStringFromPoint(expected) UTF8String],
+ [NSStringFromPoint(actual) UTF8String],
+ false);
+
+}
+
+GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
+ const char* actual_expression,
+ const NSPoint& expected,
+ const NSPoint& actual) {
+ if (!NSEqualPoints(expected, actual)) {
+ return AssertionSuccess();
+ }
+ Message msg;
+ msg << "Expected: (" << expected_expression << ") != (" << actual_expression
+ << "), actual: " << [NSStringFromPoint(expected) UTF8String]
+ << " vs " << [NSStringFromPoint(actual) UTF8String];
+ return AssertionFailure(msg);
+
+}
+
+#endif // !GTEST_OS_IOS
+
} // namespace internal
} // namespace testing
« 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