-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[HealthKit] Add support for xcode13 beta4. (#12184)
- Loading branch information
1 parent
9eba3b4
commit dab0f2e
Showing
9 changed files
with
269 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
using ObjCRuntime; | ||
using Foundation; | ||
using HKQuantityRef = System.IntPtr; | ||
using NSErrorRef = System.IntPtr; | ||
|
||
#nullable enable | ||
|
||
namespace HealthKit { | ||
|
||
[Watch (8,0), iOS (15,0)] | ||
public static class HKAppleWalkingSteadiness | ||
{ | ||
|
||
[DllImport (Constants.HealthKitLibrary)] | ||
static extern bool HKAppleWalkingSteadinessClassificationForQuantity (HKQuantityRef value, out nint classificationOut, out NSErrorRef errorOut); | ||
|
||
public static bool TryGetClassification (HKQuantity value, out HKAppleWalkingSteadinessClassification? classification, out NSError? error) | ||
{ | ||
if (value == null) | ||
throw new ArgumentNullException (nameof (value)); | ||
classification = null; | ||
error = null; | ||
if (HKAppleWalkingSteadinessClassificationForQuantity (value.GetHandle (), out var classificationOut, out var errorPtr)) { | ||
classification = (HKAppleWalkingSteadinessClassification) (long) classificationOut; | ||
error = Runtime.GetNSObject<NSError> (errorPtr, false); | ||
return true; | ||
} | ||
return false; | ||
|
||
} | ||
|
||
[DllImport (Constants.HealthKitLibrary)] | ||
static extern HKQuantityRef HKAppleWalkingSteadinessMinimumQuantityForClassification (nint classification); | ||
|
||
public static HKQuantity GetMinimumQuantity (HKAppleWalkingSteadinessClassification classification) | ||
=> Runtime.GetNSObject<HKQuantity> (HKAppleWalkingSteadinessMinimumQuantityForClassification ((nint) (long) classification), false); | ||
|
||
[DllImport (Constants.HealthKitLibrary)] | ||
static extern HKQuantityRef HKAppleWalkingSteadinessMaximumQuantityForClassification (nint classification); | ||
|
||
public static HKQuantity GetMaximumQuantity (HKAppleWalkingSteadinessClassification classification) | ||
=> Runtime.GetNSObject<HKQuantity> (HKAppleWalkingSteadinessMaximumQuantityForClassification ((nint) (long) classification), false); | ||
} | ||
|
||
} |
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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// | ||
// | ||
// Unit tests for HKCategoryTypeIdentifier | ||
// | ||
// Authors: | ||
|
42 changes: 42 additions & 0 deletions
42
tests/monotouch-test/HealthKit/HKAppleWalkingSteadinessTest.cs
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,42 @@ | ||
#if HAS_HEALTHKIT | ||
|
||
using System; | ||
|
||
using Foundation; | ||
using HealthKit; | ||
using UIKit; | ||
using NUnit.Framework; | ||
|
||
namespace MonoTouchFixtures.HealthKit { | ||
|
||
[TestFixture] | ||
[Preserve (AllMembers = true)] | ||
public class HKAppleWalkingSteadinessTest { | ||
|
||
[SetUp] | ||
public void SetUp () | ||
{ | ||
TestRuntime.AssertXcodeVersion (13, 0); | ||
} | ||
|
||
[Test] | ||
public void TryGetClassificationTest () | ||
{ | ||
var max = HKAppleWalkingSteadiness.GetMaximumQuantity (HKAppleWalkingSteadinessClassification.Ok); | ||
Assert.True (HKAppleWalkingSteadiness.TryGetClassification (max, out var classification, out var error)); | ||
Assert.Null (error, "error"); | ||
Assert.AreEqual (classification, HKAppleWalkingSteadinessClassification.Ok, "classification"); | ||
} | ||
|
||
[Test] | ||
public void GetMinimumQuantityTest () | ||
=> Assert.NotNull (HKAppleWalkingSteadiness.GetMinimumQuantity (HKAppleWalkingSteadinessClassification.Ok)); | ||
|
||
[Test] | ||
public void GetMaximumQuantityTest () | ||
=> Assert.NotNull (HKAppleWalkingSteadiness.GetMaximumQuantity (HKAppleWalkingSteadinessClassification.Ok)); | ||
} | ||
} | ||
|
||
#endif // HAS_HEALTHKIT | ||
|
Oops, something went wrong.
dab0f2e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ [CI Build] Tests failed on Build ❌
Tests failed on Build.
API diff
✅ API Diff from stable
View API diff
API & Generator diff
ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)
Packages generated
View packages
Test results
7 tests failed, 217 tests passed.
Failed tests
Tests run: 2463 Passed: 2411 Inconclusive: 13 Failed: 1 Ignored: 51)
Tests run: 2460 Passed: 2408 Inconclusive: 13 Failed: 1 Ignored: 51)
Tests run: 2460 Passed: 2407 Inconclusive: 13 Failed: 1 Ignored: 52)
Tests run: 2460 Passed: 2406 Inconclusive: 13 Failed: 1 Ignored: 53)
Pipeline on Agent XAMBOT-1035.BigSur'
[HealthKit] Add support for xcode13 beta4. (#12184)
dab0f2e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.
Pipeline on Agent
[HealthKit] Add support for xcode13 beta4. (#12184)
dab0f2e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.
Pipeline on Agent
[HealthKit] Add support for xcode13 beta4. (#12184)
dab0f2e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Tests failed on macOS M1 - Mac Big Sur (11.5) ❌
Tests failed on M1 - Mac Big Sur (11.5).
Failed tests are:
Pipeline on Agent
[HealthKit] Add support for xcode13 beta4. (#12184)
dab0f2e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Tests passed on macOS Mac Mojave (10.14) ✅
Tests passed
All tests on macOS X Mac Mojave (10.14) passed.
Pipeline on Agent
[HealthKit] Add support for xcode13 beta4. (#12184)
dab0f2e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Tests passed on macOS Mac High Sierra (10.13) ✅
Tests passed
All tests on macOS X Mac High Sierra (10.13) passed.
Pipeline on Agent
[HealthKit] Add support for xcode13 beta4. (#12184)