2013-03-21 08:54:16 +00:00
|
|
|
/* templates.c
|
|
|
|
* Copyright (C) 2013 Openismus GmbH
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Authors: Tristan Van Berkom <tristanvb@openismus.com>
|
|
|
|
*/
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2013-03-26 15:02:25 +00:00
|
|
|
#ifdef HAVE_UNIX_PRINT_WIDGETS
|
|
|
|
# include <gtk/gtkunixprint.h>
|
|
|
|
#endif
|
|
|
|
|
2013-03-24 16:40:08 +00:00
|
|
|
static gboolean
|
|
|
|
main_loop_quit_cb (gpointer data)
|
|
|
|
{
|
2020-02-10 01:06:58 +00:00
|
|
|
gboolean *done = data;
|
|
|
|
|
|
|
|
*done = TRUE;
|
|
|
|
|
|
|
|
g_main_context_wakeup (NULL);
|
2013-03-24 16:40:08 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-05-10 15:12:07 +00:00
|
|
|
static void
|
|
|
|
show_and_wait (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
gboolean done = FALSE;
|
|
|
|
|
|
|
|
g_timeout_add (500, main_loop_quit_cb, &done);
|
|
|
|
gtk_widget_show (widget);
|
|
|
|
while (!done)
|
|
|
|
g_main_context_iteration (NULL, FALSE);
|
|
|
|
}
|
|
|
|
|
2013-03-21 08:54:16 +00:00
|
|
|
static void
|
|
|
|
test_dialog_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *dialog;
|
|
|
|
|
2020-05-09 14:26:22 +00:00
|
|
|
dialog = gtk_dialog_new ();
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_DIALOG (dialog));
|
|
|
|
g_assert_nonnull (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
|
2013-03-24 16:40:08 +00:00
|
|
|
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (dialog));
|
2013-03-21 08:54:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
test_dialog_override_property (void)
|
|
|
|
{
|
|
|
|
GtkWidget *dialog;
|
|
|
|
|
|
|
|
dialog = g_object_new (GTK_TYPE_DIALOG,
|
2020-03-11 21:44:21 +00:00
|
|
|
"use-header-bar", 1,
|
|
|
|
NULL);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_DIALOG (dialog));
|
2013-03-21 08:54:16 +00:00
|
|
|
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (dialog));
|
2013-03-21 08:54:16 +00:00
|
|
|
}
|
|
|
|
|
2013-03-22 09:45:24 +00:00
|
|
|
static void
|
|
|
|
test_message_dialog_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *dialog;
|
|
|
|
|
|
|
|
dialog = gtk_message_dialog_new (NULL, 0,
|
2020-05-09 14:26:22 +00:00
|
|
|
GTK_MESSAGE_INFO,
|
|
|
|
GTK_BUTTONS_CLOSE,
|
|
|
|
"Do it hard !");
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_DIALOG (dialog));
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (dialog));
|
2013-03-22 09:45:24 +00:00
|
|
|
}
|
|
|
|
|
2013-03-22 12:51:40 +00:00
|
|
|
static void
|
|
|
|
test_about_dialog_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *dialog;
|
|
|
|
|
|
|
|
dialog = gtk_about_dialog_new ();
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_ABOUT_DIALOG (dialog));
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (dialog));
|
2013-03-22 12:51:40 +00:00
|
|
|
}
|
|
|
|
|
2020-05-10 15:12:07 +00:00
|
|
|
static void
|
|
|
|
test_about_dialog_show (void)
|
|
|
|
{
|
|
|
|
GtkWidget *dialog;
|
|
|
|
|
|
|
|
dialog = gtk_about_dialog_new ();
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_ABOUT_DIALOG (dialog));
|
2020-05-10 15:12:07 +00:00
|
|
|
show_and_wait (dialog);
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (dialog));
|
2020-05-10 15:12:07 +00:00
|
|
|
}
|
|
|
|
|
2013-03-22 10:45:31 +00:00
|
|
|
static void
|
|
|
|
test_info_bar_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *infobar;
|
|
|
|
|
|
|
|
infobar = gtk_info_bar_new ();
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_INFO_BAR (infobar));
|
2020-05-09 14:33:02 +00:00
|
|
|
g_object_unref (g_object_ref_sink (infobar));
|
2013-03-22 10:45:31 +00:00
|
|
|
}
|
|
|
|
|
2013-03-23 08:52:48 +00:00
|
|
|
static void
|
|
|
|
test_lock_button_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *button;
|
|
|
|
GPermission *permission;
|
|
|
|
|
|
|
|
permission = g_simple_permission_new (TRUE);
|
|
|
|
button = gtk_lock_button_new (permission);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_LOCK_BUTTON (button));
|
2020-05-09 14:33:02 +00:00
|
|
|
g_object_unref (g_object_ref_sink (button));
|
2013-03-23 08:52:48 +00:00
|
|
|
g_object_unref (permission);
|
|
|
|
}
|
|
|
|
|
2013-03-23 10:10:34 +00:00
|
|
|
static void
|
|
|
|
test_assistant_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_assistant_new ();
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_ASSISTANT (widget));
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (widget));
|
2013-03-23 10:10:34 +00:00
|
|
|
}
|
|
|
|
|
2020-05-10 15:12:07 +00:00
|
|
|
static void
|
|
|
|
test_assistant_show (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_assistant_new ();
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_ASSISTANT (widget));
|
2020-05-10 15:12:07 +00:00
|
|
|
show_and_wait (widget);
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (widget));
|
2020-05-10 15:12:07 +00:00
|
|
|
}
|
|
|
|
|
2013-03-23 11:17:15 +00:00
|
|
|
static void
|
|
|
|
test_scale_button_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
2017-01-20 06:49:11 +00:00
|
|
|
widget = gtk_scale_button_new (0, 100, 10, NULL);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_SCALE_BUTTON (widget));
|
2020-05-09 14:33:02 +00:00
|
|
|
g_object_unref (g_object_ref_sink (widget));
|
2013-03-23 11:17:15 +00:00
|
|
|
}
|
|
|
|
|
2013-03-30 09:51:58 +00:00
|
|
|
static void
|
|
|
|
test_volume_button_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_volume_button_new ();
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_VOLUME_BUTTON (widget));
|
2020-05-09 14:33:02 +00:00
|
|
|
g_object_unref (g_object_ref_sink (widget));
|
2013-03-30 09:51:58 +00:00
|
|
|
}
|
|
|
|
|
2013-03-23 11:38:43 +00:00
|
|
|
static void
|
|
|
|
test_statusbar_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_statusbar_new ();
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_STATUSBAR (widget));
|
2020-05-09 14:33:02 +00:00
|
|
|
g_object_unref (g_object_ref_sink (widget));
|
2013-03-23 11:38:43 +00:00
|
|
|
}
|
|
|
|
|
2014-02-18 02:42:38 +00:00
|
|
|
static void
|
|
|
|
test_search_bar_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_search_bar_new ();
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_SEARCH_BAR (widget));
|
2020-05-09 14:33:02 +00:00
|
|
|
g_object_unref (g_object_ref_sink (widget));
|
2014-02-18 02:42:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
test_action_bar_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_action_bar_new ();
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_ACTION_BAR (widget));
|
2020-05-09 14:33:02 +00:00
|
|
|
g_object_unref (g_object_ref_sink (widget));
|
2014-02-18 02:42:38 +00:00
|
|
|
}
|
|
|
|
|
2013-03-23 12:59:30 +00:00
|
|
|
static void
|
|
|
|
test_app_chooser_widget_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_app_chooser_widget_new (NULL);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_APP_CHOOSER_WIDGET (widget));
|
2020-05-09 14:33:02 +00:00
|
|
|
g_object_unref (g_object_ref_sink (widget));
|
2013-03-23 12:59:30 +00:00
|
|
|
}
|
|
|
|
|
2013-03-23 14:02:33 +00:00
|
|
|
static void
|
|
|
|
test_app_chooser_dialog_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2020-02-10 03:24:47 +00:00
|
|
|
gboolean done = FALSE;
|
2013-03-23 14:02:33 +00:00
|
|
|
|
|
|
|
widget = gtk_app_chooser_dialog_new_for_content_type (NULL, 0, "text/plain");
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_APP_CHOOSER_DIALOG (widget));
|
2013-03-24 16:40:08 +00:00
|
|
|
|
|
|
|
/* GtkAppChooserDialog bug, if destroyed before spinning
|
|
|
|
* the main context then app_chooser_online_get_default_ready_cb()
|
|
|
|
* will be eventually called and segfault.
|
|
|
|
*/
|
2020-02-10 01:06:58 +00:00
|
|
|
g_timeout_add (500, main_loop_quit_cb, &done);
|
|
|
|
while (!done)
|
|
|
|
g_main_context_iteration (NULL, TRUE);
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (widget));
|
2013-03-23 14:02:33 +00:00
|
|
|
}
|
|
|
|
|
2013-03-23 15:41:07 +00:00
|
|
|
static void
|
|
|
|
test_color_chooser_dialog_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
2013-03-29 12:47:38 +00:00
|
|
|
/* This test also tests the internal GtkColorEditor widget */
|
2013-03-23 15:41:07 +00:00
|
|
|
widget = gtk_color_chooser_dialog_new (NULL, NULL);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_COLOR_CHOOSER_DIALOG (widget));
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (widget));
|
2013-03-23 15:41:07 +00:00
|
|
|
}
|
|
|
|
|
2020-05-10 15:12:07 +00:00
|
|
|
static void
|
|
|
|
test_color_chooser_dialog_show (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
/* This test also tests the internal GtkColorEditor widget */
|
|
|
|
widget = gtk_color_chooser_dialog_new (NULL, NULL);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_COLOR_CHOOSER_DIALOG (widget));
|
2020-05-10 15:12:07 +00:00
|
|
|
show_and_wait (widget);
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (widget));
|
2020-05-10 15:12:07 +00:00
|
|
|
}
|
|
|
|
|
2013-03-24 16:40:08 +00:00
|
|
|
/* Avoid warnings from GVFS-RemoteVolumeMonitor */
|
|
|
|
static gboolean
|
2020-07-24 18:40:36 +00:00
|
|
|
ignore_gvfs_warning (const char *log_domain,
|
2020-05-09 14:26:22 +00:00
|
|
|
GLogLevelFlags log_level,
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *message,
|
2020-05-09 14:26:22 +00:00
|
|
|
gpointer user_data)
|
2013-03-24 16:40:08 +00:00
|
|
|
{
|
|
|
|
if (g_strcmp0 (log_domain, "GVFS-RemoteVolumeMonitor") == 0)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
test_file_chooser_widget_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2020-02-10 03:24:47 +00:00
|
|
|
gboolean done = FALSE;
|
2013-03-24 16:40:08 +00:00
|
|
|
|
2013-03-30 07:35:39 +00:00
|
|
|
/* This test also tests the internal GtkPathBar widget */
|
2013-03-24 16:40:08 +00:00
|
|
|
g_test_log_set_fatal_handler (ignore_gvfs_warning, NULL);
|
|
|
|
|
|
|
|
widget = gtk_file_chooser_widget_new (GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_FILE_CHOOSER_WIDGET (widget));
|
2013-03-24 16:40:08 +00:00
|
|
|
|
|
|
|
/* XXX BUG:
|
|
|
|
*
|
|
|
|
* Spin the mainloop for a bit, this allows the file operations
|
2014-01-28 09:30:33 +00:00
|
|
|
* to complete, GtkFileChooserWidget has a bug where it leaks
|
2013-03-24 16:40:08 +00:00
|
|
|
* GtkTreeRowReferences to the internal shortcuts_model
|
|
|
|
*
|
|
|
|
* Since we assert all automated children are finalized we
|
|
|
|
* can catch this
|
|
|
|
*/
|
2020-02-10 03:24:47 +00:00
|
|
|
g_timeout_add (100, main_loop_quit_cb, &done);
|
|
|
|
while (!done)
|
|
|
|
g_main_context_iteration (NULL, TRUE);
|
2013-03-24 16:40:08 +00:00
|
|
|
|
2020-05-09 14:33:02 +00:00
|
|
|
g_object_unref (g_object_ref_sink (widget));
|
2013-03-24 16:40:08 +00:00
|
|
|
}
|
|
|
|
|
2013-03-25 12:49:49 +00:00
|
|
|
static void
|
|
|
|
test_file_chooser_dialog_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2020-02-10 01:06:58 +00:00
|
|
|
gboolean done;
|
2013-03-25 12:49:49 +00:00
|
|
|
|
|
|
|
g_test_log_set_fatal_handler (ignore_gvfs_warning, NULL);
|
|
|
|
|
|
|
|
widget = gtk_file_chooser_dialog_new ("The Dialog", NULL,
|
2020-05-09 14:26:22 +00:00
|
|
|
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
|
|
|
"_OK", GTK_RESPONSE_OK,
|
|
|
|
NULL);
|
2013-03-25 12:49:49 +00:00
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_FILE_CHOOSER_DIALOG (widget));
|
2020-02-10 01:06:58 +00:00
|
|
|
done = FALSE;
|
|
|
|
g_timeout_add (100, main_loop_quit_cb, &done);
|
|
|
|
while (!done)
|
|
|
|
g_main_context_iteration (NULL, TRUE);
|
2013-03-25 12:49:49 +00:00
|
|
|
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (widget));
|
2013-03-25 12:49:49 +00:00
|
|
|
}
|
|
|
|
|
2020-05-10 15:12:07 +00:00
|
|
|
static void
|
|
|
|
test_file_chooser_dialog_show (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
g_test_log_set_fatal_handler (ignore_gvfs_warning, NULL);
|
|
|
|
|
|
|
|
widget = gtk_file_chooser_dialog_new ("The Dialog", NULL,
|
|
|
|
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
|
|
|
"_OK", GTK_RESPONSE_OK,
|
|
|
|
NULL);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_FILE_CHOOSER_DIALOG (widget));
|
2020-05-10 15:12:07 +00:00
|
|
|
show_and_wait (widget);
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (widget));
|
2020-05-10 15:12:07 +00:00
|
|
|
}
|
|
|
|
|
2013-03-30 08:35:54 +00:00
|
|
|
static void
|
|
|
|
test_font_button_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_font_button_new ();
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_FONT_BUTTON (widget));
|
2020-05-09 14:33:02 +00:00
|
|
|
g_object_unref (g_object_ref_sink (widget));
|
2013-03-30 08:35:54 +00:00
|
|
|
}
|
|
|
|
|
2013-03-26 09:50:01 +00:00
|
|
|
static void
|
|
|
|
test_font_chooser_widget_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_font_chooser_widget_new ();
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_FONT_CHOOSER_WIDGET (widget));
|
2020-05-09 14:33:02 +00:00
|
|
|
g_object_unref (g_object_ref_sink (widget));
|
2013-03-26 09:50:01 +00:00
|
|
|
}
|
|
|
|
|
2013-03-26 10:13:12 +00:00
|
|
|
static void
|
|
|
|
test_font_chooser_dialog_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_font_chooser_dialog_new ("Choose a font !", NULL);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_FONT_CHOOSER_DIALOG (widget));
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (widget));
|
2013-03-26 10:13:12 +00:00
|
|
|
}
|
|
|
|
|
2020-05-10 15:12:07 +00:00
|
|
|
static void
|
|
|
|
test_font_chooser_dialog_show (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_font_chooser_dialog_new ("Choose a font !", NULL);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_FONT_CHOOSER_DIALOG (widget));
|
2020-05-10 15:12:07 +00:00
|
|
|
show_and_wait (widget);
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (widget));
|
2020-05-10 15:12:07 +00:00
|
|
|
}
|
|
|
|
|
2013-03-26 15:02:25 +00:00
|
|
|
#ifdef HAVE_UNIX_PRINT_WIDGETS
|
|
|
|
static void
|
|
|
|
test_page_setup_unix_dialog_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_page_setup_unix_dialog_new ("Setup your Page !", NULL);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_PAGE_SETUP_UNIX_DIALOG (widget));
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (widget));
|
2013-03-26 15:02:25 +00:00
|
|
|
}
|
|
|
|
|
2020-05-10 15:12:07 +00:00
|
|
|
static void
|
|
|
|
test_page_setup_unix_dialog_show (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_page_setup_unix_dialog_new ("Setup your Page !", NULL);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_PAGE_SETUP_UNIX_DIALOG (widget));
|
2020-05-10 15:12:07 +00:00
|
|
|
show_and_wait (widget);
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (widget));
|
2020-05-10 15:12:07 +00:00
|
|
|
}
|
|
|
|
|
2013-03-28 06:06:05 +00:00
|
|
|
static void
|
|
|
|
test_print_unix_dialog_basic (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_print_unix_dialog_new ("Go Print !", NULL);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_PRINT_UNIX_DIALOG (widget));
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (widget));
|
2013-03-28 06:06:05 +00:00
|
|
|
}
|
2020-05-10 15:12:07 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
test_print_unix_dialog_show (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_print_unix_dialog_new ("Go Print !", NULL);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (GTK_IS_PRINT_UNIX_DIALOG (widget));
|
2020-05-10 15:12:07 +00:00
|
|
|
show_and_wait (widget);
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (widget));
|
2020-05-10 15:12:07 +00:00
|
|
|
}
|
2013-03-26 15:02:25 +00:00
|
|
|
#endif
|
|
|
|
|
2013-03-21 08:54:16 +00:00
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
2020-05-28 08:00:03 +00:00
|
|
|
/* These must be set before gtk_test_init */
|
2013-11-09 00:15:33 +00:00
|
|
|
g_setenv ("GIO_USE_VFS", "local", TRUE);
|
|
|
|
g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
|
|
|
|
|
2013-03-21 08:54:16 +00:00
|
|
|
/* initialize test program */
|
|
|
|
gtk_test_init (&argc, &argv);
|
|
|
|
|
2020-05-09 14:26:22 +00:00
|
|
|
/* This environment variable cooperates with widget dispose()
|
2013-03-21 08:54:16 +00:00
|
|
|
* to assert that all automated compoenents are properly finalized
|
|
|
|
* when a given composite widget is destroyed.
|
|
|
|
*/
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (g_setenv ("GTK_WIDGET_ASSERT_COMPONENTS", "1", TRUE));
|
2013-03-21 08:54:16 +00:00
|
|
|
|
2020-05-10 14:50:18 +00:00
|
|
|
g_test_add_func ("/template/GtkDialog/basic", test_dialog_basic);
|
|
|
|
g_test_add_func ("/template/GtkDialog/OverrideProperty", test_dialog_override_property);
|
|
|
|
g_test_add_func ("/template/GtkMessageDialog/basic", test_message_dialog_basic);
|
|
|
|
g_test_add_func ("/template/GtkAboutDialog/basic", test_about_dialog_basic);
|
2020-05-10 15:12:07 +00:00
|
|
|
g_test_add_func ("/template/GtkAboutDialog/show", test_about_dialog_show);
|
2020-05-10 14:50:18 +00:00
|
|
|
g_test_add_func ("/template/GtkInfoBar/basic", test_info_bar_basic);
|
|
|
|
g_test_add_func ("/template/GtkLockButton/basic", test_lock_button_basic);
|
|
|
|
g_test_add_func ("/template/GtkAssistant/basic", test_assistant_basic);
|
2020-05-10 15:12:07 +00:00
|
|
|
g_test_add_func ("/template/GtkAssistant/show", test_assistant_show);
|
2020-05-10 14:50:18 +00:00
|
|
|
g_test_add_func ("/template/GtkScaleButton/basic", test_scale_button_basic);
|
|
|
|
g_test_add_func ("/template/GtkVolumeButton/basic", test_volume_button_basic);
|
|
|
|
g_test_add_func ("/template/GtkStatusBar/basic", test_statusbar_basic);
|
|
|
|
g_test_add_func ("/template/GtkSearchBar/basic", test_search_bar_basic);
|
|
|
|
g_test_add_func ("/template/GtkActionBar/basic", test_action_bar_basic);
|
|
|
|
g_test_add_func ("/template/GtkAppChooserWidget/basic", test_app_chooser_widget_basic);
|
|
|
|
g_test_add_func ("/template/GtkAppChooserDialog/basic", test_app_chooser_dialog_basic);
|
|
|
|
g_test_add_func ("/template/GtkColorChooserDialog/basic", test_color_chooser_dialog_basic);
|
2020-05-10 15:12:07 +00:00
|
|
|
g_test_add_func ("/template/GtkColorChooserDialog/show", test_color_chooser_dialog_show);
|
2020-05-10 14:50:18 +00:00
|
|
|
g_test_add_func ("/template/GtkFileChooserWidget/basic", test_file_chooser_widget_basic);
|
|
|
|
g_test_add_func ("/template/GtkFileChooserDialog/basic", test_file_chooser_dialog_basic);
|
2020-05-10 21:54:49 +00:00
|
|
|
g_test_add_func ("/template/GtkFileChooserDialog/show", test_file_chooser_dialog_show);
|
2020-05-10 14:50:18 +00:00
|
|
|
g_test_add_func ("/template/GtkFontButton/basic", test_font_button_basic);
|
|
|
|
g_test_add_func ("/template/GtkFontChooserWidget/basic", test_font_chooser_widget_basic);
|
|
|
|
g_test_add_func ("/template/GtkFontChooserDialog/basic", test_font_chooser_dialog_basic);
|
2020-05-10 15:12:07 +00:00
|
|
|
g_test_add_func ("/template/GtkFontChooserDialog/show", test_font_chooser_dialog_show);
|
2013-03-21 08:54:16 +00:00
|
|
|
|
2013-03-26 15:02:25 +00:00
|
|
|
#ifdef HAVE_UNIX_PRINT_WIDGETS
|
2020-05-10 14:50:18 +00:00
|
|
|
g_test_add_func ("/template/GtkPageSetupUnixDialog/basic", test_page_setup_unix_dialog_basic);
|
2020-05-10 15:12:07 +00:00
|
|
|
g_test_add_func ("/template/GtkPageSetupUnixDialog/show", test_page_setup_unix_dialog_show);
|
2020-05-10 14:50:18 +00:00
|
|
|
g_test_add_func ("/template/GtkPrintUnixDialog/basic", test_print_unix_dialog_basic);
|
2020-05-10 21:54:49 +00:00
|
|
|
g_test_add_func ("/template/GtkPrintUnixDialog/show", test_print_unix_dialog_show);
|
2013-03-26 15:02:25 +00:00
|
|
|
#endif
|
|
|
|
|
2013-03-21 08:54:16 +00:00
|
|
|
return g_test_run();
|
|
|
|
}
|