2018-05-16 15:56:34 +00:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
static void
|
|
|
|
capture_widget_destroy (void)
|
|
|
|
{
|
|
|
|
GtkWidget *searchbar = gtk_search_bar_new ();
|
|
|
|
GtkWidget *button = gtk_button_new ();
|
|
|
|
|
|
|
|
g_object_ref_sink (searchbar);
|
|
|
|
g_object_ref_sink (button);
|
|
|
|
|
|
|
|
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (searchbar), button);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_search_bar_get_key_capture_widget (GTK_SEARCH_BAR (searchbar)) == button);
|
2018-05-16 15:56:34 +00:00
|
|
|
|
|
|
|
g_object_unref (button);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_null (gtk_search_bar_get_key_capture_widget (GTK_SEARCH_BAR (searchbar)));
|
2018-05-16 15:56:34 +00:00
|
|
|
|
|
|
|
g_object_unref (searchbar);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
capture_widget_unset (void)
|
|
|
|
{
|
|
|
|
GtkWidget *searchbar = gtk_search_bar_new ();
|
|
|
|
GtkWidget *button = gtk_button_new ();
|
|
|
|
|
|
|
|
g_object_ref_sink (searchbar);
|
|
|
|
g_object_ref_sink (button);
|
|
|
|
|
|
|
|
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (searchbar), button);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_search_bar_get_key_capture_widget (GTK_SEARCH_BAR (searchbar)) == button);
|
2018-05-16 15:56:34 +00:00
|
|
|
|
|
|
|
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (searchbar), NULL);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_null (gtk_search_bar_get_key_capture_widget (GTK_SEARCH_BAR (searchbar)));
|
2018-05-16 15:56:34 +00:00
|
|
|
|
|
|
|
g_object_unref (searchbar);
|
|
|
|
g_object_unref (button);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc,
|
|
|
|
char *argv[])
|
|
|
|
{
|
|
|
|
gtk_test_init (&argc, &argv);
|
|
|
|
|
|
|
|
g_test_add_func ("/searchbar/capture-widget-destroy", capture_widget_destroy);
|
|
|
|
g_test_add_func ("/searchbar/capture-widget-unset", capture_widget_unset);
|
|
|
|
|
|
|
|
return g_test_run();
|
|
|
|
}
|