From 2af5fc3c561fd654e94d734d41ba1dc991c0d803 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 29 Mar 2022 07:51:40 +0200 Subject: [PATCH] [monotouch-test] Attempt to fix monotouch-tests on macOS 10.15. (#14520) --- .../HealthKit/CdaDocumentSampleTest.cs | 4 ++++ .../MediaAccessibility/ImageCaptioningTest.cs | 20 ++----------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/tests/monotouch-test/HealthKit/CdaDocumentSampleTest.cs b/tests/monotouch-test/HealthKit/CdaDocumentSampleTest.cs index 5fcf3f388c..39d41b2faf 100644 --- a/tests/monotouch-test/HealthKit/CdaDocumentSampleTest.cs +++ b/tests/monotouch-test/HealthKit/CdaDocumentSampleTest.cs @@ -37,7 +37,11 @@ namespace MonoTouchFixtures.HealthKit { Assert.That (details.ValidationError.Length, Is.EqualTo ((nint) 0), "Length"); } }; +#if __MACCATALYST__ + var throwsException = TestRuntime.CheckXcodeVersion (12, 0); +#else var throwsException = TestRuntime.CheckXcodeVersion (11, 0); +#endif if (throwsException) { #if NET diff --git a/tests/monotouch-test/MediaAccessibility/ImageCaptioningTest.cs b/tests/monotouch-test/MediaAccessibility/ImageCaptioningTest.cs index ba00c26cf5..bee771dc14 100644 --- a/tests/monotouch-test/MediaAccessibility/ImageCaptioningTest.cs +++ b/tests/monotouch-test/MediaAccessibility/ImageCaptioningTest.cs @@ -95,11 +95,7 @@ namespace MonoTouchFixtures.MediaAccessibility { Assert.Null (e, "ro / set / no error"); // weird, it can't be saved back to the file metadata var s = MAImageCaptioning.GetCaption (url, out e); -#if __MACCATALYST__ - if (true) { -#else if (TestRuntime.CheckXcodeVersion (12, TestRuntime.MinorXcode12APIMismatch)) { -#endif Assert.AreEqual ("xamarin", s, "ro / roundtrip 2"); } else { Assert.Null (s, "ro / roundtrip 3"); // not very surprising since Set can't save it @@ -108,11 +104,7 @@ namespace MonoTouchFixtures.MediaAccessibility { Assert.True (MAImageCaptioning.SetCaption (url, "xamarin", out e), "Set 2"); s = MAImageCaptioning.GetCaption (url, out e); -#if __MACCATALYST__ - if (true) { -#else if (TestRuntime.CheckXcodeVersion (12, TestRuntime.MinorXcode12APIMismatch)) { -#endif Assert.AreEqual ("xamarin", s, "ro / back to original"); } else { Assert.Null (s, "ro / back to original"); @@ -135,11 +127,7 @@ namespace MonoTouchFixtures.MediaAccessibility { Assert.Null (e, "rw / set / no error"); // weird, it can't be saved back to the file metadata var s = MAImageCaptioning.GetCaption (rw_url, out e); -#if __MACCATALYST__ - if (true) { -#else - if (TestRuntime.CheckXcodeVersion (12, TestRuntime.MinorXcode12APIMismatch)) { -#endif + if (TestRuntime.CheckXcodeVersion (12, TestRuntime.MinorXcode12APIMismatch)) { Assert.AreEqual ("xamarin", s, "rw / roundtrip"); // :) } else { Assert.Null (s, "rw / roundtrip"); // :( @@ -148,11 +136,7 @@ namespace MonoTouchFixtures.MediaAccessibility { Assert.True (MAImageCaptioning.SetCaption (rw_url, "xamarin", out e), "Set 2"); s = MAImageCaptioning.GetCaption (rw_url, out e); -#if __MACCATALYST__ - if (true) { -#else - if (TestRuntime.CheckXcodeVersion (12, TestRuntime.MinorXcode12APIMismatch)) { -#endif + if (TestRuntime.CheckXcodeVersion (12, TestRuntime.MinorXcode12APIMismatch)) { Assert.AreEqual ("xamarin", s, "rw / back to original"); } else { Assert.Null (s, "rw / back to original");