[Fix] Reorder the enum to the correct order (#15540)
Co-authored-by: TJ Lambert <tjlambert@microsoft.com>
This commit is contained in:
Родитель
af0b059176
Коммит
481e3ec53a
|
@ -171,10 +171,29 @@ namespace UserNotifications {
|
|||
[Native]
|
||||
public enum UNNotificationInterruptionLevel : long
|
||||
{
|
||||
Active,
|
||||
Critical,
|
||||
#if XAMCORE_5_0
|
||||
Passive,
|
||||
Active,
|
||||
TimeSensitive,
|
||||
Critical,
|
||||
#else
|
||||
[Obsolete ("Use 'Active2'.")]
|
||||
Active,
|
||||
[Obsolete ("Use 'Critical2'.")]
|
||||
Critical,
|
||||
[Obsolete ("Use 'Passive2'.")]
|
||||
Passive,
|
||||
[Obsolete ("Use 'TimeSensitive2'.")]
|
||||
TimeSensitive,
|
||||
#endif // XAMCORE_5_0
|
||||
|
||||
// Additional enum values to fix reordering - to be at the end of the enum
|
||||
#if !XAMCORE_5_0
|
||||
Active2 = Critical,
|
||||
Critical2 = TimeSensitive,
|
||||
Passive2 = Active,
|
||||
TimeSensitive2 = Passive,
|
||||
#endif // !XAMCORE_5_0
|
||||
}
|
||||
|
||||
[iOS (10, 0)]
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
using Foundation;
|
||||
using UserNotifications;
|
||||
|
||||
namespace MonoTouchFixtures.UserNotifications {
|
||||
|
||||
[TestFixture]
|
||||
[Preserve (AllMembers = true)]
|
||||
public class UNNotificationInterruptionLevelTest {
|
||||
|
||||
[Test]
|
||||
public void EnumTest ()
|
||||
{
|
||||
#if !XAMCORE_5_0
|
||||
/* Apple Docs order these enum values as:
|
||||
typedef NS_ENUM (NSUInteger, UNNotificationInterruptionLevel)
|
||||
{
|
||||
UNNotificationInterruptionLevelPassive,
|
||||
UNNotificationInterruptionLevelActive,
|
||||
UNNotificationInterruptionLevelTimeSensitive,
|
||||
UNNotificationInterruptionLevelCritical,
|
||||
} */
|
||||
Assert.AreEqual ( (int)UNNotificationInterruptionLevel.Passive2, 0);
|
||||
Assert.AreEqual ( (int)UNNotificationInterruptionLevel.Active2, 1);
|
||||
Assert.AreEqual ( (int)UNNotificationInterruptionLevel.TimeSensitive2, 2);
|
||||
Assert.AreEqual ( (int)UNNotificationInterruptionLevel.Critical2, 3);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче