1/* floatingtest.c - test floating flag uses
2 * Copyright (C) 2005 Tim Janik
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17#include <gtk/gtk.h>
18
19static gboolean destroyed = FALSE;
20static void
21destroy (void)
22{
23 destroyed = TRUE;
24}
25
26static void
27floating_tests (void)
28{
29 GtkWidget *widget = g_object_new (GTK_TYPE_LABEL, NULL);
30 g_object_connect (object: widget, signal_spec: "signal::destroy", destroy, NULL, NULL);
31
32 g_assert_true (g_object_is_floating (widget));
33
34 g_object_ref_sink (widget);
35 g_assert_false (g_object_is_floating (widget));
36
37 g_object_force_floating (G_OBJECT (widget));
38 g_assert_true (g_object_is_floating (widget));
39
40 g_object_ref_sink (widget);
41 g_assert_false (g_object_is_floating (widget));
42
43 g_assert_false (destroyed);
44 g_object_unref (object: widget);
45 g_assert_true (destroyed);
46}
47
48int
49main (int argc,
50 char *argv[])
51{
52 gtk_test_init (argcp: &argc, argvp: &argv);
53 g_test_add_func (testpath: "/floatingtest", test_func: floating_tests);
54 return g_test_run();
55}
56

source code of gtk/testsuite/gtk/floating.c