-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NearbyInteraction][Xcode12] Add manual binding for NINearbyObjectDir…
…ectionNotAvailable (#9346) * nearby interaction manual update + test
- Loading branch information
1 parent
be26e31
commit fb665c8
Showing
7 changed files
with
82 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// NearbyInteraction manual bindings | ||
// | ||
// Authors: | ||
// Whitney Schmidt <[email protected]> | ||
// | ||
// Copyright 2020 Microsoft Inc. | ||
// | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
using CoreFoundation; | ||
using Foundation; | ||
using ObjCRuntime; | ||
using Vector3 = global::OpenTK.Vector3; | ||
|
||
#if __IOS__ | ||
namespace NearbyInteraction { | ||
partial class NINearbyObject | ||
{ | ||
static Vector3? _DirectionNotAvailable; | ||
|
||
// TODO: https://github.com/xamarin/maccore/issues/2274 | ||
// We do not have generator support to trampoline Vector3 -> vector_float3 for Fields | ||
[Field ("NINearbyObjectDirectionNotAvailable", "NearbyInteraction")] | ||
public static Vector3 DirectionNotAvailable { | ||
get { | ||
if (_DirectionNotAvailable == null) { | ||
unsafe { | ||
Vector3 *pointer = (Vector3 *) Dlfcn.GetIndirect (Libraries.NearbyInteraction.Handle, "NINearbyObjectDirectionNotAvailable"); | ||
_DirectionNotAvailable = *pointer; | ||
} | ||
} | ||
return (Vector3)_DirectionNotAvailable; | ||
} | ||
} | ||
} | ||
|
||
} | ||
#endif //__IOS__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
tests/monotouch-test/NearbyInteraction/NINearbyObjectTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2020 Microsoft Corp. | ||
|
||
#if __IOS__ | ||
|
||
using System; | ||
using Foundation; | ||
using ObjCRuntime; | ||
using NearbyInteraction; | ||
using NUnit.Framework; | ||
using OpenTK; | ||
|
||
namespace MonoTouchFixtures.NearbyInteraction { | ||
|
||
[TestFixture] | ||
[Preserve (AllMembers = true)] | ||
public class NINearbyObjectTest { | ||
|
||
[Test] | ||
public void DirectionNotAvailable () | ||
{ | ||
TestRuntime.AssertXcodeVersion (12, 0); | ||
|
||
Vector3 vect = NINearbyObject.DirectionNotAvailable; | ||
|
||
unsafe { | ||
Vector3* v = &vect; | ||
byte* ptr = (byte*) v; | ||
byte zero = 0; | ||
for (var i = 0; i < sizeof (Vector3); i++) | ||
Assert.That (ptr [i], Is.EqualTo (zero), $"Position {i}"); | ||
} | ||
} | ||
} | ||
} | ||
|
||
#endif // __IOS__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
fb665c8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Build was (probably) aborted
🔥 Jenkins job (on internal Jenkins) failed in stage(s) 'Test run, Test run' 🔥
✅ Build succeeded
✅ Packages:
✅ API Diff (from stable)
⚠️ API Diff (from PR only) (🔥 breaking changes 🔥)
ℹ️ Generator Diff (please review changes)
🔥 Test run failed 🔥
Test results
2 tests failed, 155 tests passed.
Failed tests