Commit a26fb194 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

windows.globalization: Implement GeographicRegion_get_CodeTwoLetter.

parent fe467cf4
......@@ -95,8 +95,12 @@ static HRESULT WINAPI geographic_region_get_Code( IGeographicRegion *iface, HSTR
static HRESULT WINAPI geographic_region_get_CodeTwoLetter( IGeographicRegion *iface, HSTRING *value )
{
FIXME( "iface %p stub!\n", iface );
return E_NOTIMPL;
WCHAR buffer[LOCALE_NAME_MAX_LENGTH];
FIXME( "iface %p semi-stub!\n", iface );
if (!GetLocaleInfoEx( LOCALE_NAME_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, buffer, ARRAY_SIZE(buffer) )) return E_INVALIDARG;
return WindowsCreateString( buffer, wcslen( buffer ), value );
}
static HRESULT WINAPI geographic_region_get_CodeThreeLetter( IGeographicRegion *iface, HSTRING *value )
......
......@@ -317,8 +317,9 @@ static void test_GeographicRegion(void)
IGeographicRegionFactory *geographic_region_factory;
IGeographicRegion *geographic_region;
IActivationFactory *factory;
HSTRING str;
HSTRING str, expect_str;
HRESULT hr;
INT32 res;
LONG ref;
hr = WindowsCreateString( class_name, wcslen( class_name ), &str );
......@@ -344,6 +345,10 @@ static void test_GeographicRegion(void)
check_interface( geographic_region, &IID_IInspectable );
check_interface( geographic_region, &IID_IAgileObject );
hr = IGeographicRegion_get_CodeTwoLetter( geographic_region, &str );
ok( hr == S_OK, "got hr %#lx.\n", hr );
WindowsDeleteString( str );
ref = IGeographicRegion_Release( geographic_region );
ok( ref == 0, "got ref %ld.\n", ref );
......@@ -358,6 +363,16 @@ static void test_GeographicRegion(void)
if (hr == S_OK)
{
hr = WindowsCreateString( L"US", wcslen( L"US" ), &expect_str );
ok( hr == S_OK, "got hr %#lx.\n", hr );
hr = IGeographicRegion_get_CodeTwoLetter( geographic_region, &str );
ok( hr == S_OK, "got hr %#lx.\n", hr );
hr = WindowsCompareStringOrdinal( str, expect_str, &res );
ok( hr == S_OK, "got hr %#lx.\n", hr );
ok( !res, "got unexpected string %s.\n", debugstr_hstring(str) );
WindowsDeleteString( str );
WindowsDeleteString( expect_str );
ref = IGeographicRegion_Release( geographic_region );
ok( ref == 0, "got ref %ld.\n", ref );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment