WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
203817
Add Googletest assertion support for CGRect and NSRect
https://bugs.webkit.org/show_bug.cgi?id=203817
Summary
Add Googletest assertion support for CGRect and NSRect
Daniel Bates
Reported
2019-11-04 10:41:09 PST
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))
Attachments
Patch
(17.56 KB, patch)
2019-11-04 10:52 PST
,
Daniel Bates
no flags
Details
Formatted Diff
Diff
Patch
(17.61 KB, patch)
2019-11-04 11:05 PST
,
Daniel Bates
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Daniel Bates
Comment 1
2019-11-04 10:52:58 PST
Created
attachment 382749
[details]
Patch
Daniel Bates
Comment 2
2019-11-04 10:54:56 PST
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.
Daniel Bates
Comment 3
2019-11-04 11:05:15 PST
Created
attachment 382752
[details]
Patch
Daniel Bates
Comment 4
2019-11-04 11:05:45 PST
Updated patch to use template to avoid duplication.
Myles C. Maxfield
Comment 5
2019-11-04 15:45:18 PST
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
Daniel Bates
Comment 6
2019-11-04 15:52:07 PST
(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.
Daniel Bates
Comment 7
2019-11-04 15:55:21 PST
Comment on
attachment 382752
[details]
Patch Clearing flags on attachment: 382752 Committed
r252023
: <
https://trac.webkit.org/changeset/252023
>
Daniel Bates
Comment 8
2019-11-04 15:55:23 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9
2019-11-04 15:56:15 PST
<
rdar://problem/56884305
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug