a11y: Add dialog and window tests
Tests the modal property changes in the previous commit.
This commit is contained in:
54
testsuite/a11y/dialog.c
Normal file
54
testsuite/a11y/dialog.c
Normal file
@@ -0,0 +1,54 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
dialog_role (void)
|
||||
{
|
||||
GtkWidget *dialog = gtk_dialog_new ();
|
||||
|
||||
gtk_test_accessible_assert_role (dialog, GTK_ACCESSIBLE_ROLE_DIALOG);
|
||||
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
static void
|
||||
dialog_state (void)
|
||||
{
|
||||
GtkWidget *dialog = gtk_dialog_new ();
|
||||
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
|
||||
gtk_test_accessible_assert_state (dialog, GTK_ACCESSIBLE_STATE_HIDDEN, FALSE);
|
||||
|
||||
gtk_widget_hide (dialog);
|
||||
|
||||
gtk_test_accessible_assert_state (dialog, GTK_ACCESSIBLE_STATE_HIDDEN, TRUE);
|
||||
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
static void
|
||||
dialog_properties (void)
|
||||
{
|
||||
GtkWidget *dialog = gtk_dialog_new ();
|
||||
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
|
||||
gtk_test_accessible_assert_property (dialog, GTK_ACCESSIBLE_PROPERTY_MODAL, TRUE);
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), FALSE);
|
||||
|
||||
gtk_test_accessible_assert_property (dialog, GTK_ACCESSIBLE_PROPERTY_MODAL, FALSE);
|
||||
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
gtk_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/a11y/dialog/role", dialog_role);
|
||||
g_test_add_func ("/a11y/dialog/state", dialog_state);
|
||||
g_test_add_func ("/a11y/dialog/properties", dialog_properties);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
@@ -13,6 +13,8 @@ tests = [
|
||||
{ 'name': 'accessible' },
|
||||
{ 'name': 'button' },
|
||||
{ 'name': 'checkbutton' },
|
||||
{ 'name': 'dialog' },
|
||||
{ 'name': 'window' },
|
||||
]
|
||||
|
||||
|
||||
|
||||
54
testsuite/a11y/window.c
Normal file
54
testsuite/a11y/window.c
Normal file
@@ -0,0 +1,54 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
window_role (void)
|
||||
{
|
||||
GtkWidget *window = gtk_window_new ();
|
||||
|
||||
gtk_test_accessible_assert_role (window, GTK_ACCESSIBLE_ROLE_WINDOW);
|
||||
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
}
|
||||
|
||||
static void
|
||||
window_state (void)
|
||||
{
|
||||
GtkWidget *window = gtk_window_new ();
|
||||
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
|
||||
gtk_test_accessible_assert_state (window, GTK_ACCESSIBLE_STATE_HIDDEN, FALSE);
|
||||
|
||||
gtk_widget_hide (window);
|
||||
|
||||
gtk_test_accessible_assert_state (window, GTK_ACCESSIBLE_STATE_HIDDEN, TRUE);
|
||||
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
}
|
||||
|
||||
static void
|
||||
window_properties (void)
|
||||
{
|
||||
GtkWidget *window = gtk_window_new ();
|
||||
|
||||
gtk_window_set_modal (GTK_WINDOW (window), TRUE);
|
||||
|
||||
gtk_test_accessible_assert_property (window, GTK_ACCESSIBLE_PROPERTY_MODAL, TRUE);
|
||||
gtk_window_set_modal (GTK_WINDOW (window), FALSE);
|
||||
|
||||
gtk_test_accessible_assert_property (window, GTK_ACCESSIBLE_PROPERTY_MODAL, FALSE);
|
||||
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
gtk_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/a11y/window/role", window_role);
|
||||
g_test_add_func ("/a11y/window/state", window_state);
|
||||
g_test_add_func ("/a11y/window/properties", window_properties);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
Reference in New Issue
Block a user