[autoformat] Add generator tests. (#16800)

This commit is contained in:
Rolf Bjarne Kvinge 2022-11-17 23:04:21 +01:00 коммит произвёл GitHub
Родитель 232a680660
Коммит 8ad9df8523
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
79 изменённых файлов: 992 добавлений и 1101 удалений

Просмотреть файл

@ -5,10 +5,8 @@ using Mono.Cecil.Cil;
using NUnit.Framework;
namespace GeneratorTests
{
public static class Asserts
{
namespace GeneratorTests {
public static class Asserts {
public static void DoesNotThrowExceptions (MethodReference method, string message)
{
var instructions = method.Resolve ().Body.Instructions;

Просмотреть файл

@ -10,12 +10,10 @@ using Mono.Cecil.Cil;
using Xamarin.Tests;
namespace GeneratorTests
{
namespace GeneratorTests {
[TestFixture ()]
[Parallelizable (ParallelScope.All)]
public class BGenTests
{
public class BGenTests {
// Removing the following variable might make running the unit tests in VSMac fail.
static Type variable_to_keep_reference_to_system_runtime_compilerservices_unsafe_assembly = typeof (System.Runtime.CompilerServices.Unsafe);
@ -636,7 +634,7 @@ namespace GeneratorTests
[TestCase (Profile.iOS)]
public void GH5416_setter (Profile profile)
{
Configuration.IgnoreIfIgnoredPlatform (profile.AsPlatform());
Configuration.IgnoreIfIgnoredPlatform (profile.AsPlatform ());
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.AddTestApiDefinition ("ghissue5416a.cs");

Просмотреть файл

@ -13,10 +13,8 @@ using Mono.Cecil.Cil;
using Xamarin.Utils;
namespace Xamarin.Tests
{
class BGenTool : Tool
{
namespace Xamarin.Tests {
class BGenTool : Tool {
public const string None = "None";
AssemblyDefinition assembly;
@ -397,8 +395,7 @@ namespace Xamarin.Tests
// This class will replace stdout/stderr with its own thread-static storage for stdout/stderr.
// This means we're capturing stdout/stderr per thread.
class ThreadStaticTextWriter : TextWriter
{
class ThreadStaticTextWriter : TextWriter {
[ThreadStatic]
static TextWriter current_writer;
@ -411,7 +408,7 @@ namespace Xamarin.Tests
public static void ReplaceConsole (StringBuilder sb)
{
lock (lock_obj) {
lock (lock_obj) {
if (counter == 0) {
original_stdout = Console.Out;
original_stderr = Console.Error;
@ -424,7 +421,7 @@ namespace Xamarin.Tests
}
public static void RestoreConsole ()
{
{
lock (lock_obj) {
current_writer.Dispose ();
current_writer = null;

Просмотреть файл

@ -4,12 +4,10 @@ using NUnit.Framework;
using Xamarin.Tests;
namespace GeneratorTests
{
namespace GeneratorTests {
[TestFixture ()]
[Parallelizable (ParallelScope.All)]
public class ErrorTests
{
public class ErrorTests {
[Test]
[TestCase (Profile.iOS)]
public void BI0002 (Profile profile)
@ -203,7 +201,7 @@ namespace GeneratorTests
bgen.AssertError (1071, "The BindAs type for the member \"GH6863_property.MyFooClass.StringProp\" must be an array when the member's type is an array.");
}
[Test]
[TestCase (Profile.iOS)]
public void GH6863_method (Profile profile)
@ -215,7 +213,7 @@ namespace GeneratorTests
bgen.AssertExecuteError ("build");
bgen.AssertError (1072, "The BindAs type for the parameter \"id_test\" in the method \"GH6863_method.MyFooClass.StringMethod\" must be an array when the parameter's type is an array.");
}
[Test]
[TestCase (Profile.iOS)]

Просмотреть файл

@ -9,12 +9,10 @@ using Xamarin;
using Xamarin.Tests;
using Xamarin.Utils;
namespace GeneratorTests
{
namespace GeneratorTests {
[TestFixture ()]
[Parallelizable (ParallelScope.All)]
public class BGen
{
public class BGen {
[Test]
[TestCase (Profile.iOS)]
public void ResponseFile (Profile profile)

Просмотреть файл

@ -13,7 +13,7 @@ using Foundation;
using ObjCRuntime;
namespace Test {
[BaseType (typeof (NSObject), Delegates=new string [] {"WeakDelegate"}, Events=new Type [] {typeof (SharedDelegate)})]
[BaseType (typeof (NSObject), Delegates = new string [] { "WeakDelegate" }, Events = new Type [] { typeof (SharedDelegate) })]
public interface TestClass {
[Export ("delegate", ArgumentSemantic.Assign), NullAllowed]
NSObject WeakDelegate { get; set; }

Просмотреть файл

@ -5,28 +5,24 @@ using Foundation;
namespace AudioUnit {
// @interface AUParameterNode : NSObject
[BaseType (typeof(NSObject))]
interface AUParameterNode
{
[BaseType (typeof (NSObject))]
interface AUParameterNode {
}
// @interface AUParameterGroup : AUParameterNode <NSSecureCoding>
[BaseType (typeof(AUParameterNode))]
interface AUParameterGroup : INSSecureCoding
{
[BaseType (typeof (AUParameterNode))]
interface AUParameterGroup : INSSecureCoding {
[Export ("allParameters")]
AUParameter[] AllParameters { get; }
AUParameter [] AllParameters { get; }
}
// @interface AUParameter : AUParameterNode <NSSecureCoding>
[BaseType (typeof(AUParameterNode))]
interface AUParameter : INSSecureCoding
{
[BaseType (typeof (AUParameterNode))]
interface AUParameter : INSSecureCoding {
}
// Commenting this out "fixes" the problem
[BaseType (typeof(NSObject))]
interface AudioUnit
{
[BaseType (typeof (NSObject))]
interface AudioUnit {
}
}

Просмотреть файл

@ -3,8 +3,8 @@ using Foundation;
namespace NS {
[BaseType (typeof (NSObject))]
interface Foo {
[Export ("foo:")]
[Async (ResultTypeName="Result")]
void Method (string arg);
[Export ("foo:")]
[Async (ResultTypeName = "Result")]
void Method (string arg);
}
}

Просмотреть файл

@ -1,8 +1,7 @@
using System;
using Foundation;
namespace BindingTests
{
namespace BindingTests {
public enum Tools {
[Field ("DoorOpener")]
DoorOpener,

Просмотреть файл

@ -1,8 +1,7 @@
using System;
using Foundation;
namespace BindingTests
{
namespace BindingTests {
public enum HMAccessoryCategoryType {
[Field ("HMAccessoryCategoryTypeGarageDoorOpener")]
DoorOpener,

Просмотреть файл

@ -3,4 +3,4 @@ using Foundation;
[Protocol]
[Preserve (AllMembers = true)]
[Preserve (AllMembers = true)]
partial interface BI1059 {}
partial interface BI1059 { }

Просмотреть файл

@ -12,6 +12,6 @@ namespace BindAs1048ErrorTests {
[return: BindAs (typeof (string))]
[Export ("stringMethod:")]
NSString StringMethod (int arg1);
}
}

Просмотреть файл

@ -12,6 +12,6 @@ namespace BindAs1049ErrorTests {
[return: BindAs (typeof (string))]
[Export ("stringMethod:")]
NSNumber StringMethod (int arg1);
}
}

Просмотреть файл

@ -13,6 +13,6 @@ namespace BindAs1050ModelErrorTests {
[return: BindAs (typeof (CAScroll? []))]
[Export ("getScrollArrayEnum2:")]
NSNumber [] GetScrollArrayFooEnumArray2 ([BindAs (typeof (CAScroll []))] NSNumber [] arg1);
}
}

Просмотреть файл

@ -12,6 +12,6 @@ namespace BindAs1050ProtocolErrorTests {
[return: BindAs (typeof (CAScroll? []))]
[Export ("getScrollArrayEnum2:")]
NSNumber [] GetScrollArrayFooEnumArray2 ([BindAs (typeof (CAScroll []))] NSNumber [] arg1);
}
}

Просмотреть файл

@ -1,10 +1,8 @@
using Foundation;
namespace Test
{
[BaseType (typeof (NSObject))]
interface TestBMACLib
{
namespace Test {
[BaseType (typeof (NSObject))]
interface TestBMACLib {
[Export ("addTwoRows:withSecond:")]
int Add (int first, int second);
}

Просмотреть файл

@ -1,10 +1,8 @@
using Foundation;
namespace Test
{
namespace Test {
[BaseType (typeof (NSObject))]
interface TestBMACLib
{
interface TestBMACLib {
[Export ("addTwoRows:withSecond:")]
int Add (int first, int second);
}

Просмотреть файл

@ -5,9 +5,8 @@ using Foundation;
using UIKit;
using System.Runtime.InteropServices;
namespace BindingTests
{
delegate NSObject MyBlockToBind (NSObject[] keys);
namespace BindingTests {
delegate NSObject MyBlockToBind (NSObject [] keys);
[BaseType (typeof (NSObject))]
interface TestInterface {

Просмотреть файл

@ -9,6 +9,6 @@ namespace BindingTests {
// error BI1018: btouch: No [Export] attribute on property MonoTouch.ObjCRuntime.INativeObject.Handle
[BaseType (typeof (UIPageViewController))]
interface MyPageViewController : IUIPageViewControllerDelegate, IUIPageViewControllerDataSource {
interface MyPageViewController : IUIPageViewControllerDelegate, IUIPageViewControllerDataSource {
}
}

Просмотреть файл

@ -5,7 +5,7 @@ using ObjCRuntime;
namespace xam.bug17232 {
[BaseType (typeof (NSObject))]
interface FieldsTest {
[Field ("MyFooFieldA", "libFoo.a")]
NSString FooFieldA { get; }

Просмотреть файл

@ -2,8 +2,8 @@ using Foundation;
using UIKit;
namespace Test {
[Model, BaseType (typeof (UIPopoverControllerDelegate))]
[Protocol]
public partial interface BindingMainTabBarControllerScreensHandler {
}
[Model, BaseType (typeof (UIPopoverControllerDelegate))]
[Protocol]
public partial interface BindingMainTabBarControllerScreensHandler {
}
}

Просмотреть файл

@ -10,8 +10,8 @@ using UIKit;
namespace Test {
[BaseType (typeof (NSObject),
Delegates=new string [] {"WeakDelegate"},
Events=new Type [] { typeof (UIPopoverPresentationControllerDelegate) })]
Delegates = new string [] { "WeakDelegate" },
Events = new Type [] { typeof (UIPopoverPresentationControllerDelegate) })]
public partial interface TestController {
[Export ("delegate", ArgumentSemantic.UnsafeUnretained)]
NSObject WeakDelegate { get; set; }

Просмотреть файл

@ -5,8 +5,7 @@ using ObjCRuntime;
using Foundation;
using UIKit;
namespace Foo.BindingBugs
{
namespace Foo.BindingBugs {
[BaseType (typeof (NSObject))]
interface Widget {
[Export ("doSomething:atIndex:")]

Просмотреть файл

@ -5,10 +5,9 @@ using ObjCRuntime;
using Foundation;
using UIKit;
namespace Bug27430
{
namespace Bug27430 {
delegate void SomeHandler (int @int, string @string, NSError @namespace);
delegate void SomeHandler2 (NSDictionary[] @switch, string[] @case, NSError @namespace);
delegate void SomeHandler2 (NSDictionary [] @switch, string [] @case, NSError @namespace);
[BaseType (typeof (NSObject))]
interface Widget {
@ -71,7 +70,7 @@ namespace Bug27430
UIView [] @foreach { get; [Bind ("foo3:")] set; }
[Export ("dont4")]
UIView [] @case {[Bind ("bar4")] get; [Bind ("foo4:")] set; }
UIView [] @case { [Bind ("bar4")] get; [Bind ("foo4:")] set; }
[Export ("dont")]
NSArray @void { get; }

Просмотреть файл

@ -4,14 +4,13 @@ using Foundation;
using ObjCRuntime;
using System.Drawing;
namespace bug27986
{
namespace bug27986 {
interface IFooProtocol { }
[Model, Protocol, Preserve (AllMembers = true)]
[BaseType (typeof (NSObject))]
interface FooProtocol {
[Preserve]
[Export ("doSomething:atIndex:")]
void DoSomething (NSObject @object, int index);
@ -31,11 +30,11 @@ namespace bug27986
NSObject Center2 { get; set; }
}
[BaseType (typeof (NSObject))]
[Preserve (AllMembers = true)]
interface Widget {
[Preserve (Conditional = true)]
[Export ("initWithElmo:")]
IntPtr Constructor (uint elmo);
@ -48,7 +47,7 @@ namespace bug27986
[Export ("center")]
NSObject Center { get; set; }
[Export("noCenter")]
[Export ("noCenter")]
PointF NoCenter { [Preserve (Conditional = true)] get; [Preserve] set; }
[Preserve]

Просмотреть файл

@ -1,110 +1,99 @@
using System;
using UIKit;
using Foundation;
using ObjCRuntime;
using CoreGraphics;
namespace Bug29493
{
namespace Bug29493 {
[Category]
[BaseType (typeof(UIColor))]
interface UIColorExtensions
{
[BaseType (typeof (UIColor))]
interface UIColorExtensions {
// +(UIColor *)jbill_messageBubbleGreenColor;
[Static]
[Export ("jbill_messageBubbleGreenColor")]
UIColor MessageBubbleGreenColor ();
[Export ("jbill_messageBubbleGreenColor")]
UIColor MessageBubbleGreenColor2 ();
}
[Category]
[BaseType (typeof(NSUrlSession))]
interface NSUrlExtensions
{
[BaseType (typeof (NSUrlSession))]
interface NSUrlExtensions {
// +(UIColor *)jbill_messageBubbleGreenColor;
[Static]
[Export ("jbill_messageBubbleGreenColor")]
UIColor MessageBubbleGreenColor ();
[Export ("jbill_messageBubbleGreenColor")]
UIColor MessageBubbleGreenColor2 ();
}
[BaseType (typeof(NSObject))]
interface HelloKitty
{
[BaseType (typeof (NSObject))]
interface HelloKitty {
}
[Category]
[BaseType (typeof(HelloKitty))]
interface HelloKittyExtensions
{
[BaseType (typeof (HelloKitty))]
interface HelloKittyExtensions {
// +(UIColor *)jbill_messageBubbleGreenColor;
[Static]
[Export ("jbill_messageBubbleGreenColor")]
UIColor MessageBubbleGreenColor ();
[Export ("jbill_messageBubbleGreenColor")]
UIColor MessageBubbleGreenColor2 ();
}
[BaseType (typeof(NSObject), Name = "NSBatman")]
interface BecauseImBatman
{
[BaseType (typeof (NSObject), Name = "NSBatman")]
interface BecauseImBatman {
}
[Category]
[BaseType (typeof(BecauseImBatman))]
interface BecauseImBatmanExtensions
{
[BaseType (typeof (BecauseImBatman))]
interface BecauseImBatmanExtensions {
// +(UIColor *)jbill_messageBubbleGreenColor;
[Static]
[Export ("jbill_messageBubbleGreenColor")]
UIColor MessageBubbleGreenColor ();
[Export ("jbill_messageBubbleGreenColor")]
UIColor MessageBubbleGreenColor2 ();
}
[BaseType (typeof(BecauseImBatman), Name = "NSBatman2")]
interface BecauseImBatman2
{
[BaseType (typeof (BecauseImBatman), Name = "NSBatman2")]
interface BecauseImBatman2 {
}
[Category]
[BaseType (typeof(BecauseImBatman2))]
interface BecauseImBatman2Extensions
{
[BaseType (typeof (BecauseImBatman2))]
interface BecauseImBatman2Extensions {
// +(UIColor *)jbill_messageBubbleGreenColor;
[Static]
[Export ("jbill_messageBubbleGreenColor")]
UIColor MessageBubbleGreenColor ();
[Export ("jbill_messageBubbleGreenColor")]
UIColor MessageBubbleGreenColor2 ();
}
[BaseType (typeof(BecauseImBatman))]
interface Superman
{
[BaseType (typeof (BecauseImBatman))]
interface Superman {
}
[Category]
[BaseType (typeof(Superman))]
interface SupermanExtensions
{
[BaseType (typeof (Superman))]
interface SupermanExtensions {
// +(UIColor *)jbill_messageBubbleGreenColor;
[Static]
[Export ("jbill_messageBubbleGreenColor")]
UIColor MessageBubbleGreenColor ();
[Export ("jbill_messageBubbleGreenColor")]
UIColor MessageBubbleGreenColor2 ();
}

Просмотреть файл

@ -1,15 +1,13 @@
using Foundation;
namespace Test
{
namespace Test {
[BaseType (typeof (NSObject))]
interface SimServiceConnectionManager {}
interface SimServiceConnectionManager { }
// Both these should produce the same output,
// both calling xamarin_IntPtr_objc_msgSend_exception
[BaseType (typeof (NSObject))]
interface MarshalOnProperty
{
interface MarshalOnProperty {
[Static]
[Export ("sharedConnectionManager")]
[MarshalNativeExceptions]
@ -17,10 +15,9 @@ namespace Test
}
[BaseType (typeof (NSObject))]
interface MarshalInProperty
{
interface MarshalInProperty {
[Static]
[Export ("sharedConnectionManager")]
SimServiceConnectionManager Shared { [MarshalNativeExceptions]get; }
SimServiceConnectionManager Shared { [MarshalNativeExceptions] get; }
}
}

Просмотреть файл

@ -1,21 +1,17 @@
using System;
using UIKit;
namespace Bug34042.Foo
{
[BaseType (typeof(UIButton))]
interface FooButton
{
namespace Bug34042.Foo {
[BaseType (typeof (UIButton))]
interface FooButton {
}
}
namespace Bug34042.Bar
{
[BaseType (typeof(Bug34042.Foo.FooButton))]
interface BarButton
{
namespace Bug34042.Bar {
[BaseType (typeof (Bug34042.Foo.FooButton))]
interface BarButton {
}
}

Просмотреть файл

@ -4,9 +4,9 @@ using ObjCRuntime;
using Foundation;
namespace Bug35176 {
[Introduced (PlatformName.iOS, 14,3)]
[Introduced (PlatformName.MacOSX, 11,2)]
[Introduced (PlatformName.iOS, 14, 3)]
[Introduced (PlatformName.MacOSX, 11, 2)]
[Protocol]
interface FooInterface {
@ -15,15 +15,14 @@ namespace Bug35176 {
UIView FooView { get; set; }
[Export ("BarView")]
UIView BarView { [Introduced (PlatformName.iOS, 14,4)] get; }
UIView BarView { [Introduced (PlatformName.iOS, 14, 4)] get; }
[Export ("barMember:")]
UIView GetBarMember (int x);
}
[BaseType (typeof (NSObject))]
interface BarObject : FooInterface
{
interface BarObject : FooInterface {
}
}

Просмотреть файл

@ -3,9 +3,8 @@ using Foundation;
namespace Bug {
delegate string ReturnsString ();
[BaseType (typeof(NSObject))]
interface Type
{
[BaseType (typeof (NSObject))]
interface Type {
[Export ("returnString")]
ReturnsString ReturnString { get; set; }
}

Просмотреть файл

@ -13,8 +13,8 @@ namespace Test {
public interface SharedDelegate {
}
[BaseType (typeof (NSObject), Delegates=new string [] {"WeakDelegate"}, Events=new Type [] {typeof (SharedDelegate)})]
public interface TestMissingPropertyName{
[BaseType (typeof (NSObject), Delegates = new string [] { "WeakDelegate" }, Events = new Type [] { typeof (SharedDelegate) })]
public interface TestMissingPropertyName {
[Export ("delegate", ArgumentSemantic.Assign), NullAllowed]
NSObject WeakDelegate { get; set; }
}

Просмотреть файл

@ -13,8 +13,8 @@ namespace Test {
public interface SharedDelegate {
}
[BaseType (typeof (NSObject), Delegates=new string [] {"WeakDelegate"}, Events=new Type [] {typeof (SharedDelegate)})]
public interface TestWrongPropertyName{
[BaseType (typeof (NSObject), Delegates = new string [] { "WeakDelegate" }, Events = new Type [] { typeof (SharedDelegate) })]
public interface TestWrongPropertyName {
[Export ("delegate", ArgumentSemantic.Assign), NullAllowed]
NSObject WeakDelegate { get; set; }

Просмотреть файл

@ -4,15 +4,14 @@ using Foundation;
using ObjCRuntime;
using System.Drawing;
namespace bug42742
{
namespace bug42742 {
interface IFooProtocol { }
[Advice ("FooProtocol")]
[Model, Protocol]
[BaseType (typeof (NSObject))]
interface FooProtocol {
[Advice ("doSomething:atIndex:")]
[Export ("doSomething:atIndex:")]
void DoSomething (NSObject @object, int index);
@ -32,11 +31,11 @@ namespace bug42742
NSObject Center2 { get; set; }
}
[BaseType (typeof (NSObject))]
[Advice ("Widget")]
interface Widget {
[Advice ("initWithElmo:")]
[Export ("initWithElmo:")]
IntPtr Constructor (uint elmo);
@ -49,7 +48,7 @@ namespace bug42742
[Export ("center")]
NSObject Center { get; set; }
[Export("noCenter")]
[Export ("noCenter")]
PointF NoCenter { [Advice ("noCenterGet")] get; [Advice ("noCenterSet")] set; }
[Advice ("FooField")]

Просмотреть файл

@ -3,7 +3,8 @@ using Foundation;
namespace Bug42855Tests {
[Protocol][Model]
[Protocol]
[Model]
interface MyFooClass {
[Abstract]

Просмотреть файл

@ -14,6 +14,6 @@ namespace bug52570AllowStaticMembers {
[BaseType (typeof (NSObject))]
interface FooObject {
}
}

Просмотреть файл

@ -15,6 +15,6 @@ namespace Bug52570ClassInternal {
[BaseType (typeof (NSObject))]
interface FooObject {
}
}

Просмотреть файл

@ -15,6 +15,6 @@ namespace bug52570MethodInternal {
[BaseType (typeof (NSObject))]
interface FooObject {
}
}

Просмотреть файл

@ -28,13 +28,13 @@ namespace Bug53076Test {
[Abstract]
[Async (ResultTypeName = "RequiredReturnMethodObjResult")]
[Export ("requiredReturnMethodObj:completion:")]
bool RequiredReturnMethodObj (int arg1, Action<NSError,NSObject> err);
bool RequiredReturnMethodObj (int arg1, Action<NSError, NSObject> err);
[Async (ResultTypeName = "RequiredReturnMethodObjResult")]
[Export ("optionalReturnObj:completion:")]
bool OptionalReturnMethodObj (int arg1, Action<NSError,NSObject> err);
bool OptionalReturnMethodObj (int arg1, Action<NSError, NSObject> err);
}
[BaseType (typeof (NSObject))]
interface RequiredReturnMethodObjResult {}
interface RequiredReturnMethodObjResult { }
}

Просмотреть файл

@ -4,7 +4,8 @@ using Foundation;
using ObjCRuntime;
namespace Bug53076WithModelTest {
[Protocol][Model]
[Protocol]
[Model]
[BaseType (typeof (NSObject))]
interface MyFooProtocol {
@ -29,13 +30,13 @@ namespace Bug53076WithModelTest {
[Abstract]
[Async (ResultTypeName = "RequiredReturnMethodObjResult")]
[Export ("requiredReturnMethodObj:completion:")]
bool RequiredReturnMethodObj (int arg1, Action<NSError,NSObject> err);
bool RequiredReturnMethodObj (int arg1, Action<NSError, NSObject> err);
[Async (ResultTypeName = "RequiredReturnMethodObjResult")]
[Export ("optionalReturnObj:completion:")]
bool OptionalReturnMethodObj (int arg1, Action<NSError,NSObject> err);
bool OptionalReturnMethodObj (int arg1, Action<NSError, NSObject> err);
}
[BaseType (typeof (NSObject))]
interface RequiredReturnMethodObjResult {}
interface RequiredReturnMethodObjResult { }
}

Просмотреть файл

@ -5,8 +5,7 @@ using Foundation;
namespace AudioUnit {
[StructLayout (LayoutKind.Sequential)]
public struct AURecordedParameterEvent
{
public struct AURecordedParameterEvent {
public ulong hostTime;
public ulong address;
public float value;

Просмотреть файл

@ -4,9 +4,8 @@ using System.Runtime.InteropServices;
using Foundation;
namespace AudioUnit {
[BaseType (typeof(NSObject))]
interface AUParameterNode
{
[BaseType (typeof (NSObject))]
interface AUParameterNode {
[Export ("tokenByAddingParameterRecordingObserver:")]
IntPtr TokenByAddingParameterRecordingObserver (AUParameterRecordingObserver observer);
}
@ -14,8 +13,7 @@ namespace AudioUnit {
public unsafe delegate void AUParameterRecordingObserver (int arg0, AURecordedParameterEvent arg1);
// Commenting this out "fixes" the problem
[BaseType (typeof(NSObject))]
interface AudioUnit
{
[BaseType (typeof (NSObject))]
interface AudioUnit {
}
}

Просмотреть файл

@ -2,13 +2,12 @@ using Foundation;
using ObjCRuntime;
using CoreBluetooth;
namespace Test
{
namespace Test {
[StrongDictionary ("AdvertisementDataKeys")]
interface AdvertisementData {
// property under tests, the generator should create a compilable property
NSDictionary <CBUUID, NSData> ServiceData { get; set; }
NSDictionary<CBUUID, NSData> ServiceData { get; set; }
}
[Static, Internal]

Просмотреть файл

@ -12,8 +12,10 @@ namespace GHIssue5444 {
new NSString ShapeScheme { get; set; }
NSString SemanticColorScheme {
[Wrap ("Runtime.GetNSObject<NSString> (ColorScheme.Handle, false)")] get;
[Wrap ("ColorScheme = value")] set;
[Wrap ("Runtime.GetNSObject<NSString> (ColorScheme.Handle, false)")]
get;
[Wrap ("ColorScheme = value")]
set;
}
}
}

Просмотреть файл

@ -8,8 +8,7 @@ namespace GHIssue6626 {
public delegate int AVAudioSourceNodeRenderBlock (bool isSilence, double timestamp, uint frameCount, ref AudioBuffers outputData);
[BaseType (typeof (NSObject))]
interface AVAudioSourceNode
{
interface AVAudioSourceNode {
[Export ("initWithRenderBlock:")]
[DesignatedInitializer]
IntPtr Constructor (AVAudioSourceNodeRenderBlock block);

Просмотреть файл

@ -10,8 +10,8 @@ namespace GH6863_method {
interface MyFooClass {
[Export ("stringMethod:")]
void StringMethod ([BindAs (typeof (string))] NSString[] id_test );
void StringMethod ([BindAs (typeof (string))] NSString [] id_test);
}
}

Просмотреть файл

@ -11,7 +11,7 @@ namespace GH6863_property {
[BindAs (typeof (string))]
[Export ("stringProp")]
NSString[] StringProp { get; }
NSString [] StringProp { get; }
}
}

Просмотреть файл

@ -4,7 +4,7 @@ using AppKit;
using CoreFoundation;
namespace GHIssue7304 {
[BaseType (typeof (NSObject))]
interface FooClass {

Просмотреть файл

@ -1,10 +1,8 @@
using Foundation;
using ObjCRuntime;
namespace Issue3875
{
namespace Issue3875 {
[Protocol, Model]
[BaseType (typeof(NSObject))]
interface AProtocol
{
[BaseType (typeof (NSObject))]
interface AProtocol {
}
}

Просмотреть файл

@ -1,10 +1,8 @@
using Foundation;
using ObjCRuntime;
namespace Issue3875
{
namespace Issue3875 {
[Protocol, Model (Name = "BProtocol")]
[BaseType (typeof(NSObject))]
interface AProtocol
{
[BaseType (typeof (NSObject))]
interface AProtocol {
}
}

Просмотреть файл

@ -1,14 +1,12 @@
using Foundation;
using ObjCRuntime;
namespace Issue3875
{
namespace Issue3875 {
#if NET
[Protocol, Model]
#else
[Protocol, Model (AutoGeneratedName = true)]
#endif
[BaseType (typeof(NSObject))]
interface AProtocol
{
[BaseType (typeof (NSObject))]
interface AProtocol {
}
}

Просмотреть файл

@ -1,11 +1,9 @@
using Foundation;
namespace Test
{
namespace Test {
[BaseType (typeof (NSObject))]
[Protocol, Model]
public interface NSTextInputClient
{
public interface NSTextInputClient {
// missing [Export ("selectRange")] should report an error
NSRange SelectedRange { get; }
}

Просмотреть файл

@ -14,6 +14,6 @@ namespace NoAsyncInternalWrapperTests {
[Async]
[Export ("optional:completion:")]
void OptionalMethod (int arg1, Action<NSError> err);
void OptionalMethod (int arg1, Action<NSError> err);
}
}

Просмотреть файл

@ -14,6 +14,6 @@ namespace nowarnTests {
[BaseType (typeof (NSObject))]
interface FooObject {
}
}

Просмотреть файл

@ -1,24 +1,20 @@
using Foundation;
namespace Test
{
namespace Test {
[BaseType (typeof (NSObject))]
[Protocol, Model]
public interface NSTextInputClient
{
public interface NSTextInputClient {
[Export ("selectedRange")]
NSRange SelectedRange { get; }
}
[BaseType (typeof (NSObject))]
interface NSText
{
interface NSText {
[Export ("selectedRange")]
NSRange SelectedRange { get; set; }
}
[BaseType (typeof (NSText))]
interface NSTextView : NSTextInputClient
{
interface NSTextView : NSTextInputClient {
}
}

Просмотреть файл

@ -1,24 +1,20 @@
using Foundation;
namespace Test
{
namespace Test {
[BaseType (typeof (NSObject))]
[Protocol, Model]
public interface NSTextInputClient
{
public interface NSTextInputClient {
[Export ("selectedRange")]
NSRange SelectedRange { get; }
}
[BaseType (typeof (NSObject))]
public interface NSText
{
public interface NSText {
[Export ("selectedRange")]
NSRange SelectedRange { get; set; }
}
[BaseType (typeof (NSText))]
public interface NSTextView : NSTextInputClient
{
public interface NSTextView : NSTextInputClient {
}
}

Просмотреть файл

@ -4,11 +4,9 @@ using System.Runtime.InteropServices;
using Foundation;
using ObjCRuntime;
namespace Test
{
namespace Test {
[Protocol]
public interface First
{
public interface First {
[Abstract]
[NullAllowed, Export ("identifier")]
string Identifier { set; }

Просмотреть файл

@ -4,11 +4,9 @@ using System.Runtime.InteropServices;
using Foundation;
using ObjCRuntime;
namespace Test
{
namespace Test {
[Protocol]
public interface First
{
public interface First {
[Abstract]
[NullAllowed, Export ("identifier")]
string Identifier { get; set; }

Просмотреть файл

@ -4,11 +4,9 @@ using System.Runtime.InteropServices;
using Foundation;
using ObjCRuntime;
namespace Test
{
namespace Test {
[Protocol]
public interface First
{
public interface First {
[Abstract]
[Export ("doit:itwith:more:")]
void DoIt (int a, int b, int c);

Просмотреть файл

@ -4,11 +4,9 @@ using System.Runtime.InteropServices;
using Foundation;
using ObjCRuntime;
namespace Test
{
namespace Test {
[Protocol]
public interface First
{
public interface First {
[Abstract]
[Export ("doit:withmore")]
void DoIt (int a, out int b);

Просмотреть файл

@ -4,11 +4,9 @@ using System.Runtime.InteropServices;
using Foundation;
using ObjCRuntime;
namespace Test
{
namespace Test {
[Protocol]
public interface First
{
public interface First {
[Abstract]
[Export ("doit:with:more:stuff")]
void DoIt (int a, int b, int c);

Просмотреть файл

@ -4,11 +4,9 @@ using System.Runtime.InteropServices;
using Foundation;
using ObjCRuntime;
namespace Test
{
namespace Test {
[Protocol]
public interface First
{
public interface First {
[Abstract]
[Export ("doit:with:more:")]
void DoIt (int a, int b, int c);

Просмотреть файл

@ -7,7 +7,7 @@ namespace SmartEnumWithFramework {
enum FooEnumTest {
[Field ("First", "+CoreImage")]
First,
[Field ("Second", "+CoreImage")]
Second,
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -7,7 +7,7 @@ namespace StrongDictsNativeEnums {
[Static]
interface SomeKeys {
[Field("NSSomeNativeKey", "__Internal")]
[Field ("NSSomeNativeKey", "__Internal")]
NSString TrackingLevelKey { get; }
}

Просмотреть файл

@ -1,9 +1,8 @@
using Foundation;
using ObjCRuntime;
namespace Test
{
namespace Test {
[StrongDictionary ("AdvertisementDataKeys")]
interface AdvertisementData {
// ensure that the generator continues to work with classic

Просмотреть файл

@ -3,4 +3,4 @@ global using Foundation;
namespace Root;
[BaseType (typeof (NSObject))]
interface IFace {}
interface IFace { }

Просмотреть файл

@ -1,117 +1,97 @@
using System;
using Foundation;
namespace DiamondProtocol
{
namespace A
{
namespace DiamondProtocol {
namespace A {
[Protocol]
interface P1
{
interface P1 {
[Abstract]
[Export ("p1")]
int P1 { get; }
}
[Protocol]
interface P2
{
interface P2 {
[Abstract]
[Export ("p1")]
int P1 { set; }
}
[Protocol]
interface C : P1, P2
{
interface C : P1, P2 {
}
}
namespace B
{
namespace B {
[Protocol]
interface P1
{
interface P1 {
[Abstract]
[Export ("p1")]
int P1 { get; }
}
[Protocol]
interface P2
{
interface P2 {
[Abstract]
[Export ("p1")]
int P1 { get; set; }
}
[Protocol]
interface C : P1, P2
{
interface C : P1, P2 {
}
}
namespace C
{
namespace C {
[Protocol]
interface P1
{
interface P1 {
[Abstract]
[Export ("p1")]
int P1 { get; set; }
}
[Protocol]
interface P2
{
interface P2 {
[Abstract]
[Export ("p1")]
long P1 { get; set; }
}
[Protocol]
interface C : P1, P2
{
interface C : P1, P2 {
}
}
namespace D
{
namespace D {
[Protocol]
interface P1
{
interface P1 {
[Abstract]
[Export ("pA")]
int P1 { get; set; }
}
[Protocol]
interface P2
{
interface P2 {
[Abstract]
[Export ("pB")]
int P1 { get; set; }
}
[Protocol]
interface C : P1, P2
{
interface C : P1, P2 {
}
}
namespace Z
{
namespace Z {
[Protocol]
interface P1
{
interface P1 {
[Abstract]
[Export ("m1")]
void M1 ();
}
[Protocol]
interface P2
{
interface P2 {
[Abstract]
[Export ("m1")]
int M1 ();
@ -120,25 +100,21 @@ namespace DiamondProtocol
//[BaseType (typeof (NSObject))]
[Protocol]
interface C : P1, P2
{
interface C : P1, P2 {
}
}
namespace Y
{
namespace Y {
[Protocol]
interface P1
{
interface P1 {
[Abstract]
[Export ("m1:")]
void M1 (int why);
}
[Protocol]
interface P2
{
interface P2 {
[Abstract]
[Export ("m1:")]
int M1 (bool because);
@ -147,8 +123,7 @@ namespace DiamondProtocol
//[BaseType (typeof (NSObject))]
[Protocol]
interface C : P1, P2
{
interface C : P1, P2 {
}
}
}

Просмотреть файл

@ -1,11 +1,9 @@
using System;
using Foundation;
namespace DiamondProtocol
{
namespace DiamondProtocol {
[Protocol]
interface P1
{
interface P1 {
[Abstract]
[Export ("p1")]
int P1 { get; }
@ -28,8 +26,7 @@ namespace DiamondProtocol
}
[Protocol]
interface P2
{
interface P2 {
[Abstract]
[Export ("p1")]
int P1 { get; }
@ -58,7 +55,6 @@ namespace DiamondProtocol
//[BaseType (typeof (NSObject))]
[Protocol]
interface C : P1, P2
{
interface C : P1, P2 {
}
}

Просмотреть файл

@ -4,33 +4,33 @@ using ObjCRuntime;
namespace NS {
// injecting custom code makes the Dispose method not-optimizable by default
[Dispose ("Console.WriteLine (\"Disposing!\");")]
[BaseType (typeof (NSObject))]
// injecting custom code makes the Dispose method not-optimizable by default
[Dispose ("Console.WriteLine (\"Disposing!\");")]
[BaseType (typeof (NSObject))]
interface WithDispose {
[Export ("delegate", ArgumentSemantic.Weak)]
[NullAllowed]
[NullAllowed]
NSObject WeakDelegate { get; set; }
}
// but we can opt-in to make it optimizable
[Dispose ("// just a comment, that's safe to optimize, if not very useful otherwise", Optimizable = true)]
[BaseType (typeof (NSObject))]
// but we can opt-in to make it optimizable
[Dispose ("// just a comment, that's safe to optimize, if not very useful otherwise", Optimizable = true)]
[BaseType (typeof (NSObject))]
interface WithDisposeOptInOptimizable {
[Export ("delegate", ArgumentSemantic.Weak)]
[NullAllowed]
[NullAllowed]
NSObject WeakDelegate { get; set; }
}
// if nothing is injected then we know we generate code that our tools can optimize
[BaseType (typeof (NSObject))]
// if nothing is injected then we know we generate code that our tools can optimize
[BaseType (typeof (NSObject))]
interface WithoutDispose {
// this ensure we have a Dispose method generated for the type
// this ensure we have a Dispose method generated for the type
[Export ("delegate", ArgumentSemantic.Weak)]
[NullAllowed]
[NullAllowed]
NSObject WeakDelegate { get; set; }
}
}

Просмотреть файл

@ -11,7 +11,8 @@ namespace NS {
interface S {
}
[Model][Protocol]
[Model]
[Protocol]
[BaseType (typeof (NSObject))]
interface P {
}

Просмотреть файл

@ -3,32 +3,32 @@ using Foundation;
using ObjCRuntime;
namespace NS {
[Native (ConvertToManaged = "Extensions.ToManaged1", ConvertToNative="Extensions.ToNative1")]
[Native (ConvertToManaged = "Extensions.ToManaged1", ConvertToNative = "Extensions.ToNative1")]
public enum MyEnum1 : long {
Value1,
Value2,
}
[Native (ConvertToManaged = "Extensions.ToManaged2", ConvertToNative="Extensions.ToNative2")]
[Native (ConvertToManaged = "Extensions.ToManaged2", ConvertToNative = "Extensions.ToNative2")]
public enum MyEnum2 : long {
Value1 = long.MinValue,
Value2 = long.MaxValue,
}
[Native (ConvertToManaged = "Extensions.ToManaged3", ConvertToNative="Extensions.ToNative3")]
[Native (ConvertToManaged = "Extensions.ToManaged3", ConvertToNative = "Extensions.ToNative3")]
public enum MyEnum3 : ulong {
Value1 = ulong.MinValue,
Value2 = ulong.MaxValue,
}
[Native (ConvertToManaged = "Extensions.ToManaged4", ConvertToNative="Extensions.ToNative4")]
[Native (ConvertToManaged = "Extensions.ToManaged4", ConvertToNative = "Extensions.ToNative4")]
public enum MyEnum4 : long {
Zero,
One,
Two
}
[Native (ConvertToManaged = "Extensions.ToManaged5", ConvertToNative="Extensions.ToNative5")]
[Native (ConvertToManaged = "Extensions.ToManaged5", ConvertToNative = "Extensions.ToNative5")]
public enum MyEnum5 : ulong {
Zero,
One,

Просмотреть файл

@ -5,16 +5,17 @@ using ObjCRuntime;
namespace NS {
[NoMacCatalyst]
[BaseType (typeof (NSObject), Delegates=new string [] { "Delegate" }, Events=new Type [] { typeof (NSTableViewDelegate)})]
[BaseType (typeof (NSObject), Delegates = new string [] { "Delegate" }, Events = new Type [] { typeof (NSTableViewDelegate) })]
partial interface NSTableView {
[NullAllowed]
[Export ("delegate")]
NSObject Delegate { get; set; }
}
[BaseType (typeof (NSObject))]
[Model][Protocol]
[Model]
[Protocol]
partial interface NSTableViewDelegate {
[Export ("row:"), DelegateName ("NSTableViewColumnRowPredicate"), DefaultValue (0)]
nint ShouldEditTableColumn (nint row);

Просмотреть файл

@ -7,9 +7,9 @@ namespace NS {
interface MyProtocol {
[Abstract]
[Export ("abstractProperty")]
bool AbstractProperty { [Bind ("isAbstractProperty")] get; set; }
bool AbstractProperty { [Bind ("isAbstractProperty")] get; set; }
[Export ("optionalProperty")]
bool OptionalProperty { [Bind ("isOptionalProperty")] get; set; }
bool OptionalProperty { [Bind ("isOptionalProperty")] get; set; }
}
}

Просмотреть файл

@ -3,11 +3,9 @@ using CoreFoundation;
using Foundation;
using ObjCRuntime;
namespace BI1064
{
namespace BI1064 {
[BaseType (typeof (NSObject))]
interface RefOutParameters
{
interface RefOutParameters {
[Export ("testCFBundle:a:b:")]
void TestCFBundle (int action, ref CFBundle refValue, out CFBundle outValue);
@ -33,16 +31,16 @@ namespace BI1064
void TestClass (int action, ref Class refValue, out Class outValue);
[Export ("testINSCodingArray:a:b:")]
void TestINSCodingArray (int action, ref INSCoding[] refValues, out INSCoding[] outValues);
void TestINSCodingArray (int action, ref INSCoding [] refValues, out INSCoding [] outValues);
[Export ("testNSObjectArray:a:b:")]
void TestNSObjectArray (int action, ref NSObject[] refValues, out NSObject[] outValues);
void TestNSObjectArray (int action, ref NSObject [] refValues, out NSObject [] outValues);
[Export ("testNSValueArray:a:b:")]
void TestNSValueArray (int action, ref NSValue[] refValues, out NSValue[] outValues);
void TestNSValueArray (int action, ref NSValue [] refValues, out NSValue [] outValues);
[Export ("testStringArray:a:b:")]
void TestStringArray (int action, ref string[] refStrings, out string[] outStrings);
void TestStringArray (int action, ref string [] refStrings, out string [] outStrings);
[Export ("testClassArray:a:b:")]
void TestClassArray (int action, ref Class [] refStrings, out Class [] outStrings);

Просмотреть файл

@ -1,11 +1,9 @@
using System;
using Foundation;
namespace NS
{
namespace NS {
[Protocol]
interface ProtocolWithReturnRelease
{
interface ProtocolWithReturnRelease {
[Abstract, Export ("newRequiredObject")]
[return: Release]
NSObject CreateRequiredObject ();

Просмотреть файл

@ -1,18 +1,15 @@
using System;
using Foundation;
namespace NS
{
namespace NS {
[BaseType (typeof (NSObject))]
interface OutNSObject
{
interface OutNSObject {
[Export ("func:")]
void Func (out ErrorObject error);
}
[BaseType (typeof (NSObject))]
interface ErrorObject
{
interface ErrorObject {
}
}

Просмотреть файл

@ -4,10 +4,10 @@ using ObjCRuntime;
using Foundation;
namespace WrapTest {
[BaseType (typeof (NSObject))]
interface MyFooClass {
[Export ("fooString")]
string FooString { get; }

Просмотреть файл

@ -15,6 +15,6 @@ namespace warnaserrorTests {
[BaseType (typeof (NSObject))]
interface FooObject {
}
}

Просмотреть файл

@ -39,6 +39,7 @@ dotnet format whitespace "$SRC_DIR/tests/xtro-sharpie/u2todo/u2todo.csproj"
dotnet format whitespace "$SRC_DIR/tests/xtro-sharpie/xtro-report/xtro-report.csproj"
dotnet format whitespace "$SRC_DIR/tests/xtro-sharpie/xtro-sanity/xtro-sanity.csproj"
dotnet format whitespace --folder "$SRC_DIR/tests/common"
dotnet format whitespace --folder "$SRC_DIR/tests/generator"
dotnet format whitespace --folder "$SRC_DIR/tests/monotouch-test"
dotnet format whitespace --folder "$SRC_DIR/tests/msbuild"
dotnet format whitespace --folder "$SRC_DIR/tests/xtro-sharpie"