Adjust tests to accommodate Win32 special cases.

This commit is contained in:
John Ralls committed 2025-09-12 16:30:49 -07:00
1 parent 26c0207060
commit 6fab138647
3 files changed
+24 -3

No files matched your search

+20 -1
View File
@@ -32,6 +32,11 @@
#ifdef MAC_INTEGRATION
#include <Foundation/Foundation.h>
#endif
#include <platform.h>
#if PLATFORM(WINDOWS)
#include <windows.h>
#include <Shlobj.h>
#endif
struct usr_confpath_strings_struct
{
@@ -69,7 +74,21 @@ const char *path_package = PROJECT_NAME;
static char*
test_get_userdatadir ()
{
#ifdef MAC_INTEGRATION
#ifdef G_OS_WIN32
/* Duplicate the override code in get_user_data_dir(). */
wchar_t path[MAX_PATH+1];
HRESULT hr;
LPITEMIDLIST pidl = NULL;
BOOL b;
hr = SHGetSpecialFolderLocation (NULL, CSIDL_APPDATA, &pidl);
if (hr == S_OK)
{
b = SHGetPathFromIDListW (pidl, path);
CoTaskMemFree (pidl);
}
return b ? g_utf16_to_utf8 (path, MAX_PATH, NULL, NULL, NULL) : NULL;
#elif defined(MAC_INTEGRATION)
char *retval = NULL;
NSFileManager*fm = [NSFileManager defaultManager];
NSArray* appSupportDir = [fm URLsForDirectory:NSApplicationSupportDirectory
@@ -438,7 +438,7 @@ test_offset(time64 start_time, int hour, int offset1, int offset2,
TEST(gnc_datetime_constructors, test_DST_start_transition_time)
{
#ifdef __MINGW32__
TimeZoneProvider tzp_can{"A.U.S Eastern Standard Time"};
TimeZoneProvider tzp_can{"AUS Eastern Standard Time"};
TimeZoneProvider tzp_la{"Pacific Standard Time"};
#else
TimeZoneProvider tzp_can("Australia/Canberra");
@@ -458,7 +458,7 @@ TEST(gnc_datetime_constructors, test_DST_start_transition_time)
TEST(gnc_datetime_constructors, test_DST_end_transition_time)
{
#ifdef __MINGW32__
TimeZoneProvider tzp_can{"A.U.S Eastern Standard Time"};
TimeZoneProvider tzp_can{"AUS Eastern Standard Time"};
TimeZoneProvider tzp_la{"Pacific Standard Time"};
#else
TimeZoneProvider tzp_can("Australia/Canberra");
@@ -293,6 +293,7 @@ TEST(gncnumeric_stream, output_stream)
GncNumeric rational_string(123, 456);
output << rational_string;
EXPECT_EQ("123/456", output.str());
#ifndef __WIN32 // gnu libstdc++ supports only the C locale
try
{
auto loc = std::locale("fr_FR.utf8");
@@ -321,6 +322,7 @@ TEST(gncnumeric_stream, output_stream)
output.str("");
output << decimal_string;
EXPECT_EQ("123,456", output.str());
#endif
output.str("");
output << rational_string;
EXPECT_EQ("123/456", output.str());