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

34 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 6f45caa84d
[autoformat] Add monotouch-test (#16701) 2022-11-10 17:59:26 +01:00
Manuel de la Pena f2560aafe8
[AudioToolbox] Add support for xcode 14 beta6. (#15877) 2022-09-12 10:34:44 -04:00
Rolf Bjarne Kvinge 7ab734068c
[AudioUnit] Improve a few AudioUnit methods to return the error code. (#13730)
This makes it easier to figure out problems in consuming code, since it makes
it easier to identify where things start to go wrong.

Fixes https://github.com/xamarin/maccore/issues/2539.
2022-01-17 17:02:43 +01:00
Rolf Bjarne Kvinge 10ad084ec3
[AudioUnit] Create a GCHandle when AudioUnit.SetInputCallback is called. Fixes #13637. (#13673)
AudioUnit needs a GCHandle in the input callback, which means we have to create it
when SetInputCallback is called (like we already do for SetRenderCallback).

Fixes https://github.com/xamarin/xamarin-macios/issues/13637.
2022-01-12 20:52:03 +01:00
Rolf Bjarne Kvinge 16358a7963
[ObjCRuntime] Fix the DisposableObject.Owns property to return the correct value. Fixes #13646. (#13666)
* [ObjCRuntime] Fix the DisposableObject.Owns property to return the correct value. Fixes #13646.

Ops...

Also add tests to avoid more oopses.

Fixes https://github.com/xamarin/xamarin-macios/issues/13646.

* Update tests/monotouch-test/AudioToolbox/AudioConverterTest.cs

Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
2022-01-11 15:37:31 +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
Rolf Bjarne Kvinge 6fe346e004
[tests] Remove some dead code. (#13558) 2021-12-14 17:05:53 +01:00
Rolf Bjarne Kvinge 66e596e9d9
[tests] Change TestRuntime.CheckSystemVersion to take a ApplePlatform value instead of a PlatformName enum. (#13350)
The PlatformName enum will be removed from .NET soon.
2021-11-15 08:06:36 +01:00
Rolf Bjarne Kvinge f4a5bf2720
[SystemSound] Don't implement the INativeObject interface for .NET. (#13324)
The supposed handle for system sounds is an uint, which does not match the
IntPtr handle INativeObject uses, so remove the INativeObject interface from
the SystemSound class.
2021-11-10 11:41:50 +01:00
Manuel de la Pena 69be49194e
[Tests] Remove not needed usings in the AudioToolboc tests. (#13234) 2021-11-03 10:34:02 -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 60fa8c90fe
[monotouch-test] Check a few more permissions that sometimes make the app crash due to a TCC violation on Mac Catalyst. (#12134)
* [monotouch-test] Check a few more permissions that sometimes make the app crash due to a TCC violation on Mac Catalyst.

* [monotouch-test] Adjust CaptureDeviceTest to only verify camera permission for Audio+Video, any other value is not supported by the OS.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-07-23 09:08:25 +02:00
Rolf Bjarne Kvinge 4dd95f5e10
[monotouch-test] Use TestRuntime.RunAsync instead of AppDelegate.RunAsync so that the system sound tests work on macOS as well. (#11770)
* [monotouch-test] Use TestRuntime.RunAsync instead of AppDelegate.RunAsync so that the system sound tests work on macOS as well.

* [AudioToolbox] Don't use a generic Action type in a P/Invoke, CoreCLR doesn't support it.

Fixes these test failures:

    [FAIL] FromFile : System.Runtime.InteropServices.MarshalDirectiveException : Cannot marshal 'parameter #4': Non-blittable generic types cannot be marshaled.
    	   at AudioToolbox.SystemSound.AudioServicesAddSystemSoundCompletion(UInt32 soundId, IntPtr runLoop, IntPtr runLoopMode, Action`2 completionRoutine, IntPtr clientData)
    	   at AudioToolbox.SystemSound.AddSystemSoundCompletion(Action routine, CFRunLoop runLoop) in Xamarin.Mac.dll:token 0x600bfd4+0x2b
    	   at MonoTouchFixtures.AudioToolbox.SystemSoundTest.FromFile() in xamarin-macios/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs:line 40

    [FAIL] TestCallbackPlayAlert : System.ArgumentException : The specified Type must not be a generic type. (Parameter 'delegate')
           at System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegateInternal(Delegate d)
           at System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(Delegate d) in System.Private.CoreLib.dll:token 0x6004586+0xe
           at ObjCRuntime.BlockLiteral.SetupBlockImpl(Delegate trampoline, Delegate userDelegate, Boolean safe, String signature) in Xamarin.Mac.dll:token 0x6001306+0xb
           at ObjCRuntime.BlockLiteral.SetupBlock(Delegate trampoline, Delegate userDelegate, Boolean safe) in Xamarin.Mac.dll:token 0x6001305+0x5e
           at ObjCRuntime.BlockLiteral.SetupBlockUnsafe(Delegate trampoline, Delegate userDelegate) in Xamarin.Mac.dll:token 0x6001307+0x0
           at AudioToolbox.SystemSound.PlayAlertSound(Action onCompletion) in Xamarin.Mac.dll:token 0x600bfc8+0x20
           at MonoTouchFixtures.AudioToolbox.SystemSoundTest.<>c__DisplayClass3_1.<<TestCallbackPlayAlert>b__0>d.MoveNext() in xamarin-macios/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs:line 93
        --- End of stack trace from previous location ---
           at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__140_0(Object state) in System.Private.CoreLib.dll:token 0x6002d4d+0x0
           at Foundation.NSAsyncSynchronizationContextDispatcher.Apply() in Xamarin.Mac.dll:token 0x6016560+0x0
        --- End of stack trace from previous location ---
           at ObjCRuntime.Runtime.InvokeMethod(MethodBase method, Object instance, IntPtr native_parameters) in Xamarin.Mac.dll:token 0x60011d1+0x274
           at ObjCRuntime.Runtime.InvokeMethod(MonoObject* methodobj, MonoObject* instanceobj, IntPtr native_parameters) in Xamarin.Mac.dll:token 0x60011d0+0x0
           at ObjCRuntime.Runtime.bridge_runtime_invoke_method(MonoObject* method, MonoObject* instance, IntPtr parameters, IntPtr& exception_gchandle) in Xamarin.Mac.dll:token 0x6001124+0x26
           at ObjCRuntime.Messaging.void_objc_msgSend_IntPtr(IntPtr receiver, IntPtr selector, IntPtr arg1)
           at TestRuntime.RunAsync(DateTime timeout, Action action, Func`1 check_completed, NSImage imageToShow) in xamarin-macios/tests/common/mac/TestRuntime.macos.cs:line 18
           at MonoTouchFixtures.AudioToolbox.SystemSoundTest.TestCallbackPlayAlert() in xamarin-macios/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs:line 92

    [FAIL] TestCallbackPlaySystem : System.ArgumentException : The specified Type must not be a generic type. (Parameter 'delegate')
           at System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegateInternal(Delegate d)
           at System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(Delegate d) in System.Private.CoreLib.dll:token 0x6004586+0xe
           at ObjCRuntime.BlockLiteral.SetupBlockImpl(Delegate trampoline, Delegate userDelegate, Boolean safe, String signature) in Xamarin.Mac.dll:token 0x6001306+0xb
           at ObjCRuntime.BlockLiteral.SetupBlock(Delegate trampoline, Delegate userDelegate, Boolean safe) in Xamarin.Mac.dll:token 0x6001305+0x5e
           at ObjCRuntime.BlockLiteral.SetupBlockUnsafe(Delegate trampoline, Delegate userDelegate) in Xamarin.Mac.dll:token 0x6001307+0x0
           at AudioToolbox.SystemSound.PlaySystemSound(Action onCompletion) in Xamarin.Mac.dll:token 0x600bfca+0x20
           at MonoTouchFixtures.AudioToolbox.SystemSoundTest.<>c__DisplayClass2_1.<<TestCallbackPlaySystem>b__0>d.MoveNext() in xamarin-macios/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs:line 74
        --- End of stack trace from previous location ---
           at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__140_0(Object state) in System.Private.CoreLib.dll:token 0x6002d4d+0x0
           at Foundation.NSAsyncSynchronizationContextDispatcher.Apply() in Xamarin.Mac.dll:token 0x6016560+0x0
        --- End of stack trace from previous location ---
           at ObjCRuntime.Runtime.InvokeMethod(MethodBase method, Object instance, IntPtr native_parameters) in Xamarin.Mac.dll:token 0x60011d1+0x274
           at ObjCRuntime.Runtime.InvokeMethod(MonoObject* methodobj, MonoObject* instanceobj, IntPtr native_parameters) in Xamarin.Mac.dll:token 0x60011d0+0x0
           at ObjCRuntime.Runtime.bridge_runtime_invoke_method(MonoObject* method, MonoObject* instance, IntPtr parameters, IntPtr& exception_gchandle) in Xamarin.Mac.dll:token 0x6001124+0x26
           at ObjCRuntime.Messaging.void_objc_msgSend_IntPtr(IntPtr receiver, IntPtr selector, IntPtr arg1)
           at TestRuntime.RunAsync(DateTime timeout, Action action, Func`1 check_completed, NSImage imageToShow) in xamarin-macios/tests/common/mac/TestRuntime.macos.cs:line 18
           at MonoTouchFixtures.AudioToolbox.SystemSoundTest.TestCallbackPlaySystem() in xamarin-macios/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs:line 73
2021-06-02 18:19:25 +02:00
Rolf Bjarne Kvinge 7adbdb0437
[monotouch-test] Don't run SystemSound tests in the simulator. (#11763)
Sometimes they work, sometimes they don't.

Just ignore them to avoid unreliable test results.

Partial fix for #11504.
2021-06-02 07:49:11 +02:00
Rolf Bjarne Kvinge aa1bf71cd6 [monotouch-test] Make it work with Mac Catalyst.
* Fix system version checks to work properly on Mac Catalyst (which uses the macOS
  version as its system version).

* Add the framework-specific defines to the build for monotouch-test.csproj (using
  the generated response files), this way we can use them in the tests.

* Sprinkle conditionals in numerous places - I tried using either framework-specific
  or XAMCORE_3_0 whenever that made since (instead of using Mac Catalyst as a condition).

* Updated a few tests to use non-deprecated API (because the deprecated API often
  doesn't exist in Mac Catalyst).

* Also a few minor API fixes to make any corresponding tests compile.
2021-01-15 17:52:28 +01:00
Rolf Bjarne Kvinge 2b2f1d08dc
[tests] Remove Classic code from all tests. (#8702) 2020-05-28 16:35:09 +02:00
Manuel de la Pena 9d11429de3
[Tests] Fix AudioQueueTest.Properties test. (#7930)
From the documentation of
https://developer.apple.com/documentation/audiotoolbox/audio_converter_services?language=objc
I think we can deduce that we are hitting a 'hwiu' which is Hardware in
use. Could make sense if we did not clean up properly. Switching to use
the software implementation should fix the flacky test.

fixes: https://github.com/xamarin/maccore/issues/1614
2020-02-18 09:09:47 -05:00
monojenkins b27cdc7d47 [xcode11] [monotouch-test] Attempt to fix AudioQueueTest.ChannelAssignments (#6873)
Attempt to fix the usage of AudioQueue.ChannelAssignments so that it follows
Apple's (incomplete) documentation.

- Fixes https://github.com/xamarin/maccore/issues/1623.
2019-08-29 14:15:12 -04:00
Manuel de la Pena 1416e4a945
[AudioToolBox] [AudioUnit] Add support for Xcode 11 beta 1 & beta 2. (#6434)
Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
2019-07-02 15:55:24 +02:00
Manuel de la Pena 82d21bc211
[Tests] Fix failing tests on iOS 8. Fixes #4437 (#4592)
Some of the tests fail because the assert is looking at the wrong iOS
version. Looking at the API definitions:

* UIStackView - Available in iOS 9, not iOS 8.
* AudioServicesPlayAlertSoundWithCompletion - Available in iOS 9, not
iOS 8.

All the other tests reported in the issue pass.

Issue: https://github.com/xamarin/xamarin-macios/issues/4437
2018-08-08 16:14:04 +02:00
Rolf Bjarne Kvinge 1b12348e57 [tests] Refactor API to check/assert current OS version. 2018-07-04 12:35:15 +02:00
Rolf Bjarne Kvinge 5fbb714c09 [monotouch-test] Remove Classic tests and any version checks for versions earlier than the minimum deploymnent target. 2018-07-03 20:47:14 +02:00
Rolf Bjarne Kvinge 9703f17c91 [monotouch-test] Fix versions checks.
* Fix many version checks to be based on Xcode version instead of iOS version.
* Added/fixed a few expected values according to platform version to match behavior in older macOS versions.
2018-07-03 20:47:14 +02:00
Rolf Bjarne Kvinge 10c5bc10a9
[monotouch-test] Update permission checks. (#3067)
Apparently iOS 11 shows system dialogs for more API, so sprinkle permission
checks in more places.
2017-11-30 17:54:02 +01: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 1a0f0b6903 [AudioToolbox] Free the right GCHandle when failing to create an InputAudioQueue. Fixes #59911. (#2852)
When we fail to create an InputAudioQueue, we need to free the local GCHandle
we previously created, not the instance GCHandle where we'd put the local
GCHandle in case of success.

This fixes bug #59911 to throw the correct (invalid parameter) exception (and
not leak the local GCHandle either).

https://bugzilla.xamarin.com/show_bug.cgi?id=59911
2017-10-06 20:02:43 +02:00
Sebastien Pouliot 05eb96d0a7 Merge branch 'xcode9' into xcode9-master-merge 2017-09-15 11:05:30 -04:00
Sebastien Pouliot 3a33cef80f [audiounit] Audit (xtro) fixes for tvOS (#2635)
Availability attributes in non-generated files don't hide symbols/code.

reference:
!unknown-pinvoke! AudioUnitExtensionCopyComponentList bound
!unknown-pinvoke! AudioUnitExtensionSetComponentList bound

* [tests] Make sure tvOS tests don't use the (unexisting) API
2017-09-11 16:25:28 -04:00
Manuel de la Pena b7bd604162 [AudioToolbox] Update bindings to Xcode 9 beta3 (not later changes). (#2294) 2017-08-11 09:18:59 -04:00
Rolf Bjarne Kvinge d601a18199 [tests] Add support to xharness for excluding tests that require permission dialogs, and update monotouch-test accordingly. (#2418)
* [monotouch-test] Optionally ignore tests that show permission dialogs.

* [xharness] Add support for excluding tests that require permission dialogs.

* [xharness] Ignore introspection tests if we don't want permission dialogs.

Ignore introspection tests for now if we don't want permission dialogs, since
figuring out which API requires permissions is a tedious process (which we'll
eventually have to do though).
2017-08-03 18:58:04 +02:00
Rolf Bjarne Kvinge fc28b434c2 [monotouch-test] Fix SystemSoundTest.FromFile's audio file to not take 23s. Fixes #54236. (#1942)
In a6b9c28975 I fixed SystemSoundTest.FromFile
to not crash randomly, and at the same time I added an assert to ensure that
the playback completion handler is called properly, with a 10s timeout.

Which won't work, because the audio file is 23s long.

There's no need for a 23s audio file, so the fix is simple: cut the audio file
to 0.3s instead.

https://bugzilla.xamarin.com/show_bug.cgi?id=54236
2017-03-30 14:33:36 +02:00
Rolf Bjarne Kvinge a6b9c28975 [monotouch-test] Fix randomly crashing SystemSoundTest.FromFile to not get a callback after the sound was disposed. Fixes #52903. (#1893)
SystemSoundTest.FromFile was requesting to be called back when the sound
completed playback. This causes problems when the sound is disposed after it
has started playing, because in that case disposing it won't prevent the
callback from being called, but instead random InvalidCastExceptions / crashes
would occur.

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

* SystemSound.PlaySystemSound doesn't work in the simulator.

https://stackoverflow.com/a/24973240/183422
2017-03-22 16:55:55 -05:00
Timothy Risi 687aa6f25f Port monotouch-test suite to Xamarin.Mac (#1445)
* Port the Monotouch-test suite to run on Xamarin.Mac

Adds over 1300 new API tests for XM
2017-01-12 09:13:56 -09:00
Rolf Bjarne Kvinge ecfdea9508 [tests] Import 2016-05-26 15:06:52 +02:00