summaryrefslogtreecommitdiff
path: root/testsuite/a11y/searchentry.c
blob: 4c44940c64a3ebaf78bc373a72bbda6318b9a3d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <gtk/gtk.h>

static void
search_entry_role (void)
{
  GtkWidget *widget = gtk_search_entry_new ();
  g_object_ref_sink (widget);

  gtk_test_accessible_assert_role (widget, GTK_ACCESSIBLE_ROLE_SEARCH_BOX);

  g_object_unref (widget);
}

static void
search_entry_properties (void)
{
  GtkWidget *widget = gtk_search_entry_new ();
  g_object_ref_sink (widget);

  gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER, NULL);
  gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_READ_ONLY, FALSE);

  g_object_set (widget, "placeholder-text", "Hello", NULL);
  gtk_editable_set_editable (GTK_EDITABLE (widget), FALSE);

  gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER, "Hello");
  gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_READ_ONLY, TRUE);

  g_object_unref (widget);
}

int
main (int argc, char *argv[])
{
  gtk_test_init (&argc, &argv, NULL);

  g_test_add_func ("/a11y/searchentry/role", search_entry_role);
  g_test_add_func ("/a11y/searchentry/properties", search_entry_properties);

  return g_test_run ();
}