| 1 |
/* Gtk+ default value tests |
| 2 |
* Copyright (C) 2007 Christian Persch |
| 3 |
* 2007 Johan Dahlin |
| 4 |
* |
| 5 |
* This library is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU Library General Public |
| 7 |
* License as published by the Free Software Foundation; either |
| 8 |
* version 2 of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This library is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* Library General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU Library General Public |
| 16 |
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
#include <string.h> |
| 20 |
#include <gtk/gtk.h> |
| 21 |
#include <gtk/gtkunixprint.h> |
| 22 |
|
| 23 |
static void |
| 24 |
check_property (const char *output, |
| 25 |
GParamSpec *pspec, |
| 26 |
GValue *value) |
| 27 |
{ |
| 28 |
GValue default_value = G_VALUE_INIT; |
| 29 |
char *v, *dv, *msg; |
| 30 |
|
| 31 |
if (g_param_value_defaults (pspec, value)) |
| 32 |
return; |
| 33 |
|
| 34 |
g_value_init (&default_value, G_PARAM_SPEC_VALUE_TYPE (pspec)); |
| 35 |
g_param_value_set_default (pspec, &default_value); |
| 36 |
|
| 37 |
v = g_strdup_value_contents (value); |
| 38 |
dv = g_strdup_value_contents (&default_value); |
| 39 |
|
| 40 |
msg = g_strdup_printf ("%s %s.%s: %s != %s\n", |
| 41 |
output, |
| 42 |
g_type_name (pspec->owner_type), |
| 43 |
pspec->name, |
| 44 |
dv, v); |
| 45 |
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, |
| 46 |
G_STRFUNC, msg); |
| 47 |
g_free (msg); |
| 48 |
|
| 49 |
g_free (v); |
| 50 |
g_free (dv); |
| 51 |
g_value_unset (&default_value); |
| 52 |
} |
| 53 |
|
| 54 |
static void |
| 55 |
test_type (gconstpointer data) |
| 56 |
{ |
| 57 |
GObjectClass *klass; |
| 58 |
GObject *instance; |
| 59 |
GParamSpec **pspecs; |
| 60 |
guint n_pspecs, i; |
| 61 |
GType type; |
| 62 |
GdkDisplay *display; |
| 63 |
|
| 64 |
type = * (GType *) data; |
| 65 |
|
| 66 |
display = gdk_display_get_default (); |
| 67 |
|
| 68 |
if (!G_TYPE_IS_CLASSED (type)) |
| 69 |
return; |
| 70 |
|
| 71 |
if (G_TYPE_IS_ABSTRACT (type)) |
| 72 |
return; |
| 73 |
|
| 74 |
if (!g_type_is_a (type, G_TYPE_OBJECT)) |
| 75 |
return; |
| 76 |
|
| 77 |
/* These can't be freely constructed/destroyed */ |
| 78 |
if (g_type_is_a (type, GTK_TYPE_APPLICATION) || |
| 79 |
g_type_is_a (type, GDK_TYPE_PIXBUF_LOADER) || |
| 80 |
g_type_is_a (type, GDK_TYPE_DRAWING_CONTEXT) || |
| 81 |
#ifdef G_OS_UNIX |
| 82 |
g_type_is_a (type, GTK_TYPE_PRINT_JOB) || |
| 83 |
#endif |
| 84 |
g_type_is_a (type, gdk_pixbuf_simple_anim_iter_get_type ()) || |
| 85 |
g_str_equal (g_type_name (type), "GdkX11DeviceManagerXI2") || |
| 86 |
g_str_equal (g_type_name (type), "GdkX11DeviceManagerCore") || |
| 87 |
g_str_equal (g_type_name (type), "GdkX11Display") || |
| 88 |
g_str_equal (g_type_name (type), "GdkX11DisplayManager") || |
| 89 |
g_str_equal (g_type_name (type), "GdkX11Screen") || |
| 90 |
g_str_equal (g_type_name (type), "GdkX11GLContext")) |
| 91 |
return; |
| 92 |
|
| 93 |
/* This throws a critical when the connection is dropped */ |
| 94 |
if (g_type_is_a (type, GTK_TYPE_APP_CHOOSER_DIALOG)) |
| 95 |
return; |
| 96 |
|
| 97 |
/* pixbufs without pixel data are just pointless */ |
| 98 |
if (g_type_is_a (type, GDK_TYPE_PIXBUF)) |
| 99 |
return; |
| 100 |
|
| 101 |
/* These leak their GDBusConnections */ |
| 102 |
if (g_type_is_a (type, GTK_TYPE_FILE_CHOOSER_BUTTON) || |
| 103 |
g_type_is_a (type, GTK_TYPE_FILE_CHOOSER_DIALOG) || |
| 104 |
g_type_is_a (type, GTK_TYPE_FILE_CHOOSER_WIDGET) || |
| 105 |
g_type_is_a (type, GTK_TYPE_PLACES_SIDEBAR)) |
| 106 |
return; |
| 107 |
|
| 108 |
klass = g_type_class_ref (type); |
| 109 |
|
| 110 |
if (g_type_is_a (type, GTK_TYPE_SETTINGS)) |
| 111 |
instance = G_OBJECT (g_object_ref (gtk_settings_get_default ())); |
| 112 |
else if (g_type_is_a (type, GDK_TYPE_WINDOW)) |
| 113 |
{ |
| 114 |
GdkWindowAttr attributes; |
| 115 |
attributes.wclass = GDK_INPUT_OUTPUT; |
| 116 |
attributes.window_type = GDK_WINDOW_TEMP; |
| 117 |
attributes.event_mask = 0; |
| 118 |
attributes.width = 100; |
| 119 |
attributes.height = 100; |
| 120 |
instance = G_OBJECT (g_object_ref (gdk_window_new (NULL, &attributes, 0))); |
| 121 |
} |
| 122 |
else if (g_str_equal (g_type_name (type), "GdkX11Cursor")) |
| 123 |
instance = g_object_new (type, "display", display, NULL); |
| 124 |
else |
| 125 |
instance = g_object_new (type, NULL); |
| 126 |
|
| 127 |
if (g_type_is_a (type, G_TYPE_INITIALLY_UNOWNED)) |
| 128 |
g_object_ref_sink (instance); |
| 129 |
|
| 130 |
pspecs = g_object_class_list_properties (klass, &n_pspecs); |
| 131 |
for (i = 0; i < n_pspecs; ++i) |
| 132 |
{ |
| 133 |
GParamSpec *pspec = pspecs[i]; |
| 134 |
GValue value = G_VALUE_INIT; |
| 135 |
|
| 136 |
if (pspec->owner_type != type) |
| 137 |
continue; |
| 138 |
|
| 139 |
if ((pspec->flags & G_PARAM_READABLE) == 0) |
| 140 |
continue; |
| 141 |
|
| 142 |
/* This one has a special-purpose default value */ |
| 143 |
if (g_type_is_a (type, GTK_TYPE_DIALOG) && |
| 144 |
(strcmp (pspec->name, "use-header-bar") == 0)) |
| 145 |
continue; |
| 146 |
|
| 147 |
if (g_type_is_a (type, GTK_TYPE_ASSISTANT) && |
| 148 |
(strcmp (pspec->name, "use-header-bar") == 0)) |
| 149 |
continue; |
| 150 |
|
| 151 |
if (g_type_is_a (type, GTK_TYPE_POPOVER) && |
| 152 |
(strcmp (pspec->name, "pointing-to") == 0)) |
| 153 |
continue; |
| 154 |
|
| 155 |
if (g_type_is_a (type, GDK_TYPE_DISPLAY_MANAGER) && |
| 156 |
(strcmp (pspec->name, "default-display") == 0)) |
| 157 |
continue; |
| 158 |
|
| 159 |
if (g_type_is_a (type, GDK_TYPE_MONITOR) && |
| 160 |
(strcmp (pspec->name, "geometry") == 0 || |
| 161 |
strcmp (pspec->name, "workarea") == 0)) |
| 162 |
continue; |
| 163 |
|
| 164 |
if (g_type_is_a (type, GTK_TYPE_ABOUT_DIALOG) && |
| 165 |
(strcmp (pspec->name, "program-name") == 0)) |
| 166 |
continue; |
| 167 |
|
| 168 |
/* These are set to the current date */ |
| 169 |
if (g_type_is_a (type, GTK_TYPE_CALENDAR) && |
| 170 |
(strcmp (pspec->name, "year") == 0 || |
| 171 |
strcmp (pspec->name, "month") == 0 || |
| 172 |
strcmp (pspec->name, "day") == 0)) |
| 173 |
continue; |
| 174 |
|
| 175 |
if (g_type_is_a (type, GTK_TYPE_CELL_AREA_CONTEXT) && |
| 176 |
(strcmp (pspec->name, "minimum-width") == 0 || |
| 177 |
strcmp (pspec->name, "minimum-height") == 0 || |
| 178 |
strcmp (pspec->name, "natural-width") == 0 || |
| 179 |
strcmp (pspec->name, "natural-height") == 0)) |
| 180 |
continue; |
| 181 |
|
| 182 |
if (g_type_is_a (type, GTK_TYPE_CELL_RENDERER_TEXT) && |
| 183 |
(strcmp (pspec->name, "background-gdk") == 0 || |
| 184 |
strcmp (pspec->name, "foreground-gdk") == 0 || |
| 185 |
strcmp (pspec->name, "background-rgba") == 0 || |
| 186 |
strcmp (pspec->name, "foreground-rgba") == 0 || |
| 187 |
strcmp (pspec->name, "font") == 0 || |
| 188 |
strcmp (pspec->name, "font-desc") == 0)) |
| 189 |
continue; |
| 190 |
|
| 191 |
if (g_type_is_a (type, GTK_TYPE_CELL_VIEW) && |
| 192 |
(strcmp (pspec->name, "background-gdk") == 0 || |
| 193 |
strcmp (pspec->name, "foreground-gdk") == 0 || |
| 194 |
strcmp (pspec->name, "foreground-rgba") == 0 || |
| 195 |
strcmp (pspec->name, "background-rgba") == 0 || |
| 196 |
strcmp (pspec->name, "cell-area") == 0 || |
| 197 |
strcmp (pspec->name, "cell-area-context") == 0)) |
| 198 |
continue; |
| 199 |
|
| 200 |
if (g_type_is_a (type, GTK_TYPE_COLOR_BUTTON) && |
| 201 |
(strcmp (pspec->name, "color") == 0 || |
| 202 |
strcmp (pspec->name, "rgba") == 0)) |
| 203 |
continue; |
| 204 |
|
| 205 |
G_GNUC_BEGIN_IGNORE_DEPRECATIONS |
| 206 |
|
| 207 |
if (g_type_is_a (type, GTK_TYPE_COLOR_SELECTION) && |
| 208 |
(strcmp (pspec->name, "current-color") == 0 || |
| 209 |
strcmp (pspec->name, "current-rgba") == 0)) |
| 210 |
continue; |
| 211 |
|
| 212 |
if (g_type_is_a (type, GTK_TYPE_COLOR_SELECTION_DIALOG) && |
| 213 |
(strcmp (pspec->name, "color-selection") == 0 || |
| 214 |
strcmp (pspec->name, "ok-button") == 0 || |
| 215 |
strcmp (pspec->name, "help-button") == 0 || |
| 216 |
strcmp (pspec->name, "cancel-button") == 0)) |
| 217 |
continue; |
| 218 |
|
| 219 |
if (g_type_is_a (type, GTK_TYPE_COMBO_BOX) && |
| 220 |
(strcmp (pspec->name, "cell-area") == 0 || |
| 221 |
strcmp (pspec->name, "cell-area-context") == 0)) |
| 222 |
continue; |
| 223 |
|
| 224 |
G_GNUC_END_IGNORE_DEPRECATIONS |
| 225 |
|
| 226 |
/* Default invisible char is determined at runtime */ |
| 227 |
if (g_type_is_a (type, GTK_TYPE_ENTRY) && |
| 228 |
(strcmp (pspec->name, "invisible-char") == 0 || |
| 229 |
strcmp (pspec->name, "buffer") == 0)) |
| 230 |
continue; |
| 231 |
|
| 232 |
G_GNUC_BEGIN_IGNORE_DEPRECATIONS |
| 233 |
|
| 234 |
if (g_type_is_a (type, GTK_TYPE_ENTRY_COMPLETION) && |
| 235 |
(strcmp (pspec->name, "cell-area") == 0 || |
| 236 |
strcmp (pspec->name, "cell-area-context") == 0)) |
| 237 |
continue; |
| 238 |
|
| 239 |
G_GNUC_END_IGNORE_DEPRECATIONS |
| 240 |
|
| 241 |
/* This is set in init() */ |
| 242 |
if (g_type_is_a (type, GTK_TYPE_FONT_CHOOSER_WIDGET) && |
| 243 |
strcmp (pspec->name, "tweak-action") == 0) |
| 244 |
continue; |
| 245 |
|
| 246 |
G_GNUC_BEGIN_IGNORE_DEPRECATIONS |
| 247 |
|
| 248 |
if (g_type_is_a (type, GTK_TYPE_ICON_VIEW) && |
| 249 |
(strcmp (pspec->name, "cell-area") == 0 || |
| 250 |
strcmp (pspec->name, "cell-area-context") == 0)) |
| 251 |
continue; |
| 252 |
|
| 253 |
G_GNUC_END_IGNORE_DEPRECATIONS |
| 254 |
|
| 255 |
if (g_type_is_a (type, GTK_TYPE_LAYOUT) && |
| 256 |
(strcmp (pspec->name, "hadjustment") == 0 || |
| 257 |
strcmp (pspec->name, "vadjustment") == 0)) |
| 258 |
continue; |
| 259 |
|
| 260 |
if (g_type_is_a (type, GTK_TYPE_MESSAGE_DIALOG) && |
| 261 |
(strcmp (pspec->name, "image") == 0 || |
| 262 |
strcmp (pspec->name, "message-area") == 0)) |
| 263 |
continue; |
| 264 |
|
| 265 |
if (g_type_is_a (type, GTK_TYPE_PANED) && |
| 266 |
strcmp (pspec->name, "max-position") == 0) |
| 267 |
continue; |
| 268 |
|
| 269 |
if (g_type_is_a (type, GTK_TYPE_PRINT_OPERATION) && |
| 270 |
strcmp (pspec->name, "job-name") == 0) |
| 271 |
continue; |
| 272 |
|
| 273 |
#ifdef G_OS_UNIX |
| 274 |
if (g_type_is_a (type, GTK_TYPE_PRINT_UNIX_DIALOG) && |
| 275 |
(strcmp (pspec->name, "page-setup") == 0 || |
| 276 |
strcmp (pspec->name, "print-settings") == 0)) |
| 277 |
continue; |
| 278 |
#endif |
| 279 |
|
| 280 |
if (g_type_is_a (type, GTK_TYPE_PROGRESS_BAR) && |
| 281 |
strcmp (pspec->name, "adjustment") == 0) |
| 282 |
continue; |
| 283 |
|
| 284 |
/* filename value depends on $HOME */ |
| 285 |
if (g_type_is_a (type, GTK_TYPE_RECENT_MANAGER) && |
| 286 |
(strcmp (pspec->name, "filename") == 0 || |
| 287 |
strcmp (pspec->name, "size") == 0)) |
| 288 |
continue; |
| 289 |
|
| 290 |
if (g_type_is_a (type, GTK_TYPE_SCALE_BUTTON) && |
| 291 |
strcmp (pspec->name, "adjustment") == 0) |
| 292 |
continue; |
| 293 |
|
| 294 |
if (g_type_is_a (type, GTK_TYPE_SCROLLED_WINDOW) && |
| 295 |
(strcmp (pspec->name, "hadjustment") == 0 || |
| 296 |
strcmp (pspec->name, "vadjustment") == 0)) |
| 297 |
continue; |
| 298 |
|
| 299 |
if (g_type_is_a (type, GTK_TYPE_SETTINGS)) |
| 300 |
continue; |
| 301 |
|
| 302 |
if (g_type_is_a (type, GTK_TYPE_SPIN_BUTTON) && |
| 303 |
(strcmp (pspec->name, "adjustment") == 0)) |
| 304 |
continue; |
| 305 |
|
| 306 |
if (g_type_is_a (type, GTK_TYPE_STATUS_ICON) && |
| 307 |
(strcmp (pspec->name, "size") == 0 || |
| 308 |
strcmp (pspec->name, "screen") == 0)) |
| 309 |
continue; |
| 310 |
|
| 311 |
if (g_type_is_a (type, GTK_TYPE_STYLE_CONTEXT) && |
| 312 |
strcmp (pspec->name, "screen") == 0) |
| 313 |
continue; |
| 314 |
|
| 315 |
if (g_type_is_a (type, GTK_TYPE_TEXT_BUFFER) && |
| 316 |
(strcmp (pspec->name, "tag-table") == 0 || |
| 317 |
strcmp (pspec->name, "copy-target-list") == 0 || |
| 318 |
strcmp (pspec->name, "paste-target-list") == 0)) |
| 319 |
continue; |
| 320 |
|
| 321 |
/* language depends on the current locale */ |
| 322 |
if (g_type_is_a (type, GTK_TYPE_TEXT_TAG) && |
| 323 |
(strcmp (pspec->name, "background-gdk") == 0 || |
| 324 |
strcmp (pspec->name, "foreground-gdk") == 0 || |
| 325 |
strcmp (pspec->name, "language") == 0 || |
| 326 |
strcmp (pspec->name, "font") == 0 || |
| 327 |
strcmp (pspec->name, "font-desc") == 0)) |
| 328 |
continue; |
| 329 |
|
| 330 |
if (g_type_is_a (type, GTK_TYPE_TEXT_VIEW) && |
| 331 |
strcmp (pspec->name, "buffer") == 0) |
| 332 |
continue; |
| 333 |
|
| 334 |
if (g_type_is_a (type, GTK_TYPE_TOOL_ITEM_GROUP) && |
| 335 |
strcmp (pspec->name, "label-widget") == 0) |
| 336 |
continue; |
| 337 |
|
| 338 |
if (g_type_is_a (type, GTK_TYPE_TREE_VIEW) && |
| 339 |
(strcmp (pspec->name, "hadjustment") == 0 || |
| 340 |
strcmp (pspec->name, "vadjustment") == 0)) |
| 341 |
continue; |
| 342 |
|
| 343 |
if (g_type_is_a (type, GTK_TYPE_TREE_VIEW_COLUMN) && |
| 344 |
(strcmp (pspec->name, "cell-area") == 0 || |
| 345 |
strcmp (pspec->name, "cell-area-context") == 0)) |
| 346 |
continue; |
| 347 |
|
| 348 |
if (g_type_is_a (type, GTK_TYPE_VIEWPORT) && |
| 349 |
(strcmp (pspec->name, "hadjustment") == 0 || |
| 350 |
strcmp (pspec->name, "vadjustment") == 0)) |
| 351 |
continue; |
| 352 |
|
| 353 |
if (g_type_is_a (type, GTK_TYPE_WIDGET) && |
| 354 |
(strcmp (pspec->name, "name") == 0 || |
| 355 |
strcmp (pspec->name, "screen") == 0 || |
| 356 |
strcmp (pspec->name, "style") == 0)) |
| 357 |
continue; |
| 358 |
|
| 359 |
/* resize-grip-visible is determined at runtime */ |
| 360 |
if (g_type_is_a (type, GTK_TYPE_WINDOW) && |
| 361 |
strcmp (pspec->name, "resize-grip-visible") == 0) |
| 362 |
continue; |
| 363 |
|
| 364 |
/* show-desktop depends on desktop environment */ |
| 365 |
if (g_type_is_a (type, GTK_TYPE_PLACES_SIDEBAR) && |
| 366 |
strcmp (pspec->name, "show-desktop") == 0) |
| 367 |
continue; |
| 368 |
|
| 369 |
if (g_test_verbose ()) |
| 370 |
{ |
| 371 |
g_print ("Property %s:%s\n", |
| 372 |
g_type_name (pspec->owner_type), |
| 373 |
pspec->name); |
| 374 |
} |
| 375 |
|
| 376 |
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); |
| 377 |
g_object_get_property (instance, pspec->name, &value); |
| 378 |
check_property ("Property", pspec, &value); |
| 379 |
g_value_unset (&value); |
| 380 |
} |
| 381 |
g_free (pspecs); |
| 382 |
|
| 383 |
if (g_type_is_a (type, GTK_TYPE_WIDGET)) |
| 384 |
{ |
| 385 |
g_object_set (gtk_settings_get_default (), "gtk-theme-name", "Adwaita", NULL); |
| 386 |
pspecs = gtk_widget_class_list_style_properties (GTK_WIDGET_CLASS (klass), &n_pspecs); |
| 387 |
|
| 388 |
for (i = 0; i < n_pspecs; ++i) |
| 389 |
{ |
| 390 |
GParamSpec *pspec = pspecs[i]; |
| 391 |
GValue value = G_VALUE_INIT; |
| 392 |
|
| 393 |
if (pspec->owner_type != type) |
| 394 |
continue; |
| 395 |
|
| 396 |
if ((pspec->flags & G_PARAM_READABLE) == 0) |
| 397 |
continue; |
| 398 |
|
| 399 |
/* These are overridden by Adwaita */ |
| 400 |
if (g_type_is_a (type, GTK_TYPE_DIALOG) && |
| 401 |
(strcmp (pspec->name, "action-area-border") == 0 || |
| 402 |
strcmp (pspec->name, "button-spacing") == 0)) |
| 403 |
continue; |
| 404 |
|
| 405 |
if (g_type_is_a (type, GTK_TYPE_SCROLLBAR) && |
| 406 |
(strcmp (pspec->name, "has-backward-stepper") == 0 || |
| 407 |
strcmp (pspec->name, "has-forward-stepper") == 0)) |
| 408 |
continue; |
| 409 |
|
| 410 |
if (g_type_is_a (type, GTK_TYPE_SCROLLED_WINDOW) && |
| 411 |
strcmp (pspec->name, "scrollbar-spacing") == 0) |
| 412 |
continue; |
| 413 |
|
| 414 |
if (g_type_is_a (type, GTK_TYPE_TEXT_VIEW) && |
| 415 |
strcmp (pspec->name, "error-underline-color") == 0) |
| 416 |
continue; |
| 417 |
|
| 418 |
if (g_type_is_a (type, GTK_TYPE_TOOL_BUTTON) && |
| 419 |
strcmp (pspec->name, "icon-spacing") == 0) |
| 420 |
continue; |
| 421 |
|
| 422 |
if (g_type_is_a (type, GTK_TYPE_TOOL_ITEM_GROUP) && |
| 423 |
strcmp (pspec->name, "expander-size") == 0) |
| 424 |
continue; |
| 425 |
|
| 426 |
if (g_type_is_a (type, GTK_TYPE_TREE_VIEW) && |
| 427 |
(strcmp (pspec->name, "expander-size") == 0 || |
| 428 |
strcmp (pspec->name, "grid-line-pattern") == 0 || |
| 429 |
strcmp (pspec->name, "horizontal-separator") == 0 || |
| 430 |
strcmp (pspec->name, "tree-line-pattern") == 0)) |
| 431 |
continue; |
| 432 |
|
| 433 |
/* This is desktop-dependent */ |
| 434 |
if (g_type_is_a (type, GTK_TYPE_WINDOW) && |
| 435 |
strcmp (pspec->name, "decoration-button-layout") == 0) |
| 436 |
continue; |
| 437 |
|
| 438 |
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); |
| 439 |
gtk_widget_style_get_property (GTK_WIDGET (instance), pspec->name, &value); |
| 440 |
check_property ("Style property", pspec, &value); |
| 441 |
g_value_unset (&value); |
| 442 |
} |
| 443 |
|
| 444 |
g_free (pspecs); |
| 445 |
} |
| 446 |
|
| 447 |
if (g_type_is_a (type, GDK_TYPE_WINDOW)) |
| 448 |
gdk_window_destroy (GDK_WINDOW (instance)); |
| 449 |
else |
| 450 |
g_object_unref (instance); |
| 451 |
|
| 452 |
g_type_class_unref (klass); |
| 453 |
} |
| 454 |
|
| 455 |
int |
| 456 |
main (int argc, char **argv) |
| 457 |
{ |
| 458 |
const GType *otypes; |
| 459 |
guint i; |
| 460 |
gchar *schema_dir; |
| 461 |
|
| 462 |
/* These must be set before before gtk_test_init */ |
| 463 |
g_setenv ("GIO_USE_VFS", "local", TRUE); |
| 464 |
g_setenv ("GSETTINGS_BACKEND", "memory", TRUE); |
| 465 |
g_setenv ("G_ENABLE_DIAGNOSTIC", "0", TRUE); |
| 466 |
|
| 467 |
gtk_test_init (&argc, &argv); |
| 468 |
gtk_test_register_all_types(); |
| 469 |
|
| 470 |
/* g_test_build_filename must be called after gtk_test_init */ |
| 471 |
schema_dir = g_test_build_filename (G_TEST_BUILT, "", NULL); |
| 472 |
if (g_getenv ("GTK_TEST_MESON") == NULL) |
| 473 |
g_setenv ("GSETTINGS_SCHEMA_DIR", schema_dir, TRUE); |
| 474 |
|
| 475 |
otypes = gtk_test_list_all_types (NULL); |
| 476 |
for (i = 0; otypes[i]; i++) |
| 477 |
{ |
| 478 |
gchar *testname; |
| 479 |
|
| 480 |
if (otypes[i] == GTK_TYPE_FILE_CHOOSER_NATIVE) |
| 481 |
continue; |
| 482 |
|
| 483 |
testname = g_strdup_printf ("/Default Values/%s", |
| 484 |
g_type_name (otypes[i])); |
| 485 |
g_test_add_data_func (testname, |
| 486 |
&otypes[i], |
| 487 |
test_type); |
| 488 |
g_free (testname); |
| 489 |
} |
| 490 |
|
| 491 |
return g_test_run(); |
| 492 |
} |