forked from AuroraMiddleware/gtk
Merge branch 'backports-for-4-6' into 'gtk-4-6'
Avoid g_log_set_writer_func in tests See merge request GNOME/gtk!4773
This commit is contained in:
commit
41086f0756
@ -354,6 +354,7 @@ typedef struct {
|
||||
|
||||
typedef union {
|
||||
BroadwayReplyBase base;
|
||||
BroadwayReplySync sync;
|
||||
BroadwayReplyEvent event;
|
||||
BroadwayReplyQueryMouse query_mouse;
|
||||
BroadwayReplyNewSurface new_surface;
|
||||
|
@ -219,11 +219,7 @@ static void
|
||||
client_handle_request (BroadwayClient *client,
|
||||
BroadwayRequest *request)
|
||||
{
|
||||
BroadwayReplyNewSurface reply_new_surface;
|
||||
BroadwayReplySync reply_sync;
|
||||
BroadwayReplyQueryMouse reply_query_mouse;
|
||||
BroadwayReplyGrabPointer reply_grab_pointer;
|
||||
BroadwayReplyUngrabPointer reply_ungrab_pointer;
|
||||
BroadwayReply reply;
|
||||
guint32 before_serial, now_serial;
|
||||
guint32 global_id;
|
||||
int fd;
|
||||
@ -233,7 +229,7 @@ client_handle_request (BroadwayClient *client,
|
||||
switch (request->base.type)
|
||||
{
|
||||
case BROADWAY_REQUEST_NEW_SURFACE:
|
||||
reply_new_surface.id =
|
||||
reply.new_surface.id =
|
||||
broadway_server_new_surface (server, client->id,
|
||||
request->new_surface.x,
|
||||
request->new_surface.y,
|
||||
@ -241,9 +237,9 @@ client_handle_request (BroadwayClient *client,
|
||||
request->new_surface.height);
|
||||
client->surfaces =
|
||||
g_list_prepend (client->surfaces,
|
||||
GUINT_TO_POINTER (reply_new_surface.id));
|
||||
GUINT_TO_POINTER (reply.new_surface.id));
|
||||
|
||||
send_reply (client, request, (BroadwayReply *)&reply_new_surface, sizeof (reply_new_surface),
|
||||
send_reply (client, request, &reply, sizeof (reply.new_surface),
|
||||
BROADWAY_REPLY_NEW_SURFACE);
|
||||
break;
|
||||
case BROADWAY_REQUEST_FLUSH:
|
||||
@ -251,7 +247,7 @@ client_handle_request (BroadwayClient *client,
|
||||
break;
|
||||
case BROADWAY_REQUEST_SYNC:
|
||||
broadway_server_flush (server);
|
||||
send_reply (client, request, (BroadwayReply *)&reply_sync, sizeof (reply_sync),
|
||||
send_reply (client, request, &reply, sizeof (reply.sync),
|
||||
BROADWAY_REPLY_SYNC);
|
||||
break;
|
||||
case BROADWAY_REQUEST_ROUNDTRIP:
|
||||
@ -261,11 +257,11 @@ client_handle_request (BroadwayClient *client,
|
||||
break;
|
||||
case BROADWAY_REQUEST_QUERY_MOUSE:
|
||||
broadway_server_query_mouse (server,
|
||||
&reply_query_mouse.surface,
|
||||
&reply_query_mouse.root_x,
|
||||
&reply_query_mouse.root_y,
|
||||
&reply_query_mouse.mask);
|
||||
send_reply (client, request, (BroadwayReply *)&reply_query_mouse, sizeof (reply_query_mouse),
|
||||
&reply.query_mouse.surface,
|
||||
&reply.query_mouse.root_x,
|
||||
&reply.query_mouse.root_y,
|
||||
&reply.query_mouse.mask);
|
||||
send_reply (client, request, &reply, sizeof (reply.query_mouse),
|
||||
BROADWAY_REPLY_QUERY_MOUSE);
|
||||
break;
|
||||
case BROADWAY_REQUEST_DESTROY_SURFACE:
|
||||
@ -361,21 +357,21 @@ client_handle_request (BroadwayClient *client,
|
||||
request->move_resize.height);
|
||||
break;
|
||||
case BROADWAY_REQUEST_GRAB_POINTER:
|
||||
reply_grab_pointer.status =
|
||||
reply.grab_pointer.status =
|
||||
broadway_server_grab_pointer (server,
|
||||
client->id,
|
||||
request->grab_pointer.id,
|
||||
request->grab_pointer.owner_events,
|
||||
request->grab_pointer.event_mask,
|
||||
request->grab_pointer.time_);
|
||||
send_reply (client, request, (BroadwayReply *)&reply_grab_pointer, sizeof (reply_grab_pointer),
|
||||
send_reply (client, request, &reply, sizeof (reply.grab_pointer),
|
||||
BROADWAY_REPLY_GRAB_POINTER);
|
||||
break;
|
||||
case BROADWAY_REQUEST_UNGRAB_POINTER:
|
||||
reply_ungrab_pointer.status =
|
||||
reply.ungrab_pointer.status =
|
||||
broadway_server_ungrab_pointer (server,
|
||||
request->ungrab_pointer.time_);
|
||||
send_reply (client, request, (BroadwayReply *)&reply_ungrab_pointer, sizeof (reply_ungrab_pointer),
|
||||
send_reply (client, request, &reply, sizeof (reply.ungrab_pointer),
|
||||
BROADWAY_REPLY_UNGRAB_POINTER);
|
||||
break;
|
||||
case BROADWAY_REQUEST_FOCUS_SURFACE:
|
||||
|
@ -136,6 +136,7 @@ assert_icon_lookup_fails (const char *icon_name,
|
||||
}
|
||||
|
||||
static GList *lookups = NULL;
|
||||
static gboolean collecting_lookups = FALSE;
|
||||
|
||||
static GLogWriterOutput
|
||||
log_writer (GLogLevelFlags log_level,
|
||||
@ -147,6 +148,9 @@ log_writer (GLogLevelFlags log_level,
|
||||
const char *msg = NULL;
|
||||
int i;
|
||||
|
||||
if (!collecting_lookups)
|
||||
return g_log_writer_default (log_level, fields, n_fields, user_data);
|
||||
|
||||
for (i = 0; i < n_fields; i++)
|
||||
{
|
||||
if (strcmp (fields[i].key, "GLIB_DOMAIN") == 0)
|
||||
@ -177,22 +181,13 @@ assert_lookup_order (const char *icon_name,
|
||||
const char *first,
|
||||
...)
|
||||
{
|
||||
guint debug_flags;
|
||||
va_list args;
|
||||
const char *s;
|
||||
GtkIconPaintable *info;
|
||||
GList *l;
|
||||
|
||||
/* this hack is only usable in debug builds */
|
||||
#ifndef G_ENABLE_DEBUG
|
||||
g_assert_not_reached ();
|
||||
#endif
|
||||
|
||||
debug_flags = gtk_get_debug_flags ();
|
||||
gtk_set_debug_flags (debug_flags | GTK_DEBUG_ICONTHEME);
|
||||
g_log_set_writer_func (log_writer, NULL, NULL);
|
||||
|
||||
g_assert_null (lookups);
|
||||
collecting_lookups = TRUE;
|
||||
|
||||
if (fallbacks)
|
||||
{
|
||||
@ -208,7 +203,9 @@ assert_lookup_order (const char *icon_name,
|
||||
|
||||
if (info)
|
||||
g_object_unref (info);
|
||||
|
||||
|
||||
collecting_lookups = FALSE;
|
||||
|
||||
va_start (args, first);
|
||||
s = first;
|
||||
l = lookups;
|
||||
@ -224,9 +221,6 @@ assert_lookup_order (const char *icon_name,
|
||||
|
||||
g_list_free_full (lookups, g_free);
|
||||
lookups = NULL;
|
||||
|
||||
g_log_set_writer_func (g_log_writer_default, NULL, NULL);
|
||||
gtk_set_debug_flags (debug_flags);
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
@ -237,6 +231,136 @@ assert_lookup_order (const char *icon_name,
|
||||
return;
|
||||
#endif
|
||||
|
||||
static void
|
||||
test_lookup_order (void)
|
||||
{
|
||||
require_debug ();
|
||||
|
||||
if (g_test_subprocess ())
|
||||
{
|
||||
guint debug_flags;
|
||||
|
||||
debug_flags = gtk_get_debug_flags ();
|
||||
gtk_set_debug_flags (debug_flags | GTK_DEBUG_ICONTHEME);
|
||||
|
||||
g_log_set_writer_func (log_writer, NULL, NULL);
|
||||
|
||||
assert_lookup_order ("foo-bar-baz", 16, GTK_TEXT_DIR_NONE, 0, TRUE,
|
||||
"foo-bar-baz",
|
||||
"foo-bar",
|
||||
"foo",
|
||||
"foo-bar-baz-symbolic",
|
||||
"foo-bar-symbolic",
|
||||
"foo-symbolic",
|
||||
NULL);
|
||||
assert_lookup_order ("foo-bar-baz", 16, GTK_TEXT_DIR_RTL, 0, TRUE,
|
||||
"foo-bar-baz-rtl",
|
||||
"foo-bar-baz",
|
||||
"foo-bar-rtl",
|
||||
"foo-bar",
|
||||
"foo-rtl",
|
||||
"foo",
|
||||
"foo-bar-baz-symbolic-rtl",
|
||||
"foo-bar-baz-symbolic",
|
||||
"foo-bar-symbolic-rtl",
|
||||
"foo-bar-symbolic",
|
||||
"foo-symbolic-rtl",
|
||||
"foo-symbolic",
|
||||
NULL);
|
||||
assert_lookup_order ("foo-bar-baz", 16, GTK_TEXT_DIR_RTL, 0, FALSE,
|
||||
"foo-bar-baz-rtl",
|
||||
"foo-bar-baz",
|
||||
NULL);
|
||||
assert_lookup_order ("foo-bar-baz-symbolic", 16, GTK_TEXT_DIR_NONE, 0, TRUE,
|
||||
"foo-bar-baz-symbolic",
|
||||
"foo-bar-symbolic",
|
||||
"foo-symbolic",
|
||||
"foo-bar-baz",
|
||||
"foo-bar",
|
||||
"foo",
|
||||
NULL);
|
||||
|
||||
assert_lookup_order ("bla-bla", 16, GTK_TEXT_DIR_NONE, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE,
|
||||
"bla-bla-symbolic",
|
||||
"bla-symbolic",
|
||||
"bla-bla-symbolic", /* awkward */
|
||||
"bla-symbolic", /* awkward */
|
||||
"bla-bla",
|
||||
"bla",
|
||||
NULL);
|
||||
assert_lookup_order ("bla-bla-symbolic", 16, GTK_TEXT_DIR_NONE, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE,
|
||||
"bla-bla-symbolic",
|
||||
"bla-symbolic",
|
||||
"bla-bla-symbolic", /* awkward */
|
||||
"bla-symbolic", /* awkward */
|
||||
"bla-bla",
|
||||
"bla",
|
||||
NULL);
|
||||
|
||||
assert_lookup_order ("bar-baz", 16, GTK_TEXT_DIR_RTL, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE,
|
||||
"bar-baz-symbolic-rtl",
|
||||
"bar-baz-symbolic",
|
||||
"bar-symbolic-rtl",
|
||||
"bar-symbolic",
|
||||
"bar-baz-symbolic-rtl", /* awkward */
|
||||
"bar-baz-symbolic", /* awkward */
|
||||
"bar-symbolic-rtl", /* awkward */
|
||||
"bar-symbolic", /* awkward */
|
||||
"bar-baz-rtl",
|
||||
"bar-baz",
|
||||
"bar-rtl",
|
||||
"bar",
|
||||
NULL);
|
||||
assert_lookup_order ("bar-baz-symbolic", 16, GTK_TEXT_DIR_RTL, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE,
|
||||
"bar-baz-symbolic-rtl",
|
||||
"bar-baz-symbolic",
|
||||
"bar-symbolic-rtl",
|
||||
"bar-symbolic",
|
||||
"bar-baz-symbolic-rtl", /* awkward */
|
||||
"bar-baz-symbolic", /* awkward */
|
||||
"bar-symbolic-rtl", /* awkward */
|
||||
"bar-symbolic", /* awkward */
|
||||
"bar-baz-rtl",
|
||||
"bar-baz",
|
||||
"bar-rtl",
|
||||
"bar",
|
||||
NULL);
|
||||
|
||||
assert_lookup_order ("bar-baz", 16, GTK_TEXT_DIR_LTR, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE,
|
||||
"bar-baz-symbolic-ltr",
|
||||
"bar-baz-symbolic",
|
||||
"bar-symbolic-ltr",
|
||||
"bar-symbolic",
|
||||
"bar-baz-symbolic-ltr", /* awkward */
|
||||
"bar-baz-symbolic", /* awkward */
|
||||
"bar-symbolic-ltr", /* awkward */
|
||||
"bar-symbolic", /* awkward */
|
||||
"bar-baz-ltr",
|
||||
"bar-baz",
|
||||
"bar-ltr",
|
||||
"bar",
|
||||
NULL);
|
||||
assert_lookup_order ("bar-baz-symbolic", 16, GTK_TEXT_DIR_LTR, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE,
|
||||
"bar-baz-symbolic-ltr",
|
||||
"bar-baz-symbolic",
|
||||
"bar-symbolic-ltr",
|
||||
"bar-symbolic",
|
||||
"bar-baz-symbolic-ltr", /* awkward */
|
||||
"bar-baz-symbolic", /* awkward */
|
||||
"bar-symbolic-ltr", /* awkward */
|
||||
"bar-symbolic", /* awkward */
|
||||
"bar-baz-ltr",
|
||||
"bar-baz",
|
||||
"bar-ltr",
|
||||
"bar",
|
||||
NULL);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
g_test_trap_subprocess (NULL, 0, 0);
|
||||
g_test_trap_has_passed ();
|
||||
}
|
||||
|
||||
static void
|
||||
test_basics (void)
|
||||
@ -245,122 +369,6 @@ test_basics (void)
|
||||
assert_icon_lookup ("simple", 16, GTK_TEXT_DIR_NONE, 0, FALSE, "/icons/16x16/simple.png");
|
||||
}
|
||||
|
||||
static void
|
||||
test_lookup_order (void)
|
||||
{
|
||||
require_debug ();
|
||||
|
||||
assert_lookup_order ("foo-bar-baz", 16, GTK_TEXT_DIR_NONE, 0, TRUE,
|
||||
"foo-bar-baz",
|
||||
"foo-bar",
|
||||
"foo",
|
||||
"foo-bar-baz-symbolic",
|
||||
"foo-bar-symbolic",
|
||||
"foo-symbolic",
|
||||
NULL);
|
||||
assert_lookup_order ("foo-bar-baz", 16, GTK_TEXT_DIR_RTL, 0, TRUE,
|
||||
"foo-bar-baz-rtl",
|
||||
"foo-bar-baz",
|
||||
"foo-bar-rtl",
|
||||
"foo-bar",
|
||||
"foo-rtl",
|
||||
"foo",
|
||||
"foo-bar-baz-symbolic-rtl",
|
||||
"foo-bar-baz-symbolic",
|
||||
"foo-bar-symbolic-rtl",
|
||||
"foo-bar-symbolic",
|
||||
"foo-symbolic-rtl",
|
||||
"foo-symbolic",
|
||||
NULL);
|
||||
assert_lookup_order ("foo-bar-baz", 16, GTK_TEXT_DIR_RTL, 0, FALSE,
|
||||
"foo-bar-baz-rtl",
|
||||
"foo-bar-baz",
|
||||
NULL);
|
||||
assert_lookup_order ("foo-bar-baz-symbolic", 16, GTK_TEXT_DIR_NONE, 0, TRUE,
|
||||
"foo-bar-baz-symbolic",
|
||||
"foo-bar-symbolic",
|
||||
"foo-symbolic",
|
||||
"foo-bar-baz",
|
||||
"foo-bar",
|
||||
"foo",
|
||||
NULL);
|
||||
|
||||
assert_lookup_order ("bla-bla", 16, GTK_TEXT_DIR_NONE, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE,
|
||||
"bla-bla-symbolic",
|
||||
"bla-symbolic",
|
||||
"bla-bla-symbolic", /* awkward */
|
||||
"bla-symbolic", /* awkward */
|
||||
"bla-bla",
|
||||
"bla",
|
||||
NULL);
|
||||
assert_lookup_order ("bla-bla-symbolic", 16, GTK_TEXT_DIR_NONE, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE,
|
||||
"bla-bla-symbolic",
|
||||
"bla-symbolic",
|
||||
"bla-bla-symbolic", /* awkward */
|
||||
"bla-symbolic", /* awkward */
|
||||
"bla-bla",
|
||||
"bla",
|
||||
NULL);
|
||||
|
||||
assert_lookup_order ("bar-baz", 16, GTK_TEXT_DIR_RTL, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE,
|
||||
"bar-baz-symbolic-rtl",
|
||||
"bar-baz-symbolic",
|
||||
"bar-symbolic-rtl",
|
||||
"bar-symbolic",
|
||||
"bar-baz-symbolic-rtl", /* awkward */
|
||||
"bar-baz-symbolic", /* awkward */
|
||||
"bar-symbolic-rtl", /* awkward */
|
||||
"bar-symbolic", /* awkward */
|
||||
"bar-baz-rtl",
|
||||
"bar-baz",
|
||||
"bar-rtl",
|
||||
"bar",
|
||||
NULL);
|
||||
assert_lookup_order ("bar-baz-symbolic", 16, GTK_TEXT_DIR_RTL, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE,
|
||||
"bar-baz-symbolic-rtl",
|
||||
"bar-baz-symbolic",
|
||||
"bar-symbolic-rtl",
|
||||
"bar-symbolic",
|
||||
"bar-baz-symbolic-rtl", /* awkward */
|
||||
"bar-baz-symbolic", /* awkward */
|
||||
"bar-symbolic-rtl", /* awkward */
|
||||
"bar-symbolic", /* awkward */
|
||||
"bar-baz-rtl",
|
||||
"bar-baz",
|
||||
"bar-rtl",
|
||||
"bar",
|
||||
NULL);
|
||||
|
||||
assert_lookup_order ("bar-baz", 16, GTK_TEXT_DIR_LTR, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE,
|
||||
"bar-baz-symbolic-ltr",
|
||||
"bar-baz-symbolic",
|
||||
"bar-symbolic-ltr",
|
||||
"bar-symbolic",
|
||||
"bar-baz-symbolic-ltr", /* awkward */
|
||||
"bar-baz-symbolic", /* awkward */
|
||||
"bar-symbolic-ltr", /* awkward */
|
||||
"bar-symbolic", /* awkward */
|
||||
"bar-baz-ltr",
|
||||
"bar-baz",
|
||||
"bar-ltr",
|
||||
"bar",
|
||||
NULL);
|
||||
assert_lookup_order ("bar-baz-symbolic", 16, GTK_TEXT_DIR_LTR, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE,
|
||||
"bar-baz-symbolic-ltr",
|
||||
"bar-baz-symbolic",
|
||||
"bar-symbolic-ltr",
|
||||
"bar-symbolic",
|
||||
"bar-baz-symbolic-ltr", /* awkward */
|
||||
"bar-baz-symbolic", /* awkward */
|
||||
"bar-symbolic-ltr", /* awkward */
|
||||
"bar-symbolic", /* awkward */
|
||||
"bar-baz-ltr",
|
||||
"bar-baz",
|
||||
"bar-ltr",
|
||||
"bar",
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
test_generic_fallback (void)
|
||||
{
|
||||
@ -804,7 +812,6 @@ main (int argc, char *argv[])
|
||||
gtk_test_init (&argc, &argv);
|
||||
|
||||
g_test_add_func ("/icontheme/basics", test_basics);
|
||||
g_test_add_func ("/icontheme/lookup-order", test_lookup_order);
|
||||
g_test_add_func ("/icontheme/generic-fallback", test_generic_fallback);
|
||||
g_test_add_func ("/icontheme/force-symbolic", test_force_symbolic);
|
||||
g_test_add_func ("/icontheme/force-regular", test_force_regular);
|
||||
@ -815,6 +822,7 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/icontheme/list", test_list);
|
||||
g_test_add_func ("/icontheme/inherit", test_inherit);
|
||||
g_test_add_func ("/icontheme/nonsquare-symbolic", test_nonsquare_symbolic);
|
||||
g_test_add_func ("/icontheme/lookup-order", test_lookup_order);
|
||||
|
||||
return g_test_run();
|
||||
}
|
||||
|
@ -1049,30 +1049,26 @@ specific_bug_77977 (void)
|
||||
g_object_unref (tree_store);
|
||||
}
|
||||
|
||||
static GLogWriterOutput
|
||||
log_writer_drop_warnings (GLogLevelFlags log_level,
|
||||
const GLogField *fields,
|
||||
gsize n_fields,
|
||||
gpointer user_data)
|
||||
{
|
||||
return G_LOG_WRITER_HANDLED;
|
||||
}
|
||||
|
||||
static void
|
||||
specific_bug_698396 (void)
|
||||
{
|
||||
GtkTreeStore *tree_store;
|
||||
int new_order[1] = { 0 };
|
||||
|
||||
/*http://bugzilla.gnome.org/show_bug.cgi?id=698396 */
|
||||
|
||||
tree_store = gtk_tree_store_new (1, G_TYPE_STRING);
|
||||
if (g_test_subprocess ())
|
||||
{
|
||||
GtkTreeStore *tree_store;
|
||||
int new_order[1] = { 0 };
|
||||
|
||||
g_log_set_writer_func (log_writer_drop_warnings, NULL, NULL);
|
||||
gtk_tree_store_reorder (tree_store, NULL, new_order);
|
||||
g_log_set_writer_func (g_log_writer_default, NULL, NULL);
|
||||
tree_store = gtk_tree_store_new (1, G_TYPE_STRING);
|
||||
gtk_tree_store_reorder (tree_store, NULL, new_order);
|
||||
g_object_unref (tree_store);
|
||||
|
||||
g_object_unref (tree_store);
|
||||
return;
|
||||
}
|
||||
|
||||
g_test_trap_subprocess (NULL, 0, 0);
|
||||
g_test_trap_assert_stderr ("*Cannot reorder, parent has no children*");
|
||||
g_test_trap_assert_failed ();
|
||||
}
|
||||
|
||||
/* main */
|
||||
|
Loading…
Reference in New Issue
Block a user