Make EXPECT_EQ() and other Googletest assertions work with CGRect and NSRect types. This makes it easy to write tests using these types and gives pretty output like this: /Volumes/.../Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm:231 Expected equality of these values: CGRectMake(138, 0, 23, 24) Which is: (origin = (x = 138, y = 0), size = (width = 23, height = 24)) rects.firstObject.CGRectValue Which is: (origin = (x = 96, y = 0), size = (width = 16, height = 17))
Created attachment 382749 [details] Patch
Comment on attachment 382749 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=382749&action=review > Tools/TestWebKitAPI/cocoa/TestCocoa.mm:48 > +std::ostream& operator<<(std::ostream& os, const NSRect& rect) > +{ > + return os << "(origin = (x = " << rect.origin.x << ", y = " << rect.origin.y << "), size = (width = " << rect.size.width << ", height = " << rect.size.height << "))"; > +} Probably could use a template to avoid duplicating this code.... I'm not really bothered by duplicating this code.
Created attachment 382752 [details] Patch
Updated patch to use template to avoid duplication.
Comment on attachment 382752 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=382752&action=review > Tools/TestWebKitAPI/cocoa/TestCocoa.mm:32 > + return os << "(origin = (x = " << rect.origin.x << ", y = " << rect.origin.y << "), size = (width = " << rect.size.width << ", height = " << rect.size.height << "))"; makeString() would make this more elegant
(In reply to Myles C. Maxfield from comment #5) > Comment on attachment 382752 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=382752&action=review > > > Tools/TestWebKitAPI/cocoa/TestCocoa.mm:32 > > + return os << "(origin = (x = " << rect.origin.x << ", y = " << rect.origin.y << "), size = (width = " << rect.size.width << ", height = " << rect.size.height << "))"; > > makeString() would make this more elegant Maybe, but it would be a tiny bit less efficient because the resulting WTF::String needs to be converted (implicitly or explicitly) to a C-string at the end to insert into the stream.
Comment on attachment 382752 [details] Patch Clearing flags on attachment: 382752 Committed r252023: <https://trac.webkit.org/changeset/252023>
All reviewed patches have been landed. Closing bug.
<rdar://problem/56884305>