testsuite/gtk: Add common_cflags to build

With a few exceptions.
This commit is contained in:
Timm Bäder 2020-03-07 15:16:36 +01:00
parent 7789d0e23f
commit 7553649c47
9 changed files with 47 additions and 39 deletions

View File

@ -1926,8 +1926,8 @@ test_add_objects (void)
GError *error; GError *error;
gint ret; gint ret;
GObject *obj; GObject *obj;
gchar *objects[2] = {"mainbox", NULL}; const gchar *objects[2] = {"mainbox", NULL};
gchar *objects2[3] = {"mainbox", "window2", NULL}; const gchar *objects2[3] = {"mainbox", "window2", NULL};
const gchar buffer[] = const gchar buffer[] =
"<interface>" "<interface>"
" <object class=\"GtkWindow\" id=\"window\">" " <object class=\"GtkWindow\" id=\"window\">"
@ -2356,7 +2356,7 @@ my_gtk_grid_class_init (MyGtkGridClass *klass)
} }
static void static void
test_template () test_template (void)
{ {
MyGtkGrid *my_gtk_grid; MyGtkGrid *my_gtk_grid;

View File

@ -1,6 +1,6 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
static char *icon_names[] = { static const char *icon_names[] = {
/*** Icons used in code or templates, sorted alphabetically ***/ /*** Icons used in code or templates, sorted alphabetically ***/
"audio-volume-high", "audio-volume-high",
"audio-volume-high-symbolic", "audio-volume-high-symbolic",

View File

@ -83,6 +83,12 @@ if os_unix
test_cargs += ['-DHAVE_UNIX_PRINT_WIDGETS'] test_cargs += ['-DHAVE_UNIX_PRINT_WIDGETS']
endif endif
foreach flag: common_cflags
if flag not in ['-Werror=missing-prototypes', '-Werror=missing-declarations', '-fvisibility=hidden']
test_cargs += flag
endif
endforeach
foreach t : tests foreach t : tests
test_name = t.get(0) test_name = t.get(0)
test_srcs = ['@0@.c'.format(test_name)] + t.get(1, []) test_srcs = ['@0@.c'.format(test_name)] + t.get(1, [])

View File

@ -115,6 +115,8 @@ gtk_tree_rbtree_test_dirty (GtkTreeRBTree *tree,
GtkTreeRBNode *node, GtkTreeRBNode *node,
gint expected_dirtyness) gint expected_dirtyness)
{ {
g_assert (node);
if (expected_dirtyness) if (expected_dirtyness)
{ {
g_assert (GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_COLUMN_INVALID) || g_assert (GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_COLUMN_INVALID) ||

View File

@ -51,8 +51,8 @@ recent_manager_add (void)
/* mime type is mandatory */ /* mime type is mandatory */
recent_data->mime_type = NULL; recent_data->mime_type = NULL;
recent_data->app_name = "testrecentchooser"; recent_data->app_name = (char *)"testrecentchooser";
recent_data->app_exec = "testrecentchooser %u"; recent_data->app_exec = (char *)"testrecentchooser %u";
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
{ {
res = gtk_recent_manager_add_full (manager, res = gtk_recent_manager_add_full (manager,
@ -62,9 +62,9 @@ recent_manager_add (void)
g_test_trap_assert_failed (); g_test_trap_assert_failed ();
/* app name is mandatory */ /* app name is mandatory */
recent_data->mime_type = "text/plain"; recent_data->mime_type = (char *)"text/plain";
recent_data->app_name = NULL; recent_data->app_name = NULL;
recent_data->app_exec = "testrecentchooser %u"; recent_data->app_exec = (char *)"testrecentchooser %u";
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
{ {
res = gtk_recent_manager_add_full (manager, res = gtk_recent_manager_add_full (manager,
@ -74,8 +74,8 @@ recent_manager_add (void)
g_test_trap_assert_failed (); g_test_trap_assert_failed ();
/* app exec is mandatory */ /* app exec is mandatory */
recent_data->mime_type = "text/plain"; recent_data->mime_type = (char *)"text/plain";
recent_data->app_name = "testrecentchooser"; recent_data->app_name = (char *)"testrecentchooser";
recent_data->app_exec = NULL; recent_data->app_exec = NULL;
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
{ {
@ -87,9 +87,9 @@ recent_manager_add (void)
G_GNUC_END_IGNORE_DEPRECATIONS; G_GNUC_END_IGNORE_DEPRECATIONS;
recent_data->mime_type = "text/plain"; recent_data->mime_type = (char *)"text/plain";
recent_data->app_name = "testrecentchooser"; recent_data->app_name = (char *)"testrecentchooser";
recent_data->app_exec = "testrecentchooser %u"; recent_data->app_exec = (char *)"testrecentchooser %u";
res = gtk_recent_manager_add_full (manager, res = gtk_recent_manager_add_full (manager,
uri, uri,
recent_data); recent_data);
@ -130,9 +130,9 @@ add_bulk (gpointer data_)
{ {
char *new_uri; char *new_uri;
data->mime_type = "text/plain"; data->mime_type = (char *)"text/plain";
data->app_name = "testrecentchooser"; data->app_name = (char *)"testrecentchooser";
data->app_exec = "testrecentchooser %u"; data->app_exec = (char *)"testrecentchooser %u";
if (g_test_verbose ()) if (g_test_verbose ())
g_print (G_STRLOC ": adding item %d\n", i); g_print (G_STRLOC ": adding item %d\n", i);
@ -295,9 +295,9 @@ recent_manager_purge (void)
g_assert (error == NULL); g_assert (error == NULL);
recent_data = g_slice_new0 (GtkRecentData); recent_data = g_slice_new0 (GtkRecentData);
recent_data->mime_type = "text/plain"; recent_data->mime_type = (char *)"text/plain";
recent_data->app_name = "testrecentchooser"; recent_data->app_name = (char *)"testrecentchooser";
recent_data->app_exec = "testrecentchooser %u"; recent_data->app_exec = (char *)"testrecentchooser %u";
gtk_recent_manager_add_full (manager, uri, recent_data); gtk_recent_manager_add_full (manager, uri, recent_data);
g_slice_free (GtkRecentData, recent_data); g_slice_free (GtkRecentData, recent_data);

View File

@ -59,73 +59,73 @@ keep_size (int direction,
static void static void
slide_right_animations () slide_right_animations (void)
{ {
keep_size (KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT, TRUE); keep_size (KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT, TRUE);
} }
static void static void
slide_right_no_animations () slide_right_no_animations (void)
{ {
keep_size (KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT, FALSE); keep_size (KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT, FALSE);
} }
static void static void
slide_left_animations () slide_left_animations (void)
{ {
keep_size (KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT, TRUE); keep_size (KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT, TRUE);
} }
static void static void
slide_left_no_animations () slide_left_no_animations (void)
{ {
keep_size (KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT, FALSE); keep_size (KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT, FALSE);
} }
static void static void
none_animations () none_animations (void)
{ {
keep_size (KEEP_WIDTH | KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_NONE, TRUE); keep_size (KEEP_WIDTH | KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_NONE, TRUE);
} }
static void static void
none_no_animations () none_no_animations (void)
{ {
keep_size (KEEP_WIDTH | KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_NONE, FALSE); keep_size (KEEP_WIDTH | KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_NONE, FALSE);
} }
static void static void
crossfade_animations() crossfade_animations (void)
{ {
keep_size (KEEP_WIDTH | KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_CROSSFADE, TRUE); keep_size (KEEP_WIDTH | KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_CROSSFADE, TRUE);
} }
static void static void
crossfade_no_animations () crossfade_no_animations (void)
{ {
keep_size (KEEP_WIDTH | KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_CROSSFADE, FALSE); keep_size (KEEP_WIDTH | KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_CROSSFADE, FALSE);
} }
static void static void
slide_down_animations () slide_down_animations (void)
{ {
keep_size (KEEP_WIDTH, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN, TRUE); keep_size (KEEP_WIDTH, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN, TRUE);
} }
static void static void
slide_down_no_animations () slide_down_no_animations (void)
{ {
keep_size (KEEP_WIDTH, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN, FALSE); keep_size (KEEP_WIDTH, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN, FALSE);
} }
static void static void
slide_up_animations () slide_up_animations (void)
{ {
keep_size (KEEP_WIDTH, GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP, TRUE); keep_size (KEEP_WIDTH, GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP, TRUE);
} }
static void static void
slide_up_no_animations () slide_up_no_animations (void)
{ {
keep_size (KEEP_WIDTH, GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP, FALSE); keep_size (KEEP_WIDTH, GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP, FALSE);
} }

View File

@ -22,7 +22,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
static void static void
test_empty_search () test_empty_search (void)
{ {
GtkTextBuffer *buffer; GtkTextBuffer *buffer;
GtkTextIter it, s, e; GtkTextIter it, s, e;

View File

@ -58,9 +58,9 @@ signal_name_to_string (SignalName signal)
case ROWS_REORDERED: case ROWS_REORDERED:
return "rows-reordered"; return "rows-reordered";
case LAST_SIGNAL:
default: default:
/* Fall through */ g_assert_not_reached ();
break;
} }
return "(unknown)"; return "(unknown)";

View File

@ -17,11 +17,11 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
void register_list_store_tests (); void register_list_store_tests (void);
void register_tree_store_tests (); void register_tree_store_tests (void);
void register_sort_model_tests (); void register_sort_model_tests (void);
void register_filter_model_tests (); void register_filter_model_tests (void);
void register_model_ref_count_tests (); void register_model_ref_count_tests (void);
/* /*
* Signal monitor * Signal monitor