Skip to content
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

Add stubs for GetTimeZoneDisplayName and EnumCalendarInfo, enable tests #1

Merged
merged 2 commits into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
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
9 changes: 7 additions & 2 deletions eng/testing/tests.mobile.targets
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@
<AssemblySearchPaths Include="$(PublishDir)"/>
<WasmFilesToIncludeInFileSystem Include="@(ContentWithTargetPath)" />
<WasmFilesToIncludeInFileSystem Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.BuildReference)' == 'true'" />
<AssetSources Include="./" />
<Assets Include="icudt.dat" />
</ItemGroup>

<Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)')" Text="MicrosoftNetCoreAppRuntimePackRidDir=$(MicrosoftNetCoreAppRuntimePackRidDir) doesn't exist" />
<WasmAppBuilder
AppDir="$(BundleDir)"
Expand All @@ -134,7 +135,11 @@
MainJS="$(MonoProjectRoot)\wasm\runtime-test.js"
ExtraAssemblies="$(PublishDir)$(AssemblyName).dll"
FilesToIncludeInFileSystem="@(WasmFilesToIncludeInFileSystem)"
AssemblySearchPaths="@(AssemblySearchPaths)" />
AssemblySearchPaths="@(AssemblySearchPaths)"
AssetSources="@(AssetSources)"
Assets="@(Assets)" />
<Copy SourceFiles="$(ICU_REPO)\icu4c\source\data\out\tmp\icudt67l.dat"
DestinationFiles="$(BundleDir)\icudt.dat" SkipUnchangedFiles="true"/>
</Target>

<Target Name="AddTestRunnersToPublishedFiles"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Globalization;

internal static partial class Interop
{
internal static partial class Globalization
{
// Mono-WASM doesn't support managed callbacks for pinvokes yet
internal static bool EnumCalendarInfo(EnumCalendarInfoCallback callback, string localeName, CalendarId calendarId, CalendarDataType calendarDataType, IntPtr context) => false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Globalization;
using System.Runtime.InteropServices;

internal static partial class Interop
{
internal static partial class Globalization
{
[DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_EnumCalendarInfo")]
internal static extern bool EnumCalendarInfo(EnumCalendarInfoCallback callback, string localeName, CalendarId calendarId, CalendarDataType calendarDataType, IntPtr context);
}
}
3 changes: 0 additions & 3 deletions src/libraries/Common/src/Interop/Interop.Calendar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ internal delegate void EnumCalendarInfoCallback(
[DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetCalendarInfo")]
internal static extern unsafe ResultCode GetCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType calendarDataType, char* result, int resultCapacity);

[DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_EnumCalendarInfo")]
internal static extern bool EnumCalendarInfo(EnumCalendarInfoCallback callback, string localeName, CalendarId calendarId, CalendarDataType calendarDataType, IntPtr context);

[DllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetLatestJapaneseEra")]
internal static extern int GetLatestJapaneseEra();

Expand Down
28 changes: 28 additions & 0 deletions src/libraries/Common/src/Interop/Interop.TimeZoneInfo.Stub.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Runtime.InteropServices;

internal static partial class Interop
{
internal static partial class Globalization
{
// needs to be kept in sync with TimeZoneDisplayNameType in System.Globalization.Native
internal enum TimeZoneDisplayNameType
{
Generic = 0,
Standard = 1,
DaylightSavings = 2,
}

// Mono-WASM specific ICU doesn't contain timezone bits
// so an english fallback will be used instead.
internal static unsafe ResultCode GetTimeZoneDisplayName(
string localeName,
string timeZoneId,
TimeZoneDisplayNameType type,
char* result,
int resultLength) => ResultCode.UnknownError;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,12 @@
<Compile Include="$(CommonPath)Interop\Interop.Calendar.cs">
<Link>Common\Interop\Interop.Calendar.cs</Link>
</Compile>
<Compile Condition="'$(TargetsBrowser)' != 'true'" Include="$(CommonPath)Interop\Interop.Calendar.EnumCalendarInfo.cs">
<Link>Common\Interop\Interop.Calendar.EnumCalendarInfo.cs</Link>
</Compile>
<Compile Condition="'$(TargetsBrowser)' == 'true'" Include="$(CommonPath)Interop\Interop.Calendar.EnumCalendarInfo.Stub.cs">
<Link>Common\Interop\Interop.Calendar.EnumCalendarInfo.Stub.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Interop.Casing.cs">
<Link>Common\Interop\Interop.Casing.cs</Link>
</Compile>
Expand All @@ -1056,9 +1062,12 @@
<Compile Include="$(CommonPath)Interop\Interop.ResultCode.cs">
<Link>Common\Interop\Interop.ResultCode.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Interop.TimeZoneInfo.cs">
<Compile Condition="'$(TargetsBrowser)' != 'true'" Include="$(CommonPath)Interop\Interop.TimeZoneInfo.cs">
<Link>Common\Interop\Interop.TimeZoneInfo.cs</Link>
</Compile>
<Compile Condition="'$(TargetsBrowser)' == 'true'" Include="$(CommonPath)Interop\Interop.TimeZoneInfo.Stub.cs">
<Link>Common\Interop\Interop.TimeZoneInfo.Stub.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Interop.Utils.cs">
<Link>Common\Interop\Interop.Utils.cs</Link>
</Compile>
Expand Down
4 changes: 0 additions & 4 deletions src/libraries/tests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Diagnostics.Tracing\tests\System.Diagnostics.Tracing.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Drawing.Common\tests\System.Drawing.Common.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Formats.Asn1\tests\System.Formats.Asn1.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Globalization.Calendars\tests\CalendarTestWithConfigSwitch\System.Globalization.CalendarsWithConfigSwitch.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Globalization.Calendars\tests\System.Globalization.Calendars.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Globalization.Extensions\tests\System.Globalization.Extensions.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Globalization\tests\System.Globalization.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.IO.Compression.Brotli\tests\System.IO.Compression.Brotli.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.IO.Compression.ZipFile\tests\System.IO.Compression.ZipFile.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.IO.Compression\tests\System.IO.Compression.Tests.csproj" />
Expand Down