Skip to content

Fixes #3592. DateField unit tests fail on macos.latest. #3602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions UnitTests/Views/DateFieldTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,6 @@ public void Typing_With_Selection_Normalize_Format ()
[Fact]
public void Using_All_Culture_StandardizeDateFormat ()
{
// BUGBUG: This is a workaround for the issue with the date separator in macOS. See https://github.com/gui-cs/Terminal.Gui/issues/3592
if (RuntimeInformation.IsOSPlatform (OSPlatform.OSX))
{
return;
}

CultureInfo cultureBackup = CultureInfo.CurrentCulture;

DateTime date = DateTime.Parse ("1/1/1971");
Expand All @@ -194,7 +188,10 @@ public void Using_All_Culture_StandardizeDateFormat ()
{
separator = separator.Replace ("\u200f", "");
}

else if (culture.Name == "ar-SA" && RuntimeInformation.IsOSPlatform (OSPlatform.OSX))
{
separator = " ";
}

string format = culture.DateTimeFormat.ShortDatePattern;
var df = new DateField (date);
Expand All @@ -207,6 +204,14 @@ public void Using_All_Culture_StandardizeDateFormat ()
case "ar-SA":
Assert.Equal ($" 04{separator}11{separator}1390", df.Text);

break;
case "en-SA" when RuntimeInformation.IsOSPlatform (OSPlatform.OSX):
Assert.Equal ($" 04{separator}11{separator}1390", df.Text);

break;
case "en-TH" when RuntimeInformation.IsOSPlatform (OSPlatform.OSX):
Assert.Equal ($" 01{separator}01{separator}2514", df.Text);

break;
case "th":
case "th-TH":
Expand Down
Loading