Added tests/testtoplevelembed.

This commit is contained in:
Tristan Van Berkom 2010-12-24 10:29:21 +09:00
parent addcc64b9c
commit 69b1bfb17b
2 changed files with 72 additions and 1 deletions

View File

@ -103,7 +103,8 @@ noinst_PROGRAMS = $(TEST_PROGS) \
testcellarea \
testswitch \
styleexamples \
testtreemenu
testtreemenu \
testtoplevelembed
if USE_X11
noinst_PROGRAMS += testerrors
@ -199,6 +200,7 @@ testexpand_DEPENDENCIES = $(TEST_DEPS)
testexpander_DEPENDENCIES = $(TEST_DEPS)
testswitch_DEPENDENCIES = $(TEST_DEPS)
styleexamples_DEPENDENCIES = $(TEST_DEPS)
testtoplevelembed_DEPENDENCIES = $(TEST_DEPS)
flicker_LDADD = $(LDADDS)
simple_LDADD = $(LDADDS)
@ -280,6 +282,7 @@ testexpand_LDADD = $(LDADDS)
testexpander_LDADD = $(LDADDS)
testswitch_LDADD = $(LDADDS)
styleexamples_LDADD = $(LDADDS)
testtoplevelembed_LDADD = $(LDADDS)
testentrycompletion_SOURCES = \
prop-editor.c \
@ -419,8 +422,11 @@ testexpand_SOURCES = testexpand.c
testexpander_SOURCES = testexpander.c
testswitch_SOURCES = testswitch.c
styleexamples_SOURCES = styleexamples.c
testtoplevelembed_SOURCES = testtoplevelembed.c
EXTRA_DIST += \
gradient1.png \
prop-editor.h \

65
tests/testtoplevelembed.c Normal file
View File

@ -0,0 +1,65 @@
#include "config.h"
#include <gtk/gtk.h>
gint
main (gint argc, gchar **argv)
{
GtkWidget *window;
GtkWidget *notebook;
GtkWidget *widget;
GtkWidget *label;
GdkWindow *gdk_win;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Toplevel widget embedding example");
g_signal_connect (window, "destroy", gtk_main_quit, NULL);
notebook = gtk_notebook_new ();
gtk_container_add (GTK_CONTAINER (window), notebook);
gtk_widget_realize (notebook);
gdk_win = gtk_widget_get_window (notebook);
g_assert (gdk_win);
widget = gtk_about_dialog_new ();
label = gtk_label_new ("GtkAboutDialog");
gtk_widget_set_parent_window (widget, gdk_win);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
widget = gtk_file_chooser_dialog_new ("the chooser", NULL, GTK_FILE_CHOOSER_ACTION_OPEN, NULL, NULL);
label = gtk_label_new ("GtkFileChooser");
gtk_widget_set_parent_window (widget, gdk_win);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
widget = gtk_color_selection_dialog_new ("the colorsel");
label = gtk_label_new ("GtkColorSelDialog");
gtk_widget_set_parent_window (widget, gdk_win);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
widget = gtk_font_selection_dialog_new ("the fontsel");
label = gtk_label_new ("GtkFontSelectionDialog");
gtk_widget_set_parent_window (widget, gdk_win);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
widget = gtk_recent_chooser_dialog_new ("the recent chooser", NULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
label = gtk_label_new ("GtkRecentChooserDialog");
gtk_widget_set_parent_window (widget, gdk_win);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
widget = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
"Do you have any questions ?");
label = gtk_label_new ("GtkMessageDialog");
gtk_widget_set_parent_window (widget, gdk_win);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
gtk_widget_show_all (window);
gtk_main ();
}