Skip to content

[CoreGraphics] Add missing API added in Xcode 10 beta 1. - #4547

Merged
spouliot merged 9 commits into
dotnet:xcode10from
rolfbjarne:xcode10-coregraphics-missing
Aug 3, 2018
Merged

spouliot merged 9 commits into
dotnet:xcode10from
rolfbjarne:xcode10-coregraphics-missing

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

No description provided.

@rolfbjarne
rolfbjarne requested a review from spouliot as a code owner August 1, 2018 16:39

@chamons chamons left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test for manual code?

extern static bool CGPDFArrayApplyBlock (/* CGPDFArrayRef */ IntPtr array, /* CGPDFArrayApplierBlock */ ref BlockLiteral block, /* void* */ IntPtr info);

[iOS (12, 0)][Mac (10, 14)][TV (12, 0)][Watch (5, 0)]
[BindingImpl (BindingImplOptions.Optimizable)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only semi-unrelated to PR but it seems we could/should ensure/test BindingImplOptions.Optimizable works (when BindingImplOptions.GeneratedCode is not set) inside one of our test suite (MTouch?). Otherwise we risk finding out it's not optimizable at build time (and that coverage will vary depending if the linker keeps, or not, that manually bound method).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you're suggesting: I wrote fairly extensive tests when I implemented block optimizations. monotouch-test is also built & executed with all optimizations turned on (in both debug & release mode).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried about the non-generated (manual) code, like this one, that the linker can remove (if unused) when running monotouch-test (as @chamons note there's no tests for this API so the linker will remove it). Once removed nothing checks if that manual code is (or not) optimizable right ? (I might be forgetting a different test that covers it)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just added tests for this.

delegate bool ApplyBlockHandlerDelegate (IntPtr block, nint index, IntPtr value, IntPtr info);
static readonly ApplyBlockHandlerDelegate applyblock_handler = ApplyBlockHandler;

[MonoPInvokeCallback (typeof (ApplyBlockHandlerDelegate))]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall if really needed but normally the attribute is under a

#if !MONOMAC

Comment thread src/CoreGraphics/CGPDFArray.cs Outdated

[iOS (12, 0)][Mac (10, 14)][TV (12, 0)][Watch (5, 0)]
[BindingImpl (BindingImplOptions.Optimizable)]
public bool ApplyBlock (ApplyBlockCallback callback, IntPtr info = default (IntPtr))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having an IntPtr makes it harder to pass state to the callback, than an System.Object

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, we could wrap an object with a GCHandle.

@monojenkins

Copy link
Copy Markdown
Contributor

Build success
✅ Build succeeded
✅ API Diff (from stable)
✅ API Diff (from PR only) (please review changes)
✅ Generator Diff (only version changes)
✅ Test run succeeded

…since the CGPDFArray.Count property returns nint.

This makes the following code work:

    for (var i = 0; i < array.Count; i++)
    	array.GetInt (i, ...)
Since the fact that the method is implemented using a block is not relevant
for managed code.

This also makes the method named like an equivalent method in CGPDFDictionary.
…o parameter instead of IntPtr.

This makes it nicer for managed code.
…e iterated object to the actual CGPDFObject type.

This method was previously only available in Classic, so I just reintroduced
it with a few changes to make the API nicer (which isn't a breaking change
since we're not building Classic anymore).
@monojenkins

Copy link
Copy Markdown
Contributor

Build failure
✅ Build succeeded
✅ API Diff (from stable)
✅ API Diff (from PR only) (please review changes)
✅ Generator Diff (only version changes)
🔥 Test run failed 🔥

Test results

3 tests failed, 61 tests passed.

Failed tests

  • monotouch-test/iOS Unified 32-bits - simulator/Debug: Failed
  • monotouch-test/iOS Unified 32-bits - simulator/Debug (static registrar): Failed
  • monotouch-test/iOS Unified 32-bits - simulator/Release (all optimizations): Failed

@monojenkins

Copy link
Copy Markdown
Contributor

Build success
✅ Build succeeded
✅ API Diff (from stable)
✅ API Diff (from PR only) (please review changes)
✅ Generator Diff (only version changes)
✅ Test run succeeded

@spouliot
spouliot merged commit c77f191 into dotnet:xcode10 Aug 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants