windows.globalization: Implement IGlobalizationPreferencesStatics::HomeGeographicRegion.
Returning the user default country. Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1b53ee3fce
commit
6cffc2dc1a
|
@ -225,8 +225,16 @@ static HRESULT STDMETHODCALLTYPE globalization_preferences_get_Languages(
|
||||||
static HRESULT STDMETHODCALLTYPE globalization_preferences_get_HomeGeographicRegion(
|
static HRESULT STDMETHODCALLTYPE globalization_preferences_get_HomeGeographicRegion(
|
||||||
IGlobalizationPreferencesStatics *iface, HSTRING* out)
|
IGlobalizationPreferencesStatics *iface, HSTRING* out)
|
||||||
{
|
{
|
||||||
FIXME("iface %p, out %p stub!\n", iface, out);
|
WCHAR country[16];
|
||||||
return E_NOTIMPL;
|
|
||||||
|
TRACE("iface %p, out %p.\n", iface, out);
|
||||||
|
|
||||||
|
if (!GetUserDefaultGeoName(country, 16))
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
|
TRACE("returning country %s\n", debugstr_w(country));
|
||||||
|
|
||||||
|
return WindowsCreateString(country, wcslen(country), out);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE globalization_preferences_get_WeekStartsOn(
|
static HRESULT STDMETHODCALLTYPE globalization_preferences_get_WeekStartsOn(
|
||||||
|
|
|
@ -55,14 +55,11 @@ static void test_GlobalizationPreferences(void)
|
||||||
BOOLEAN found;
|
BOOLEAN found;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
UINT32 len;
|
UINT32 len;
|
||||||
WCHAR *buf, locale[LOCALE_NAME_MAX_LENGTH], *country, *tmp;
|
WCHAR *buf, locale[LOCALE_NAME_MAX_LENGTH], country[16];
|
||||||
UINT32 i, size;
|
UINT32 i, size;
|
||||||
|
|
||||||
GetUserDefaultLocaleName(locale, LOCALE_NAME_MAX_LENGTH);
|
GetUserDefaultLocaleName(locale, LOCALE_NAME_MAX_LENGTH);
|
||||||
if ((tmp = wcsrchr(locale, '_'))) *tmp = 0;
|
GetUserDefaultGeoName(country, 16);
|
||||||
if (!(tmp = wcschr(locale, '-')) || (wcslen(tmp) > 3 && !(tmp = wcschr(tmp + 1, '-')))) country = wcsdup(L"US");
|
|
||||||
else country = wcsdup(tmp + 1);
|
|
||||||
GetUserDefaultLocaleName(locale, LOCALE_NAME_MAX_LENGTH);
|
|
||||||
|
|
||||||
hr = pRoInitialize(RO_INIT_MULTITHREADED);
|
hr = pRoInitialize(RO_INIT_MULTITHREADED);
|
||||||
ok(hr == S_OK, "RoInitialize failed, hr %#x\n", hr);
|
ok(hr == S_OK, "RoInitialize failed, hr %#x\n", hr);
|
||||||
|
@ -77,7 +74,6 @@ static void test_GlobalizationPreferences(void)
|
||||||
win_skip("%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w(class_name));
|
win_skip("%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w(class_name));
|
||||||
pWindowsDeleteString(str);
|
pWindowsDeleteString(str);
|
||||||
pRoUninitialize();
|
pRoUninitialize();
|
||||||
free(country);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,8 +97,7 @@ static void test_GlobalizationPreferences(void)
|
||||||
IAgileObject_Release(tmp_agile_object);
|
IAgileObject_Release(tmp_agile_object);
|
||||||
|
|
||||||
hr = IGlobalizationPreferencesStatics_get_HomeGeographicRegion(preferences_statics, &tmp_str);
|
hr = IGlobalizationPreferencesStatics_get_HomeGeographicRegion(preferences_statics, &tmp_str);
|
||||||
todo_wine ok(hr == S_OK, "IGlobalizationPreferencesStatics_get_HomeGeographicRegion failed, hr %#x\n", hr);
|
ok(hr == S_OK, "IGlobalizationPreferencesStatics_get_HomeGeographicRegion failed, hr %#x\n", hr);
|
||||||
if (FAILED(hr)) goto done;
|
|
||||||
|
|
||||||
buf = pWindowsGetStringRawBuffer(tmp_str, &len);
|
buf = pWindowsGetStringRawBuffer(tmp_str, &len);
|
||||||
ok(buf != NULL && len > 0, "WindowsGetStringRawBuffer returned buf %p, len %u\n", buf, len);
|
ok(buf != NULL && len > 0, "WindowsGetStringRawBuffer returned buf %p, len %u\n", buf, len);
|
||||||
|
@ -113,7 +108,8 @@ static void test_GlobalizationPreferences(void)
|
||||||
pWindowsDeleteString(tmp_str);
|
pWindowsDeleteString(tmp_str);
|
||||||
|
|
||||||
hr = IGlobalizationPreferencesStatics_get_Languages(preferences_statics, &languages);
|
hr = IGlobalizationPreferencesStatics_get_Languages(preferences_statics, &languages);
|
||||||
ok(hr == S_OK, "IGlobalizationPreferencesStatics_get_Languages failed, hr %#x\n", hr);
|
todo_wine ok(hr == S_OK, "IGlobalizationPreferencesStatics_get_Languages failed, hr %#x\n", hr);
|
||||||
|
if (FAILED(hr)) goto done;
|
||||||
|
|
||||||
hr = IVectorView_HSTRING_QueryInterface(languages, &IID_IInspectable, (void **)&tmp_inspectable);
|
hr = IVectorView_HSTRING_QueryInterface(languages, &IID_IInspectable, (void **)&tmp_inspectable);
|
||||||
ok(hr == S_OK, "IVectorView_HSTRING_QueryInterface failed, hr %#x\n", hr);
|
ok(hr == S_OK, "IVectorView_HSTRING_QueryInterface failed, hr %#x\n", hr);
|
||||||
|
@ -164,7 +160,6 @@ done:
|
||||||
pWindowsDeleteString(str);
|
pWindowsDeleteString(str);
|
||||||
|
|
||||||
pRoUninitialize();
|
pRoUninitialize();
|
||||||
free(country);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(globalization)
|
START_TEST(globalization)
|
||||||
|
|
Loading…
Reference in New Issue