mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-30 04:44:16 +02:00
gio, glib: Use G_OS_DARWIN for code that is for such environments
While we preserved the COCOA/CARBON cases when specific libraries are needed.
This commit is contained in:
@@ -58,7 +58,7 @@ test_guess (void)
|
||||
|
||||
/* Sadly win32 & OSX just don't have as large and robust of a mime type database as Linux */
|
||||
#ifndef G_OS_WIN32
|
||||
#ifndef __APPLE__
|
||||
#ifndef G_OS_DARWIN
|
||||
res = g_content_type_guess ("foo", data, sizeof (data) - 1, &uncertain);
|
||||
expected = g_content_type_from_mime_type ("text/plain");
|
||||
g_assert_content_type_equals (expected, res);
|
||||
@@ -111,7 +111,7 @@ test_guess (void)
|
||||
g_assert_false (uncertain);
|
||||
g_free (res);
|
||||
g_free (expected);
|
||||
#endif /* __APPLE__ */
|
||||
#endif /* G_OS_DARWIN */
|
||||
|
||||
res = g_content_type_guess (NULL, (guchar *)"%!PS-Adobe-2.0 EPSF-1.2", 23, &uncertain);
|
||||
expected = g_content_type_from_mime_type ("image/x-eps");
|
||||
@@ -175,7 +175,7 @@ test_list (void)
|
||||
gchar *plain;
|
||||
gchar *xml;
|
||||
|
||||
#ifdef __APPLE__
|
||||
#ifdef G_OS_DARWIN
|
||||
g_test_skip ("The OSX backend does not implement g_content_types_get_registered()");
|
||||
return;
|
||||
#endif
|
||||
@@ -250,7 +250,7 @@ test_icon (void)
|
||||
const gchar *const *names;
|
||||
|
||||
names = g_themed_icon_get_names (G_THEMED_ICON (icon));
|
||||
#ifdef __APPLE__
|
||||
#ifdef G_OS_DARWIN
|
||||
g_assert_true (g_strv_contains (names, "text-*"));
|
||||
#elif defined(G_OS_WIN32)
|
||||
g_assert_cmpuint (g_strv_length ((GStrv) names), >, 0);
|
||||
@@ -274,7 +274,7 @@ test_icon (void)
|
||||
g_assert_true (g_strv_contains (names, "text-x-generic"));
|
||||
#else
|
||||
g_assert_true (g_strv_contains (names, "application-rtf"));
|
||||
#ifndef __APPLE__
|
||||
#ifndef G_OS_DARWIN
|
||||
g_assert_true (g_strv_contains (names, "x-office-document"));
|
||||
#endif
|
||||
#endif
|
||||
@@ -298,7 +298,7 @@ test_symbolic_icon (void)
|
||||
const gchar *const *names;
|
||||
|
||||
names = g_themed_icon_get_names (G_THEMED_ICON (icon));
|
||||
#ifdef __APPLE__
|
||||
#ifdef G_OS_DARWIN
|
||||
g_assert_true (g_strv_contains (names, "text-*-symbolic"));
|
||||
g_assert_true (g_strv_contains (names, "text-*"));
|
||||
#else
|
||||
@@ -321,7 +321,7 @@ test_symbolic_icon (void)
|
||||
names = g_themed_icon_get_names (G_THEMED_ICON (icon));
|
||||
g_assert_true (g_strv_contains (names, "application-rtf-symbolic"));
|
||||
g_assert_true (g_strv_contains (names, "application-rtf"));
|
||||
#ifndef __APPLE__
|
||||
#ifndef G_OS_DARWIN
|
||||
g_assert_true (g_strv_contains (names, "x-office-document-symbolic"));
|
||||
g_assert_true (g_strv_contains (names, "x-office-document"));
|
||||
#endif
|
||||
@@ -344,7 +344,7 @@ test_tree (void)
|
||||
gchar **types;
|
||||
gsize i;
|
||||
|
||||
#if defined(__APPLE__) || defined(G_OS_WIN32)
|
||||
#if defined(G_OS_DARWIN) || defined(G_OS_WIN32)
|
||||
g_test_skip ("The OSX & Windows backends do not implement g_content_type_guess_for_tree()");
|
||||
return;
|
||||
#endif
|
||||
@@ -370,7 +370,7 @@ test_type_is_a_special_case (void)
|
||||
/* Everything but the inode type is application/octet-stream */
|
||||
res = g_content_type_is_a ("inode/directory", "application/octet-stream");
|
||||
g_assert_false (res);
|
||||
#if !defined(__APPLE__) && !defined(G_OS_WIN32)
|
||||
#if !defined(G_OS_DARWIN) && !defined(G_OS_WIN32)
|
||||
res = g_content_type_is_a ("anything", "application/octet-stream");
|
||||
g_assert_true (res);
|
||||
#endif
|
||||
@@ -388,7 +388,7 @@ test_guess_svg_from_data (void)
|
||||
gboolean uncertain = TRUE;
|
||||
gchar *res = g_content_type_guess (NULL, (guchar *)svgfilecontent,
|
||||
sizeof (svgfilecontent) - 1, &uncertain);
|
||||
#ifdef __APPLE__
|
||||
#ifdef G_OS_DARWIN
|
||||
g_assert_cmpstr (res, ==, "public.svg-image");
|
||||
#elif defined(G_OS_WIN32)
|
||||
g_test_skip ("svg type detection from content is not implemented on WIN32");
|
||||
@@ -402,7 +402,7 @@ test_guess_svg_from_data (void)
|
||||
static void
|
||||
test_mime_from_content (void)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
#ifdef G_OS_DARWIN
|
||||
gchar *mime_type;
|
||||
mime_type = g_content_type_get_mime_type ("com.microsoft.bmp");
|
||||
g_assert_cmpstr (mime_type, ==, "image/bmp");
|
||||
|
@@ -2472,7 +2472,7 @@ get_size_from_du (const gchar *path, guint64 *size)
|
||||
GError *error = NULL;
|
||||
gchar *du_path = NULL;
|
||||
|
||||
#ifndef HAVE_COCOA
|
||||
#ifndef G_OS_DARWIN
|
||||
du_path = g_find_program_in_path ("du");
|
||||
#endif
|
||||
|
||||
@@ -3499,7 +3499,7 @@ test_query_default_handler_uri (void)
|
||||
GFile *file;
|
||||
GFile *invalid_file;
|
||||
|
||||
#if defined(G_OS_WIN32) || defined(__APPLE__)
|
||||
#if defined(G_OS_WIN32) || defined(G_OS_DARWIN)
|
||||
g_test_skip ("Default URI handlers are not currently supported on Windows or macOS");
|
||||
return;
|
||||
#endif
|
||||
@@ -3556,7 +3556,7 @@ test_query_zero_length_content_type (void)
|
||||
NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
#ifndef HAVE_COCOA
|
||||
#ifndef G_OS_DARWIN
|
||||
g_assert_cmpstr (g_file_info_get_content_type (file_info), ==, "text/plain");
|
||||
#else
|
||||
g_assert_cmpstr (g_file_info_get_content_type (file_info), ==, "public.text");
|
||||
@@ -3580,7 +3580,7 @@ test_query_default_handler_file (void)
|
||||
const char buffer[] = "Text file!\n";
|
||||
const guint8 binary_buffer[] = "\xde\xad\xbe\xff";
|
||||
|
||||
#if defined(G_OS_WIN32) || defined(__APPLE__)
|
||||
#if defined(G_OS_WIN32) || defined(G_OS_DARWIN)
|
||||
g_test_skip ("Default URI handlers are not currently supported on Windows or macOS");
|
||||
return;
|
||||
#endif
|
||||
@@ -3676,7 +3676,7 @@ test_query_default_handler_file_async (void)
|
||||
const guint8 binary_buffer[] = "\xde\xad\xbe\xff";
|
||||
GError *error = NULL;
|
||||
|
||||
#if defined(G_OS_WIN32) || defined(__APPLE__)
|
||||
#if defined(G_OS_WIN32) || defined(G_OS_DARWIN)
|
||||
g_test_skip ("Default URI handlers are not currently supported on Windows or macOS");
|
||||
return;
|
||||
#endif
|
||||
@@ -3766,7 +3766,7 @@ test_query_default_handler_uri_async (void)
|
||||
GFile *file;
|
||||
GFile *invalid_file;
|
||||
|
||||
#if defined(G_OS_WIN32) || defined(__APPLE__)
|
||||
#if defined(G_OS_WIN32) || defined(G_OS_DARWIN)
|
||||
g_test_skip ("Default URI handlers are not currently supported on Windows or macOS");
|
||||
return;
|
||||
#endif
|
||||
|
@@ -247,7 +247,7 @@ assert_expected_uid_pid (InteropFlags flags,
|
||||
* on Linux. */
|
||||
g_assert_cmpint (uid, ==, getuid ());
|
||||
g_assert_cmpint (pid, ==, getpid ());
|
||||
#elif defined(__APPLE__)
|
||||
#elif defined(G_OS_DARWIN)
|
||||
/* We know (or at least suspect) that both GDBus and libdbus support
|
||||
* passing the uid only on macOS. */
|
||||
g_assert_cmpint (uid, ==, getuid ());
|
||||
|
Reference in New Issue
Block a user