mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-13 20:30:11 +00:00
1375fb4464
A radiobutton without indicator is really just a togglebutton with a group. A radiobutton with indicator is really just a checkbutton with a group. Make checkbutton its own widget not inheriting from GtkButton. GtkRadioButton could be removed but it stays for now. Radiobutton && !draw-indicator => Togglebutton Checkbutton && !draw-indicator => Togglebutton Radiobutton && draw-indicator => CheckButton + group
55 lines
1.4 KiB
C
55 lines
1.4 KiB
C
#include <gtk/gtk.h>
|
|
|
|
static void
|
|
check_button_role (void)
|
|
{
|
|
GtkWidget *button = gtk_check_button_new ();
|
|
g_object_ref_sink (button);
|
|
|
|
gtk_test_accessible_assert_role (button, GTK_ACCESSIBLE_ROLE_CHECKBOX);
|
|
|
|
g_object_unref (button);
|
|
}
|
|
|
|
static void
|
|
check_button_checked (void)
|
|
{
|
|
GtkWidget *button = gtk_check_button_new ();
|
|
g_object_ref_sink (button);
|
|
|
|
gtk_test_accessible_assert_state (button, GTK_ACCESSIBLE_STATE_CHECKED, GTK_ACCESSIBLE_TRISTATE_FALSE);
|
|
|
|
gtk_check_button_set_active (GTK_CHECK_BUTTON (button), TRUE);
|
|
|
|
gtk_test_accessible_assert_state (button, GTK_ACCESSIBLE_STATE_CHECKED, GTK_ACCESSIBLE_TRISTATE_TRUE);
|
|
|
|
gtk_check_button_set_inconsistent (GTK_CHECK_BUTTON (button), TRUE);
|
|
|
|
gtk_test_accessible_assert_state (button, GTK_ACCESSIBLE_STATE_CHECKED, GTK_ACCESSIBLE_TRISTATE_MIXED);
|
|
|
|
g_object_unref (button);
|
|
}
|
|
|
|
static void
|
|
check_button_label (void)
|
|
{
|
|
GtkWidget *button = gtk_check_button_new_with_label ("Hello");
|
|
g_object_ref_sink (button);
|
|
|
|
gtk_test_accessible_assert_property (button, GTK_ACCESSIBLE_PROPERTY_LABEL, "Hello");
|
|
|
|
g_object_unref (button);
|
|
}
|
|
|
|
int
|
|
main (int argc, char *argv[])
|
|
{
|
|
gtk_test_init (&argc, &argv, NULL);
|
|
|
|
g_test_add_func ("/a11y/checkbutton/role", check_button_role);
|
|
g_test_add_func ("/a11y/checkbutton/checked", check_button_checked);
|
|
g_test_add_func ("/a11y/checkbutton/label", check_button_label);
|
|
|
|
return g_test_run ();
|
|
}
|