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

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: 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
Index: testing/gtest_mac.mm
diff --git a/testing/gtest_mac.mm b/testing/gtest_mac.mm
index 6aee98901331a129f04f1189bd8cad5879a5db2f..5155060100aef31bef72fdbf5f692576d49f230e 100644
--- a/testing/gtest_mac.mm
+++ b/testing/gtest_mac.mm
@@ -55,6 +55,36 @@ GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
return AssertionFailure(msg);
}
+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);
+
+}
+
} // namespace internal
} // namespace testing
« testing/gtest_mac.h ('K') | « 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