1
/* ATK -  Accessibility Toolkit
2
 * Copyright (C) 2013 Igalia, S.L.
3
 *
4
 * Author: Alejandro PiƱeiro Iglesias <apinheiro@igalia.com>
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Library General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Library General Public
17
 * License along with this library; if not, write to the
18
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
 * Boston, MA 02111-1307, USA.
20
 */
21
#include <atk/atk.h>
22
#include <string.h>
23

            
24
static void
25
1
test_role (void)
26
{
27
  AtkRole role1, role2;
28
  const gchar *name;
29

            
30
1
  name = atk_role_get_name (ATK_ROLE_PAGE_TAB);
31
1
  g_assert_cmpstr (name, ==, "page tab");
32

            
33
1
  name = atk_role_get_name (ATK_ROLE_LAYERED_PANE);
34
1
  g_assert_cmpstr (name, ==, "layered pane");
35

            
36
1
  role1 = atk_role_for_name ("list item");
37
1
  g_assert_cmpint (role1, ==, ATK_ROLE_LIST_ITEM);
38

            
39
1
  role2 = atk_role_for_name ("TEST_ROLE");
40
1
  g_assert_cmpint (role2, ==, ATK_ROLE_INVALID);
41
  /*
42
   * Check that a non-existent role returns NULL
43
   */
44
1
  g_assert_null (atk_role_get_name (ATK_ROLE_LAST_DEFINED + 2));
45
1
}
46

            
47
int
48
1
main (gint argc,
49
      char *argv[])
50
{
51
1
  g_test_init (&argc, &argv, NULL);
52
1
  g_test_add_func ("/atk/role/roles", test_role);
53

            
54
1
  return g_test_run ();
55
}