WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
167493
[Cocoa] Prepare ComplexTextController for unit testing
https://bugs.webkit.org/show_bug.cgi?id=167493
Summary
[Cocoa] Prepare ComplexTextController for unit testing
Myles C. Maxfield
Reported
2017-01-27 01:04:50 PST
[Cocoa] Prepare ComplexTextController for unit testing
Attachments
Patch
(31.30 KB, patch)
2017-01-27 01:13 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(30.25 KB, patch)
2017-01-27 01:14 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Follow-up patch
(10.99 KB, patch)
2017-01-27 14:36 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Myles C. Maxfield
Comment 1
2017-01-27 01:13:19 PST
Created
attachment 299922
[details]
Patch
Myles C. Maxfield
Comment 2
2017-01-27 01:14:12 PST
Created
attachment 299923
[details]
Patch
Dean Jackson
Comment 3
2017-01-27 12:03:11 PST
Comment on
attachment 299923
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=299923&action=review
> Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:111 > + Vector<CGSize> advances = { CGSizeZero, CGSizeMake(21.640625, 0.0), CGSizeMake(42.3046875, 0.0), CGSizeMake(55.8984375, 0.0), CGSizeMake(22.34375, 0.0) }; > + Vector<CGPoint> origins = { CGPointMake(-15.15625, 18.046875), CGPointZero, CGPointZero, CGPointZero, CGPointZero }; > +#else > + Vector<CGSize> advances = { CGSizeMake(15.15625, -18.046875), CGSizeMake(21.640625, 0.0), CGSizeMake(42.3046875, 0.0), CGSizeMake(55.8984375, 0.0), CGSizeMake(22.34375, 0.0) };
Where do all these numbers come from? It's probably worth leaving a comment explaining them.
Myles C. Maxfield
Comment 4
2017-01-27 12:04:21 PST
Comment on
attachment 299923
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=299923&action=review
>> Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:111 >> + Vector<CGSize> advances = { CGSizeMake(15.15625, -18.046875), CGSizeMake(21.640625, 0.0), CGSizeMake(42.3046875, 0.0), CGSizeMake(55.8984375, 0.0), CGSizeMake(22.34375, 0.0) }; > > Where do all these numbers come from? It's probably worth leaving a comment explaining them.
From the ChangeLog: "These metrics 16 have been gathered from real-world uses; however, a layout test is not appropriate 17 because the fonts which produced these metrics are not licensed appropriately."
Simon Fraser (smfr)
Comment 5
2017-01-27 12:05:12 PST
Comment on
attachment 299923
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=299923&action=review
> Source/WebCore/ChangeLog:26 > + No new tests because there is no behavior change.
But you're adding an API test.
> Source/WebCore/platform/graphics/mac/ComplexTextController.h:94 > + static Ref<ComplexTextRun> createForTesting(Vector<CGSize> advances, Vector<CGPoint> origins, Vector<CGGlyph> glyphs, Vector<CFIndex> stringIndices, CGSize initialAdvance, const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange, bool ltr)
Do you really want to copy all those vectors by value?
> Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm:186 > +ComplexTextController::ComplexTextRun::ComplexTextRun(Vector<CGSize> advances, Vector<CGPoint> origins, Vector<CGGlyph> glyphs, Vector<CFIndex> stringIndices, CGSize initialAdvance, const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange, bool ltr)
So much copying.
> Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:54 > + font.update(nullptr);
Maybe update should have a default argument.
> Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:57 > +#if USE_LAYOUT_SPECIFIC_ADVANCES
Are you sure that TestWebKitAPI gets the right defines?
> Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:70 > + Ref<ComplexTextController::ComplexTextRun> run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(21.875, 0) }, { CGPointZero }, { 5 }, { 5 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(5, 1), false);
auto?
> Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:71 > + Ref<ComplexTextController::ComplexTextRun> run2 = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 193, 377, 447, 431, 458 }, { 4, 3, 2, 1, 0 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 5), false);
auto?
WebKit Commit Bot
Comment 6
2017-01-27 12:29:32 PST
Comment on
attachment 299923
[details]
Patch Clearing flags on attachment: 299923 Committed
r211294
: <
http://trac.webkit.org/changeset/211294
>
WebKit Commit Bot
Comment 7
2017-01-27 12:29:35 PST
All reviewed patches have been landed. Closing bug.
Myles C. Maxfield
Comment 8
2017-01-27 14:35:17 PST
Comment on
attachment 299923
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=299923&action=review
>> Source/WebCore/ChangeLog:26 >> + No new tests because there is no behavior change. > > But you're adding an API test.
They are disabled until
https://bugs.webkit.org/show_bug.cgi?id=166013
>> Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:57 >> +#if USE_LAYOUT_SPECIFIC_ADVANCES > > Are you sure that TestWebKitAPI gets the right defines?
Yes, this is defined in ComplexTextController.h
Myles C. Maxfield
Comment 9
2017-01-27 14:35:58 PST
Reopening to attach new patch.
Myles C. Maxfield
Comment 10
2017-01-27 14:36:00 PST
Created
attachment 299964
[details]
Follow-up patch
Myles C. Maxfield
Comment 11
2017-01-27 15:58:26 PST
Committed
r211308
: <
http://trac.webkit.org/changeset/211308
>
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