Exemplo n.º 1
0
static void
_do_test(AtkObject *obj)
{
   AtkStateSet *state_set;

   g_assert(ATK_IS_ACTION(obj));

   /* atk_action_get_n_actions test */
   g_assert(atk_action_get_n_actions(ATK_ACTION(obj)) == 2);

   eailu_test_action_activate(ATK_ACTION(obj), "shrink");
   state_set = atk_object_ref_state_set(obj);
   g_assert(atk_state_set_contains_state(state_set, ATK_STATE_DEFAULT));
   g_object_unref(state_set);

   eailu_test_action_activate(ATK_ACTION(obj), "expand");
   state_set = atk_object_ref_state_set(obj);
   g_assert(atk_state_set_contains_state(state_set, ATK_STATE_EXPANDED));
   g_object_unref(state_set);

   eailu_test_action_description_all(ATK_ACTION(obj));

   g_assert((eailu_get_action_number(ATK_ACTION(obj), "typo")) == -1);
   _printf("DONE. All multibutton_entry tests passed successfully \n");

   eailu_test_code_called = 1;
}
Exemplo n.º 2
0
static void
_do_test(AtkObject *obj)
{
   const char *type_name = g_type_name(G_TYPE_FROM_INSTANCE(obj));
   AtkStateSet *state_set = atk_object_ref_state_set(obj);

   g_assert_cmpstr(type_name, ==, "EailLabel");

   /**
    * AtkText tests
    */
   g_assert(ATK_IS_TEXT(obj));

   g_assert(atk_state_set_contains_state(state_set, ATK_STATE_MULTI_LINE));
   g_object_unref(state_set);

   /* atk_text_get_text */
   gchar *text = atk_text_get_text(ATK_TEXT(obj), 6, 11);
   g_assert_cmpstr(text, ==, "ipsum");
   g_free(text);

   /* atk_text_get_character_at_offset */
   g_assert(atk_text_get_character_at_offset(ATK_TEXT(obj), 12) == 'd');

   /* atk_text_get_character_count */
   g_assert(atk_text_get_character_count(ATK_TEXT(obj)) == 440);
}
Exemplo n.º 3
0
static void _print_states (AtkObject *obj)
{
  AtkStateSet *state_set;
  gint i;

  state_set = atk_object_ref_state_set (obj);

  g_print ("*** Start states ***\n");
  for (i = 0; i < 64; i++)
    {
       AtkStateType one_state;
       G_CONST_RETURN gchar *name;

       if (atk_state_set_contains_state (state_set, i))
         {
           one_state = i;

           name = atk_state_type_get_name (one_state);

           if (name)
             g_print("%s\n", name);
         }
    }
  g_object_unref (state_set);
  g_print ("*** End states ***\n");
}
Exemplo n.º 4
0
static AtkStateSet *
gtk_menu_item_accessible_ref_state_set (AtkObject *obj)
{
  AtkObject *menu_item;
  AtkStateSet *state_set, *parent_state_set;

  state_set = ATK_OBJECT_CLASS (_gtk_menu_item_accessible_parent_class)->ref_state_set (obj);

  menu_item = atk_object_get_parent (obj);

  if (menu_item)
    {
      if (!GTK_IS_MENU_ITEM (gtk_accessible_get_widget (GTK_ACCESSIBLE (menu_item))))
        return state_set;

      parent_state_set = atk_object_ref_state_set (menu_item);
      if (!atk_state_set_contains_state (parent_state_set, ATK_STATE_SELECTED))
        {
          atk_state_set_remove_state (state_set, ATK_STATE_FOCUSED);
          atk_state_set_remove_state (state_set, ATK_STATE_SHOWING);
        }
      g_object_unref (parent_state_set);
    }

  return state_set;
}
static bool checkElementState(PlatformUIElement element, AtkStateType stateType)
{
    if (!ATK_IS_OBJECT(element))
         return false;

    GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(element)));
    return atk_state_set_contains_state(stateSet.get(), stateType);
}
Exemplo n.º 6
0
void
_test_state(AtkObject *obj, AtkStateType state_type)
{
   AtkStateSet *state_set;

   state_set = atk_object_ref_state_set(obj);
   g_assert(atk_state_set_contains_state(state_set, state_type));
   g_object_unref(state_set);
}
Exemplo n.º 7
0
static void
state_change_cb (AtkObject *obj, const gchar *name, gboolean state_set)
{
  AtkStateSet *set;

  set = atk_object_ref_state_set (obj);
  g_print ("accessible %s %p focused -> %d\n", get_name (obj), obj,
           atk_state_set_contains_state (set, ATK_STATE_FOCUSED));
  g_object_unref (set);
}
bool AccessibilityUIElement::isChecked() const
{
    if (!ATK_IS_OBJECT(m_element))
        return false;

    GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element)));
    gboolean isChecked = atk_state_set_contains_state(stateSet.get(), ATK_STATE_CHECKED);

    return isChecked;
}
Exemplo n.º 9
0
bool AccessibilityUIElement::isSelected() const
{
    if (!ATK_IS_OBJECT(m_element))
        return false;

    PlatformRefPtr<AtkStateSet> stateSet = adoptPlatformRef(atk_object_ref_state_set(ATK_OBJECT(m_element)));
    gboolean isSelected = atk_state_set_contains_state(stateSet.get(), ATK_STATE_SELECTED);

    return isSelected;
}
bool AccessibilityUIElement::isFocusable() const
{
    if (!ATK_IS_OBJECT(m_element))
        return false;

    GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element)));
    gboolean isFocusable = atk_state_set_contains_state(stateSet.get(), ATK_STATE_FOCUSABLE);

    return isFocusable;
}
Exemplo n.º 11
0
static AtkStateSet *
gtk_notebook_page_accessible_ref_state_set (AtkObject *accessible)
{
  AtkStateSet *state_set, *label_state_set, *merged_state_set;
  AtkObject *atk_label;
  GtkWidget *label;

  state_set = ATK_OBJECT_CLASS (_gtk_notebook_page_accessible_parent_class)->ref_state_set (accessible);

  label = get_label_from_notebook_page (GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible));
  if (label)
    {
      atk_label = gtk_widget_get_accessible (label);
      label_state_set = atk_object_ref_state_set (atk_label);
      merged_state_set = atk_state_set_or_sets (state_set, label_state_set);
      g_object_unref (label_state_set);
      g_object_unref (state_set);
    }
  else
    {
      AtkObject *child;

      child = atk_object_ref_accessible_child (accessible, 0);
      if (!child)
        return state_set;

      merged_state_set = state_set;
      state_set = atk_object_ref_state_set (child);
      if (atk_state_set_contains_state (state_set, ATK_STATE_VISIBLE))
        {
          atk_state_set_add_state (merged_state_set, ATK_STATE_VISIBLE);
          if (atk_state_set_contains_state (state_set, ATK_STATE_ENABLED))
              atk_state_set_add_state (merged_state_set, ATK_STATE_ENABLED);
          if (atk_state_set_contains_state (state_set, ATK_STATE_SHOWING))
              atk_state_set_add_state (merged_state_set, ATK_STATE_SHOWING);

        }
      g_object_unref (state_set);
      g_object_unref (child);
    }
  return merged_state_set;
}
Exemplo n.º 12
0
static AtkStateSet*
gail_notebook_page_ref_state_set (AtkObject *accessible)
{
  AtkStateSet *state_set, *label_state_set, *merged_state_set;
  AtkObject *atk_label;

  g_return_val_if_fail (GAIL_NOTEBOOK_PAGE (accessible), NULL);

  state_set = ATK_OBJECT_CLASS (gail_notebook_page_parent_class)->ref_state_set (accessible);

  atk_label = _gail_notebook_page_get_tab_label (GAIL_NOTEBOOK_PAGE (accessible));
  if (atk_label)
    {
      label_state_set = atk_object_ref_state_set (atk_label);
      merged_state_set = atk_state_set_or_sets (state_set, label_state_set);
      g_object_unref (label_state_set);
      g_object_unref (state_set);
    }
  else
    {
      AtkObject *child;

      child = atk_object_ref_accessible_child (accessible, 0);
      gail_return_val_if_fail (child, state_set);

      merged_state_set = state_set;
      state_set = atk_object_ref_state_set (child);
      if (atk_state_set_contains_state (state_set, ATK_STATE_VISIBLE))
        {
          atk_state_set_add_state (merged_state_set, ATK_STATE_VISIBLE);
          if (atk_state_set_contains_state (state_set, ATK_STATE_ENABLED))
              atk_state_set_add_state (merged_state_set, ATK_STATE_ENABLED);
          if (atk_state_set_contains_state (state_set, ATK_STATE_SHOWING))
              atk_state_set_add_state (merged_state_set, ATK_STATE_SHOWING);

        } 
      g_object_unref (state_set);
      g_object_unref (child);
    }
  return merged_state_set;
}
Exemplo n.º 13
0
static AtkObject *
gtk_html_a11y_ref_child (AtkObject *accessible,
                         gint index)
{
	HTMLObject *child;
	AtkObject *accessible_child = NULL;
	AtkStateSet *ss;

	if (GTK_HTML_A11Y_GTKHTML (accessible)->engine->parsing)
		return NULL;

	ss = atk_object_ref_state_set (accessible);
	if (atk_state_set_contains_state (ss, ATK_STATE_DEFUNCT)) {
		g_object_unref (ss);
		return NULL;
	}
	g_object_unref (ss);

	if (GTK_HTML_A11Y_GTKHTML (accessible)->engine->clue) {
		AtkObject *atk_clue = html_utils_get_accessible (GTK_HTML_A11Y_GTKHTML (accessible)->engine->clue, NULL);
		if (atk_clue) {
			AtkStateSet *ss_clue = atk_object_ref_state_set (atk_clue);
			if (atk_state_set_contains_state (ss_clue, ATK_STATE_DEFUNCT)) {
				g_object_unref (ss_clue);
				return NULL;
			}
			g_object_unref (ss_clue);
		}

		child = html_object_get_child (GTK_HTML_A11Y_GTKHTML (accessible)->engine->clue, index);
		if (child) {
			accessible_child = html_utils_get_accessible (child, accessible);
			if (accessible_child)
				g_object_ref (accessible_child);
		}
	}

	/* printf ("gtk_html_a11y_ref_child %d resolves to %p\n", index, accessible_child); */

	return accessible_child;
}
Exemplo n.º 14
0
static gboolean
my_atk_selection_add_selection (AtkSelection *selection, gint i)
{
  MyAtkSelection *self = MY_ATK_SELECTION(selection);
  if (!self)
    return FALSE;

  AtkObject *child = atk_object_ref_accessible_child (ATK_OBJECT (selection), i);
  AtkStateSet *ss = atk_object_ref_state_set (child);
  atk_state_set_add_state (ss, ATK_STATE_SELECTED);
  return atk_state_set_contains_state (ss, ATK_STATE_SELECTED);
}
Exemplo n.º 15
0
Arquivo: utils.c Projeto: 0lvin/ghtml
static void
acc_unref(gpointer data)
{
	AtkStateSet * ss;

	g_object_set_data(G_OBJECT(data), HTML_ID, NULL);
	ss = atk_object_ref_state_set (data);

	atk_state_set_add_state (ss, ATK_STATE_DEFUNCT);
	atk_object_notify_state_change (data, ATK_STATE_DEFUNCT, TRUE);
	g_object_unref(G_OBJECT(data));
}
Exemplo n.º 16
0
/**
 * @brief Emits state-changed signals for naviframe child page if needed
 *
 * @param naviframe_page an AtkObject for naviframe page
 */
