diff options
author | jackhou <jackhou@chromium.org> | 2015-06-30 17:44:39 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-01 00:45:17 +0000 |
commit | b22ade8600b7fb6863a197e35b5c0aeeae61d51e (patch) | |
tree | 1d0c79a767d042a8936cc68fd9c2f4ed323f5138 /testing/gtest_mac_unittest.mm | |
parent | 90d3bdc22f7826554dc0221f08bcc035bc7d9e54 (diff) | |
download | chromium_src-b22ade8600b7fb6863a197e35b5c0aeeae61d51e.zip chromium_src-b22ade8600b7fb6863a197e35b5c0aeeae61d51e.tar.gz chromium_src-b22ade8600b7fb6863a197e35b5c0aeeae61d51e.tar.bz2 |
Overload EXPECT_NSEQ to handle NSRect/NSPoint.
Previously, the typical pattern is:
EXPECT_TRUE(NSEqualRects(expected_rect, actual_rect));
But this does not print useful information upon failure.
This CL allows tests to compare NSRects with:
EXPECT_NSEQ(expected_rect, actual_rect);
which prints the NSRect upon failure.
Similarly for NSPoint.
BUG=None
Review URL: https://codereview.chromium.org/1211283003
Cr-Commit-Position: refs/heads/master@{#336939}
Diffstat (limited to 'testing/gtest_mac_unittest.mm')
-rw-r--r-- | testing/gtest_mac_unittest.mm | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/testing/gtest_mac_unittest.mm b/testing/gtest_mac_unittest.mm index 01f1497..2dfa24e 100644 --- a/testing/gtest_mac_unittest.mm +++ b/testing/gtest_mac_unittest.mm @@ -55,3 +55,55 @@ TEST(GTestMac, ExpectNSNil) { // TODO(shess): Test that EXPECT_NSNE(nil, nil) fails. } + +#if !defined(GTEST_OS_IOS) + +TEST(GTestMac, ExpectNSEQRect) { + base::mac::ScopedNSAutoreleasePool pool; + + EXPECT_NSEQ(NSMakeRect(1, 2, 3, 4), NSMakeRect(1, 2, 3, 4)); +} + +TEST(GTestMac, AssertNSEQRect) { + base::mac::ScopedNSAutoreleasePool pool; + + ASSERT_NSEQ(NSMakeRect(1, 2, 3, 4), NSMakeRect(1, 2, 3, 4)); +} + +TEST(GTestMac, ExpectNSNERect) { + base::mac::ScopedNSAutoreleasePool pool; + + EXPECT_NSNE(NSMakeRect(1, 2, 3, 4), NSMakeRect(5, 6, 7, 8)); +} + +TEST(GTestMac, AssertNSNERect) { + base::mac::ScopedNSAutoreleasePool pool; + + ASSERT_NSNE(NSMakeRect(1, 2, 3, 4), NSMakeRect(5, 6, 7, 8)); +} + +TEST(GTestMac, ExpectNSEQPoint) { + base::mac::ScopedNSAutoreleasePool pool; + + EXPECT_NSEQ(NSMakePoint(1, 2), NSMakePoint(1, 2)); +} + +TEST(GTestMac, AssertNSEQPoint) { + base::mac::ScopedNSAutoreleasePool pool; + + ASSERT_NSEQ(NSMakePoint(1, 2), NSMakePoint(1, 2)); +} + +TEST(GTestMac, ExpectNSNEPoint) { + base::mac::ScopedNSAutoreleasePool pool; + + EXPECT_NSNE(NSMakePoint(1, 2), NSMakePoint(3, 4)); +} + +TEST(GTestMac, AssertNSNEPoint) { + base::mac::ScopedNSAutoreleasePool pool; + + ASSERT_NSNE(NSMakePoint(1, 2), NSMakePoint(3, 4)); +} + +#endif // !GTEST_OS_IOS |