Граф коммитов

17 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 36af029204
Change all null checking expressions to use 'is' and 'is not'. (#18176)
Change all null checking expressions to use 'is null' and 'is not null'
instead of '== null' and '!= null'.

This was mostly done with sed, so code can probably be improved in many
other ways with manual inspection, but that will come over time.

Also add code to the autoformat script to automatically fix these issues in the future.
2023-05-05 17:52:19 +02:00
Rolf Bjarne Kvinge 6f45caa84d
[autoformat] Add monotouch-test (#16701) 2022-11-10 17:59:26 +01:00
Rolf Bjarne Kvinge b169c806fc
[dotnet] Remove Runtime.Arch and ObjCRuntime.Arch from Mac Catalyst. Fixes #10312. (#13562)
Remove Runtime.Arch and ObjCRuntime.Arch from Mac Catalyst, because they don't
apply for a Mac Catalyst app (which is neither a simulator environment, nor a
device environment).

This means that code using these APIs will have to be re-evaluated to
determine what's the correct behavior for Mac Catalyst.

Also update our tests accordingly.

Fixes https://github.com/xamarin/xamarin-macios/issues/10312.
2021-12-15 22:32:14 +01:00
Manuel de la Pena cda8808fa2
[Tests] Ignore a number of tests that fail on a VM. Update README. (#12597) 2021-08-31 17:45:14 -04:00
Rolf Bjarne Kvinge 2972e1b715
Fix some whitespace issues in various files. (#12399)
* Remove BOM
* Add EOL at end of file.
2021-08-11 10:06:46 +02:00
Rolf Bjarne Kvinge 7ac3c658e0
[tests] Preserve all test fixtures. (#10870)
* [tests] Preserve all test fixtures.

This fixes the wildly diffetent number of tests when running xammac tests with and without linking.

Without linking:

> Tests run: 2446 Passed: 2321 Inconclusive: 9 Failed: 0 Ignored: 125

vs with linking:

> Tests run: 1885 Passed: 1802 Inconclusive: 4 Failed: 0 Ignored: 83

Now we run the same tests either with or without linking.

One test was updated to not fail when linking is enabled.

Also add a test to ensure all future test fixtures are preserved.

* Remove whitespace noise.
2021-03-16 15:15:30 +01:00
Rolf Bjarne Kvinge 2b96b9ac5f
[monotouch-test] Adjust tests based on Environment.OSVersion (#9291)
With Mono, Environment.OSVersion returns the macOS version when running in the
simulator. On Catalina, Mono returns 19.* as the Environment.OSVersion, which
means that the check for major version = 15 in the simulator turns out to be a
constant value now (since we don't support running in the simulator on a
4-year-old macOS version).

With .NET, Environment.OSVersion returns the iOS version instead, which means
that the check would have to be reworked.

However, since these version checks have effectively been constant for a few
years now, we can just remove the checks and the resulting unreachable code.
2020-08-07 07:57:40 +02:00
Rolf Bjarne Kvinge 0a5b72d64b [tests] Update attributes in tests according to breaking changes in NUnit[Lite]. 2020-08-03 11:53:17 +02:00
Rolf Bjarne Kvinge 2b2f1d08dc
[tests] Remove Classic code from all tests. (#8702) 2020-05-28 16:35:09 +02:00
Rolf Bjarne Kvinge f496904082
[tests] Fix tests on Catalina. (#7255)
* [monotouch-test] Percent-escape some local file paths. Fixes xamarin/maccore#2032.

Fixes this xammac test failure when the csproj has paths in its path:

    1) GetCaption (MonoTouchFixtures.MediaAccessibility.ImageCaptioningTest.GetCaption)
       System.Exception : Could not initialize an instance of the type 'Foundation.NSUrl': the native 'initWithString:' method returned nil.
    It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.
      at Foundation.NSObject.InitializeHandle (System.IntPtr handle, System.String initSelector) [0x000ab] in <c93a0a20c5e340cb9a858d96ecca3415>:0
      at Foundation.NSUrl..ctor (System.String urlString) [0x00044] in <c93a0a20c5e340cb9a858d96ecca3415>:0
      at MonoTouchFixtures.MediaAccessibility.ImageCaptioningTest.GetCaption () [0x00076] in <7a733573c3684923854270073138d4be>:0
      at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
      at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <9c0bd541400747ef85267f70e32bd8e4>:0

Fixes https://github.com/xamarin/maccore/issues/2032.

* [tests] Exclude MPS tests in the simulator on macOS 10.15+. Fixes xamarin/maccore#2030.

The simulator crashes when the app tests if MPS is supported...

Fixes https://github.com/xamarin/maccore/issues/2030.

* [tests] Remove 32-bit slice from macOS test libraries. Fixes xamarin/maccore#2031.

The 32-bit slice is causing a build failure on the bots:

    Task "Exec" (TaskId:35)
      Task Parameter:Command=make bin/SimpleClassDylib.dylib bin/SimpleClassStatic.a bin/Mobile-static/MobileBinding.dll (TaskId:35)
      Task Parameter:WorkingDirectory=/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/mmptest//../mac-binding-project/ (TaskId:35)
      make bin/SimpleClassDylib.dylib bin/SimpleClassStatic.a bin/Mobile-static/MobileBinding.dll (TaskId:35)
      In file included from ../common/mac/SimpleClass.m:1: (TaskId:35)
      In file included from ../common/mac/SimpleClass.h:1: (TaskId:35)
      In file included from /Applications/Xcode111.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13: (TaskId:35)
      In file included from /Applications/Xcode111.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:27: (TaskId:35)
      In file included from /Applications/Xcode111.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCollectionView.h:9: (TaskId:35)
    /Applications/Xcode111.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSViewController.h(247,39): error GF2D19E48: unknown type name 'NSExtensionContext'; did you mean 'NSAnimationContext'? [/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/tmp-test-dir/mmptest/mmptest.csproj]
      @property (nullable, readonly,retain) NSExtensionContext *extensionContext API_AVAILABLE(macos(10.10)); (TaskId:35)
                                            ^ (TaskId:35)
      /Applications/Xcode111.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSAnimationContext.h:18:12: note: 'NSAnimationContext' declared here (TaskId:35)
      @interface NSAnimationContext : NSObject (TaskId:35)
                 ^ (TaskId:35)
      In file included from ../common/mac/SimpleClass.m:1: (TaskId:35)
      In file included from ../common/mac/SimpleClass.h:1: (TaskId:35)
      In file included from /Applications/Xcode111.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13: (TaskId:35)
      In file included from /Applications/Xcode111.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:99: (TaskId:35)
      In file included from /Applications/Xcode111.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSharingServicePickerTouchBarItem.h:9: (TaskId:35)
    /Applications/Xcode111.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSharingService.h(181,119): error GC04982C4: expected a type [/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/tmp-test-dir/mmptest/mmptest.csproj]
      - (NSCloudKitSharingServiceOptions)optionsForSharingService:(NSSharingService *)cloudKitSharingService shareProvider:(NSItemProvider *)provider; (TaskId:35)
                                                                                                                            ^ (TaskId:35)
    /Applications/Xcode111.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSharingService.h(196,12): error G93352991: cannot find interface declaration for 'NSItemProvider' [/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/tmp-test-dir/mmptest/mmptest.csproj]
      @interface NSItemProvider (NSCloudKitSharing) (TaskId:35)
                 ^ (TaskId:35)
      In file included from ../common/mac/SimpleClass.m:1: (TaskId:35)
      In file included from ../common/mac/SimpleClass.h:1: (TaskId:35)
      In file included from /Applications/Xcode111.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13: (TaskId:35)
      In file included from /Applications/Xcode111.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:250: (TaskId:35)
    /Applications/Xcode111.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSItemProvider.h(16,12): error G93352991: cannot find interface declaration for 'NSItemProvider' [/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/tmp-test-dir/mmptest/mmptest.csproj]
      @interface NSItemProvider (NSItemSourceInfo) (TaskId:35)
                 ^ (TaskId:35)
      4 errors generated. (TaskId:35)
      make[1]: *** [bin/SimpleClass.i386.a] Error 1 (TaskId:35)

and since we don't need the 32-bit slice anymore, just remove it.

Fixes https://github.com/xamarin/maccore/issues/2031.
2019-10-19 00:01:53 +02:00
Manuel de la Pena 62480fb0e2
[Metal] If the device is not supported, skip certain tests. Fixes #3389 (#3444)
* [Metal] If the device is not supported, skip certain tests. Fixes #3389
2018-02-09 18:21:22 +01:00
Sebastien Pouliot dc7b19ce15
[tests] Confirm a device/sim support Metal before running MetalPerformanceShaders tests. Fixes #3237 (#3268)
https://github.com/xamarin/xamarin-macios/issues/3237
2018-01-19 11:21:21 -05:00
Sebastien Pouliot 07c24949c0
[tests][macos] Enable more tests to be executed on macOS (XM) (#3191)
Largely related to somewhat recent frameworks/API additions to XM

ExternalAccessory was added to macOS 10.13 (Xcode9) and can't be run before that (including on the jenkins sierra bots). Also enable that test on tvOS (which added support in Xcode8)
2018-01-10 20:58:49 -05:00
Vincent Dondain d7b7a6ea02 Merge branch 'xcode9.2' 2017-12-06 14:41:13 -05:00
Timothy Risi 87f9e23989 [MetalPerformanceShaders] Xcode 9 bindings (#3005)
* [MetalPerformanceShaders] Activate bindings for Xamarin.Mac and add n… (#2816)

* [MetalPerformaceShaders] Several MPSCnnKernel properties should be readonly (#2938)

The subclasses versions of the properties need Override, cannot be removed since it would break visibility for iOS 10

* Remove some [Model] attributes that sholdn't be needed

* Fix introspection test crashes

* More introspection fixes

* NN does not need to be PascalCased

Remove unneeded Models and BaseTypes

* PR Whitespace fixes and renamings

* Paste fail

* More fixes from PR comments

* [MPS] Adds new intro test, fixes ctors and xtro output

* Removes duplicated availability attributes.
* Removes obsoleted API from macOS since mps is new to it.
* Fixes xtro output.
* Adds missing API.
* Fixes parameterless ctors, some of them do not really work, found
  by our new intro test and disabled the one that seem to not make
  sense due to the presence of DesignatedInitializers.
* Fixes a selector typo.
* Adds new `ShouldNotExposeDefaultCtorTest` to intro.

ShouldNotExposeDefaultCtorTest
==============================

This test checks for types with a parameterless ctor that are subclasses
of `NSObject` and then cheks if the BaseType of said objects also expose
a parameterless ctor (all in .NET land), if this is not the case it reports
them and so they can manually audited. Also this test has the ability to
print alloc/init ObjC code by setting `genObjCTestCode` to `true` so you can
take this code into an Xcode project and easily tests the ctors.

It seems that xtro (sharpie) does not have a complete picture of when a ctor
must be exposed hence the hability to generate this code and manually test.

Right now this test is just enabled for MPS since it is the scope of this PR.
In the future it should be enabled for all other frameworks and the output be
manually audited.

* [MPS] Fixes premature collection possible in bindings (bug 59547) and implements feedback.

https://bugzilla.xamarin.com/show_bug.cgi?id=59547

* Fixes premature collection possible in bindings im MPSKernel.cs
* Fixes MPSImageHistogramTest from using deprecated API.
* Removes renamed selectors and typos from ApiSelectorTest and ApiTypoTest.

* [MPS] Reenable Copy API and DesignatedInitializer xtro feedback

* Implement more feedback

* More feedback
2017-11-28 14:29:05 -06:00
Timothy Risi 2926a13f7e
[test] Change monotouch-test and xammac_tests to use all .cs files in monotouch-test/ Fixes #60290 (#2930)
Exclude the registrar/trampoline generated files from xammac_tests
Remove CoreLocation.LocationTest since is covered by introspection
2017-10-31 08:09:21 -08:00
Rolf Bjarne Kvinge bc9a39fcb3 Add missing [MarshalDirective] attributes. (#2558)
* [bindings-generator] Improve build & project file.

* Add missing [MarshalDirective] attributes.

Add missing [MarshalDirective] attributes, which also requires implementing
support for out parameters in the binding generator, since one of the
signatures missing the [MarshalDirective] contains such an out parameter.

Also add tests for all the API I've added [MarshalDirective] to.

* [bindings-generator] Remove redundant if check.

* [monotouch-test] Rename file to end with 'Test.cs'.

* [tests] Fix a few build errors for Xamarin.Mac.
2017-08-29 14:59:24 +02:00