static void
_eail_naviframe_page_emit_changed_signals(AtkObject *naviframe_page)
{
   AtkStateSet *state_set = NULL;
   gboolean visible = FALSE;

   state_set = atk_object_ref_state_set(naviframe_page);
   visible = atk_state_set_contains_state(state_set, ATK_STATE_VISIBLE);

   atk_object_notify_state_change(naviframe_page, ATK_STATE_VISIBLE, visible);
   atk_object_notify_state_change(naviframe_page, ATK_STATE_SHOWING, visible);
   DBG("Emiting state_changed visible/showing: %d", visible);
}
Exemplo n.º 17
0
static gboolean
my_atk_selection_is_child_selected (AtkSelection *selection, gint i)
{
  MyAtkSelection *self = MY_ATK_SELECTION(selection);
  if (!self)
    return FALSE;
  AtkObject *child = NULL;
  AtkStateSet *states = NULL;
  child = atk_object_ref_accessible_child (ATK_OBJECT (selection), i);
  states = atk_object_ref_state_set (child);
  if (atk_state_set_contains_state (states, ATK_STATE_SELECTED))
    return TRUE;
  return FALSE;
}
Exemplo n.º 18
0
static gboolean
my_atk_selection_remove_selection (AtkSelection *selection, gint no)
{
  MyAtkSelection *self = MY_ATK_SELECTION(selection);
  AtkObject *child = NULL;
  AtkStateSet *states = NULL;
  GArray *array = NULL;
  AtkObject *o = NULL;
  int i;
  int childs;
  gboolean ret = FALSE;

  if (!self)
    return FALSE;
  array = g_array_new (FALSE, FALSE, sizeof (AtkObject *));
  childs = atk_object_get_n_accessible_children (ATK_OBJECT (selection));

  for (i=0; i<childs; i++) {
    child = atk_object_ref_accessible_child (ATK_OBJECT (selection), i);
    states = atk_object_ref_state_set (child);
    if (atk_state_set_contains_state (states, ATK_STATE_SELECTED))
      g_array_append_val (array, child);
  }
  g_object_unref (states);

  o = g_array_index (array, AtkObject *, no);
  states = atk_object_ref_state_set (o);
  atk_state_set_remove_state (states, ATK_STATE_SELECTED);

  ret = !atk_state_set_contains_state (states, ATK_STATE_SELECTED);
  g_object_unref (states);
  g_object_unref (o);
  g_object_unref (self);
  g_array_free (array, TRUE);

  return ret;
}
Exemplo n.º 19
0
static void
_do_test(AtkObject *obj)
{
   AtkStateSet *state_set = atk_object_ref_state_set(obj);
   const char *name;

   g_assert(ATK_IS_OBJECT(obj));
   g_assert(atk_object_get_role(obj) == ATK_ROLE_RADIO_BUTTON);

   atk_object_set_description(obj, "test");
   g_assert_cmpstr(atk_object_get_description(obj), ==, "test");

   name = atk_object_get_name(obj);

   if (!strcmp(name, RADIO1))
     {
        state_set = atk_object_ref_state_set(obj);
        g_assert(!atk_state_set_contains_state(state_set, ATK_STATE_CHECKED));
        g_object_unref(state_set);
        ++name_test_passed;

        atk_object_set_name(obj, TEST_NAME);
        g_assert_cmpstr(atk_object_get_name(obj), ==, TEST_NAME);
     }
Exemplo n.º 20
0
/*
 * nux_area_accessible_parent_window_active
 * @self: The accessible to check the focus change
 *
 * Returns if the top level parent window contains
 * the state ATK_STATE_ACTIVE
 *
 * Returns: TRUE if the parent top level window contains
 * ATK_STATE_ACTIVE, FALSE otherwise
 */
gboolean
nux_area_accessible_parent_window_active(NuxAreaAccessible* self)
{
  AtkStateSet* state_set = NULL;

  check_parent_window_connected(self);

  state_set = atk_object_ref_state_set(ATK_OBJECT(self->priv->parent_window));

  gboolean active = atk_state_set_contains_state(state_set, ATK_STATE_ACTIVE);

  g_object_unref(state_set);

  return active;
}
Exemplo n.º 21
0
static gint
gtk_html_a11y_get_n_children (AtkObject *accessible)
{
	HTMLObject *clue;
	gint n_children = 0;
	AtkStateSet *ss;

	if (GTK_HTML_A11Y_GTKHTML (accessible)->engine->parsing)
		return 0;

	ss = atk_object_ref_state_set (accessible);
	if (atk_state_set_contains_state (ss, ATK_STATE_DEFUNCT)) {
		g_object_unref (ss);
		return 0;
	}
	g_object_unref (ss);

	clue = GTK_HTML_A11Y_GTKHTML (accessible)->engine->clue;
	if (clue) {
		AtkObject *atk_clue = html_utils_get_accessible (clue, NULL);
		if (atk_clue) {
			AtkStateSet *ss_clue = atk_object_ref_state_set (atk_clue);
			if (atk_state_set_contains_state (ss_clue, ATK_STATE_DEFUNCT)) {
				g_object_unref (ss_clue);
				return 0;
			}
			g_object_unref (ss_clue);
		}

		n_children = html_object_get_n_children (GTK_HTML_A11Y_GTKHTML (accessible)->engine->clue);
	}

	/* printf ("gtk_html_a11y_get_n_children resolves to %d\n", n_children); */

	return n_children;
}
Exemplo n.º 22
0
static void
_do_test(AtkObject *obj)
{
   const char *type_name = g_type_name(G_TYPE_FROM_INSTANCE(obj));
   const char *name = atk_object_get_name(ATK_OBJECT(obj));
   const char *type_name_child;
   AtkStateSet *state_set;
   AtkObject *xobj;

   _printf("type_name: %s\n", type_name ? type_name : "NULL");
   g_assert(name);
   _printf("name: %s\n", name);

   g_assert_cmpstr(type_name, ==, "EailCheck");

   g_assert(ATK_IS_OBJECT(obj));
   g_assert(ATK_IS_ACTION(obj));
   g_assert(ATK_IS_TEXT(obj));

   state_set = atk_object_ref_state_set(obj);

   if (!strcmp(name, CHECK_TEXT1))
     {
        _printf("check test: %s\n", CHECK_TEXT1);

        g_assert(atk_state_set_contains_state(state_set, ATK_STATE_CHECKED));

        // test children
        g_assert(0 == atk_object_get_n_accessible_children(obj));
     }
   else if (!strcmp(name, CHECK_TEXT2))
     {
       _printf("check test: %s\n", CHECK_TEXT2);

       g_assert(!atk_state_set_contains_state(state_set, ATK_STATE_CHECKED));

       // test children
       g_assert(1 == atk_object_get_n_accessible_children(obj));

       xobj = atk_object_ref_accessible_child(obj, 0);
       g_assert(NULL != xobj);
       type_name_child = g_type_name(G_TYPE_FROM_INSTANCE(xobj));
       _printf("type_name_child: %s\n", type_name_child);
       g_assert_cmpstr(type_name_child, ==, "EailIcon");
     }
Exemplo n.º 23
0
static gboolean
my_atk_selection_clear_selection (AtkSelection *selection)
{
  MyAtkSelection *self = MY_ATK_SELECTION(selection);
  if (!self)
    return FALSE;
  AtkObject *child = NULL;
  AtkStateSet *states = NULL;
  int i;
  int childs = atk_object_get_n_accessible_children (ATK_OBJECT (selection));

  for (i=0; i<childs; i++) {
    child = atk_object_ref_accessible_child (ATK_OBJECT (selection), i);
    states = atk_object_ref_state_set (child);
    atk_state_set_remove_state (states, ATK_STATE_SELECTED);
  }
  return TRUE;
}
Exemplo n.º 24
0
G_MODULE_EXPORT void
test_init (gchar *path)
{
  AtkStateSet *ss;
  gchar *td;

  if (path == NULL)
     g_error("No test data path provided");
  tdata_path = path;

  td = g_build_path(G_DIR_SEPARATOR_S, tdata_path, OBJECT_TEST_1, NULL);
  root_accessible = ATK_OBJECT(atk_object_xml_parse(td));
  g_free(td);

  ss = atk_object_ref_state_set(ATK_OBJECT(root_accessible));
  atk_state_set_add_states(ss, states, 5);
  g_object_unref(G_OBJECT(ss));
}
Exemplo n.º 25
0
/* page accessible's state set is a copy ev-view accessible's state
 * set but removing ATK_STATE_SHOWING if the page is not on screen and
 * ATK_STATE_FOCUSED if it is not the relevant page. */
static AtkStateSet *
ev_page_accessible_ref_state_set (AtkObject *accessible)
{
	AtkStateSet *state_set;
	AtkStateSet *copy_set;
	AtkStateSet *view_accessible_state_set;
	EvPageAccessible *self;
	EvView *view;
	gint relevant_page;

	g_return_val_if_fail (EV_IS_PAGE_ACCESSIBLE (accessible), NULL);
	self = EV_PAGE_ACCESSIBLE (accessible);
	view = ev_page_accessible_get_view (self);

	state_set = ATK_OBJECT_CLASS (ev_page_accessible_parent_class)->ref_state_set (accessible);
	atk_state_set_clear_states (state_set);

	view_accessible_state_set = atk_object_ref_state_set (ATK_OBJECT (self->priv->view_accessible));
	copy_set = atk_state_set_or_sets (state_set, view_accessible_state_set);

	if (self->priv->page >= view->start_page && self->priv->page <= view->end_page)
		atk_state_set_add_state (copy_set, ATK_STATE_SHOWING);
	else
		atk_state_set_remove_state (copy_set, ATK_STATE_SHOWING);

	relevant_page = ev_view_accessible_get_relevant_page (self->priv->view_accessible);
	if (atk_state_set_contains_state (view_accessible_state_set, ATK_STATE_FOCUSED) &&
	    self->priv->page == relevant_page)
		atk_state_set_add_state (copy_set, ATK_STATE_FOCUSED);
	else
		atk_state_set_remove_state (copy_set, ATK_STATE_FOCUSED);

	relevant_page = ev_view_accessible_get_relevant_page (self->priv->view_accessible);
	if (atk_state_set_contains_state (view_accessible_state_set, ATK_STATE_FOCUSED) &&
	    self->priv->page == relevant_page)
		atk_state_set_add_state (copy_set, ATK_STATE_FOCUSED);
	else
		atk_state_set_remove_state (copy_set, ATK_STATE_FOCUSED);

	g_object_unref (state_set);
	g_object_unref (view_accessible_state_set);

	return copy_set;
}
Exemplo n.º 26
0
static gboolean
is_valid (AtkObject *cell)
{
	GalA11yECell *a11y = GAL_A11Y_E_CELL (cell);
	GalA11yETableItem *a11yItem = GAL_A11Y_E_TABLE_ITEM (a11y->parent);
	AtkStateSet *item_ss;
	gboolean ret = TRUE;

	item_ss = atk_object_ref_state_set (ATK_OBJECT (a11yItem));
	if (atk_state_set_contains_state (item_ss, ATK_STATE_DEFUNCT))
		ret = FALSE;

	g_object_unref (item_ss);

	if (ret && atk_state_set_contains_state (a11y->state_set, ATK_STATE_DEFUNCT))
		ret = FALSE;

	return ret;
}
Exemplo n.º 27
0
static gint
my_atk_selection_get_selection_count (AtkSelection *selection)
{
  MyAtkSelection *self = MY_ATK_SELECTION(selection);
  if (!self)
    return FALSE;
  AtkObject *child = NULL;
  AtkStateSet *states = NULL;
  int i, ret=0;
  int childs = atk_object_get_n_accessible_children (ATK_OBJECT (selection));

  for (i=0; i<childs; i++) {
    child = atk_object_ref_accessible_child (ATK_OBJECT (selection), i);
    states = atk_object_ref_state_set (child);
    if (atk_state_set_contains_state (states, ATK_STATE_SELECTED))
      ret++;

  }
  return ret;
}
Exemplo n.º 28
0
static AtkObject*
my_atk_selection_ref_selection (AtkSelection *selection, gint no)
{
  MyAtkSelection *self = MY_ATK_SELECTION(selection);
  if (!self)
    return FALSE;
  AtkObject *child = NULL;
  AtkStateSet *states = NULL;
  GArray *array = g_array_new (FALSE, FALSE, sizeof (AtkObject *));
  int i;
  int childs = atk_object_get_n_accessible_children (ATK_OBJECT (selection));

  for (i=0; i<childs; i++) {
    child = atk_object_ref_accessible_child (ATK_OBJECT (selection), i);
    states = atk_object_ref_state_set (child);
    if (atk_state_set_contains_state (states, ATK_STATE_SELECTED))
      g_array_append_val (array, child);
  }

  return g_array_index (array, AtkObject *, no);
}
Exemplo n.º 29
0
/*
 * CORBA Accessibility::Accessible::getState method implementation
 */
static Accessibility_StateSet
impl_accessibility_accessible_get_state (PortableServer_Servant servant,
					 CORBA_Environment     *ev)
{
  AtkObject *object = get_atkobject_from_servant (servant);
  AtkStateSet *atk_set;
  SpiStateSet *set;
  Accessibility_StateSet retval;

  bonobo_return_val_if_fail (object != NULL, NULL, ev);

  atk_set = atk_object_ref_state_set (object);
  
  set = spi_state_set_new (atk_set);
  retval = CORBA_Object_duplicate (
				  BONOBO_OBJREF(set),
				  NULL);

  g_object_unref (atk_set);

  return retval;
}
Exemplo n.º 30
0
static void
_do_test_photo(AtkObject *obj)
{
   const char *name = atk_object_get_name(obj);
   const char *type_name = g_type_name(G_TYPE_FROM_INSTANCE(obj));
   const char * const desc_test = "top secret";
   const char *desc;
   int height = 0, width  = 0;
   int x = -1, y = -1;

   _printf("_get_name: %s\n", name ? name : "NULL");
   _printf("_get_type_name: %s\n", type_name ? type_name : "NULL");

   g_assert(ATK_IS_IMAGE(obj));

   AtkStateSet *state_set = atk_object_ref_state_set(obj);
   g_object_unref(state_set);

   // test AtkImage
   atk_image_get_image_position(ATK_IMAGE(obj), &x, &y, ATK_XY_SCREEN);
   _printf("atk_image_get_image_position on screen: x: %d y %d\n", x, y);

   g_assert(NULL == atk_image_get_image_description(ATK_IMAGE(obj)));
   g_assert(TRUE == atk_image_set_image_description(ATK_IMAGE(obj), desc_test));
   desc = atk_image_get_image_description(ATK_IMAGE(obj));
   _printf("atk_image_get_image_description: %s\n", desc ? desc : "NULL");
   g_assert(NULL != desc);
   g_assert_cmpstr(desc_test, ==, desc);

   atk_image_get_image_size(ATK_IMAGE(obj), &height, &width);
   _printf("atk_image_get_image_size: height %d width %d\n", height, width);

   // test AtkAction
   g_assert(ACTIONS_NUMBER == atk_action_get_n_actions(ATK_ACTION(obj)));
   eailu_test_action_activate(ATK_ACTION(obj), "click");
   g_assert((eailu_get_action_number(ATK_ACTION(obj), "typo")) == -1);
   eailu_test_action_description_all(ATK_ACTION(obj));
}