Example #1
0
File: testcombo.c Project: BYC/gtk
static void _test_selection (AtkObject *obj)
{
  gint count;
  gint n_children;
  AtkObject *list;

  count = atk_selection_get_selection_count (ATK_SELECTION (obj));
  g_return_if_fail (count == 0);

  list = atk_object_ref_accessible_child (obj, 0);
  n_children = atk_object_get_n_accessible_children (list); 
  g_object_unref (G_OBJECT (list));

  atk_selection_add_selection (ATK_SELECTION (obj), n_children - 1);
  count = atk_selection_get_selection_count (ATK_SELECTION (obj));
  g_return_if_fail (count == 1);
  g_return_if_fail (atk_selection_is_child_selected (ATK_SELECTION (obj),
                     n_children - 1));	
  atk_selection_add_selection (ATK_SELECTION (obj), 0);
  count = atk_selection_get_selection_count (ATK_SELECTION (obj));
  g_return_if_fail (count == 1);
  g_return_if_fail (atk_selection_is_child_selected (ATK_SELECTION (obj), 0));
  atk_selection_clear_selection (ATK_SELECTION (obj));
  count = atk_selection_get_selection_count (ATK_SELECTION (obj));
  g_return_if_fail (count == 0);
}
Example #2
0
JNIEXPORT jboolean JNICALL
Java_org_gnome_atk_AtkSelection_atk_1selection_1is_1child_1selected
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jint _i
)
{
	gboolean result;
	jboolean _result;
	AtkSelection* self;
	gint i;

	// convert parameter self
	self = (AtkSelection*) _self;

	// convert parameter i
	i = (gint) _i;

	// call function
	result = atk_selection_is_child_selected(self, i);

	// cleanup parameter self

	// cleanup parameter i

	// translate return value to JNI type
	_result = (jboolean) result;

	// and finally
	return _result;
}
Example #3
0
static gboolean
gtk_combo_box_accessible_remove_selection (AtkSelection *selection,
        gint          i)
{
    if (atk_selection_is_child_selected (selection, i))
        atk_selection_clear_selection (selection);

    return TRUE;
}
Example #4
0
static void
_test_index_child_for_object(AtkObject *obj, int index)
{
   g_assert(0 == atk_selection_get_selection_count(ATK_SELECTION(obj)));
   g_assert(atk_selection_add_selection(ATK_SELECTION(obj), index));

   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), index));
   g_assert(1 == atk_selection_get_selection_count(ATK_SELECTION(obj)));

   g_assert(atk_selection_clear_selection(ATK_SELECTION(obj)));
   g_assert(0 == atk_selection_get_selection_count(ATK_SELECTION(obj)));
}
void
_do_test(AtkObject *obj)
{
   const char *type_name = g_type_name(G_TYPE_FROM_INSTANCE(obj));

   g_assert(ATK_IS_OBJECT(obj));
   g_assert_cmpstr(type_name, ==, "EailFlipselector");

   g_assert(atk_object_get_n_accessible_children(obj) == ITEMS_COUNT);

   /*
    * AtkSelection tests
    */
   g_assert(ATK_IS_SELECTION(obj));

   /* atk_selection_add_selection test */
   g_assert(atk_selection_add_selection(ATK_SELECTION(obj), ITEM_SEL_EINA));
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EINA));

   /* atk_selection_clear_selection test */
   g_assert(atk_selection_clear_selection(ATK_SELECTION(obj)) == FALSE);

   /* eail_flipselector_ref_selection test */
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EINA));

   /* atk_selection_get_selection_count test */
   g_assert(atk_selection_get_selection_count(ATK_SELECTION(obj)) == MAX_SELECTIONS);

   /* atk_selection_is_child_selected test */
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EINA));

   /* atk_selection_remove_selection test */
   g_assert(atk_selection_remove_selection(ATK_SELECTION(obj), ITEM_SEL_EINA));
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_ELM));

   /* atk_selection_select_all_selection test */
   g_assert(atk_selection_select_all_selection(ATK_SELECTION(obj)) == FALSE);

   /*
    * AtkAction tests
    */
   g_assert(ATK_IS_ACTION(obj));

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

   /* test existing actions */
   g_assert(atk_selection_add_selection(ATK_SELECTION(obj), ITEM_SEL_EINA));
   eailu_test_action_activate(ATK_ACTION(obj), "next");
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EDJE));

   eailu_test_action_activate(ATK_ACTION(obj), "prev");
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EINA));

   /* test for non-existing action */
   g_assert((eailu_get_action_number(ATK_ACTION(obj), "typo")) == -1);

   /* test set/get action description */
   eailu_test_action_description_all(ATK_ACTION(obj));
}
Example #6
0
static void
_do_test(AtkObject *obj)
{
   g_assert(ATK_IS_ACTION(obj));

   eailu_test_action_activate(ATK_ACTION(obj), "scroll_left");
   eailu_test_action_activate(ATK_ACTION(obj), "scroll_right");
   eailu_test_action_activate(ATK_ACTION(obj), "scroll_up");
   eailu_test_action_activate(ATK_ACTION(obj), "scroll_down");
   eailu_test_action_activate(ATK_ACTION(obj), "next");
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), 1));
   eailu_test_action_activate(ATK_ACTION(obj), "next");
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), 2));
   eailu_test_action_activate(ATK_ACTION(obj), "next");
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), 3));
   eailu_test_action_activate(ATK_ACTION(obj), "previous");
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), 2));

   eailu_test_action_description_all(ATK_ACTION(obj));

   eailu_test_code_called = 1;
}
static void
_test_slideshow_object(AtkObject *obj)
{
   int child_count, selection_count, action_count;
   AtkObject *child, *selection;
   gboolean result;
   const gchar *action_name, *action_description;
   /*sometimes this is called several times*/
   static int tested = 0;
   fprintf(stdout, "Testing slideshow\n");
   if (tested > 0) return;
   tested++;

   g_object_ref(obj);

   g_assert(eailu_is_object_with_role(obj, ATK_ROLE_LIST));

   child_count = atk_object_get_n_accessible_children(obj);
   g_assert(child_count == 9);

   for (int i = 0; i < child_count; i++)
     {
        child = atk_object_ref_accessible_child(obj, i);
        AtkRole role = atk_object_get_role(child);
        fprintf(stdout, "index %d child role: %s\n", i,
                atk_role_get_name(role));
        g_assert(eailu_is_object_with_role(child, ATK_ROLE_IMAGE));
        g_object_unref(child);
     }

   /*test AtkSelectionIface*/
   g_assert(ATK_IS_SELECTION(obj));
   selection = atk_selection_ref_selection(ATK_SELECTION(obj), 0);
   /*this may fail due to a problem with  slideshow cache*/
   g_assert(ATK_IS_OBJECT(selection));
   g_assert(eailu_is_object_with_role(selection, ATK_ROLE_IMAGE));
   g_object_unref(selection);
   selection_count = atk_selection_get_selection_count(ATK_SELECTION(obj));
   g_assert(selection_count == 1);
   result = atk_selection_add_selection(ATK_SELECTION(obj), 5);
   g_assert(result);
   result = atk_selection_is_child_selected(ATK_SELECTION(obj), 5);
   g_assert(result);

   /*test AtkActionIface*/
   g_assert(ATK_IS_ACTION(obj));
   /* test set/get action description */
   eailu_test_action_description_all(ATK_ACTION(obj));
   action_count = atk_action_get_n_actions(ATK_ACTION(obj));
   g_assert(4 == action_count);
   action_name = atk_action_get_name(ATK_ACTION(obj), 0);
   g_assert(!strcmp("next", action_name));
   action_name = atk_action_get_name(ATK_ACTION(obj), 1);
   g_assert(!strcmp("previous", action_name));
   result = atk_action_set_description(ATK_ACTION(obj), 2,
                                       "start the slideshow");
   g_assert(result);
   action_description = atk_action_get_description(ATK_ACTION(obj), 2);
   g_assert(!strcmp("start the slideshow", action_description));
   result = atk_action_do_action(ATK_ACTION(obj), 0);
   g_assert(result);
   result = atk_selection_is_child_selected(ATK_SELECTION(obj), 6);
   g_assert(result);

   eailu_test_atk_focus(obj, TRUE);

   g_object_unref(obj);
   eail_test_code_called = TRUE;
}