forked from xamarin/xamarin-macios
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ObjCRuntime] Add explicit conversion operators between NativeHandle …
…and void*. Fixes xamarin#13867. Fixes xamarin#13867.
- Loading branch information
1 parent
fb6ab21
commit 0cd2cac
Showing
2 changed files
with
36 additions
and
0 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,26 @@ | ||
using System; | ||
|
||
using Foundation; | ||
using ObjCRuntime; | ||
|
||
using NUnit.Framework; | ||
|
||
#if NET | ||
|
||
namespace MonoTouchFixtures.ObjCRuntime { | ||
[TestFixture] | ||
[Preserve (AllMembers = true)] | ||
public class NativeHandleTest { | ||
[Test] | ||
public unsafe void Operators () | ||
{ | ||
IntPtr value = new IntPtr (0xdadf00d); | ||
|
||
Assert.AreEqual (value, ((NativeHandle) value).Handle, "IntPtr -> NativeHandle"); | ||
Assert.AreEqual (value, (IntPtr) new NativeHandle (value), "NativeHandle -> IntPtr"); | ||
Assert.AreEqual (value, ((NativeHandle) ((void *) value)).Handle, "void* -> NativeHandle"); | ||
Assert.AreEqual (value, (IntPtr) (void *) new NativeHandle (value), "NativeHandle -> void*"); | ||
} | ||
} | ||
} | ||
#endif |