[tests] Move a calendar test from being macOS-specific to run on all platforms. Fixes #12468. (#18971)

By moving the test from a macOS-specific location to a general location, it
becomes obvious that the test behaves the same on all platforms (which the
issue was about: it looked like we had different behavior on macOS vs the
other platforms, and the issue requested validation that this was correct - by
running the test on all platforms, with no platform-specific code, it
demonstrates that there's no macOS-specific behavior).

Fixes https://github.com/xamarin/xamarin-macios/issues/12468.
This commit is contained in:
Rolf Bjarne Kvinge 2023-09-12 09:53:46 +02:00 коммит произвёл GitHub
Родитель ea8ad15db0
Коммит 059975888c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 20 добавлений и 7 удалений

Просмотреть файл

@ -163,6 +163,24 @@ namespace LinkAll {
Assert.True (default_value, "DefaultValue");
}
#if NET
static void Check (string calendarName, bool present)
{
var type = Type.GetType ("System.Globalization." + calendarName);
bool success = present == (type is not null);
Assert.AreEqual (present, type is not null, calendarName);
}
[Test]
public void Calendars ()
{
Check ("GregorianCalendar", true);
Check ("UmAlQuraCalendar", true);
Check ("HijriCalendar", true);
Check ("ThaiBuddhistCalendar", true);
}
#endif // NET
public enum CertificateProblem : long {
CertEXPIRED = 0x800B0101,
CertVALIDITYPERIODNESTING = 0x800B0102,

Просмотреть файл

@ -15,7 +15,7 @@ namespace LinkAllTests {
[TestFixture]
[Preserve (AllMembers = true)]
public class LinkAllTest {
#if !NET // this test is in a file shared with all platforms for .NET
static void Check (string calendarName, bool present)
{
var type = Type.GetType ("System.Globalization." + calendarName);
@ -27,16 +27,11 @@ namespace LinkAllTests {
public void Calendars ()
{
Check ("GregorianCalendar", true);
#if NET && __MACOS__ // I'm not sure if this is the expected behavior for macOS, or if it's a bug somewhere.
Check ("UmAlQuraCalendar", true);
Check ("HijriCalendar", true);
Check ("ThaiBuddhistCalendar", true);
#else
Check ("UmAlQuraCalendar", false);
Check ("HijriCalendar", false);
Check ("ThaiBuddhistCalendar", false);
#endif
}
#endif // !NET
[Test]
public void EnsureUIThreadException ()