コード例 #1
0
int main(int argc, char **argv)
{
    g_test_init(&argc, &argv, NULL);

    g_test_add_func("/public/new", qdict_new_test);
    g_test_add_func("/public/put_obj", qdict_put_obj_test);
    g_test_add_func("/public/destroy_simple", qdict_destroy_simple_test);

    /* Continue, but now with fixtures */
    g_test_add_func("/public/get", qdict_get_test);
    g_test_add_func("/public/get_int", qdict_get_int_test);
    g_test_add_func("/public/get_try_int", qdict_get_try_int_test);
    g_test_add_func("/public/get_str", qdict_get_str_test);
    g_test_add_func("/public/get_try_str", qdict_get_try_str_test);
    g_test_add_func("/public/haskey_not", qdict_haskey_not_test);
    g_test_add_func("/public/haskey", qdict_haskey_test);
    g_test_add_func("/public/del", qdict_del_test);
    g_test_add_func("/public/to_qdict", qobject_to_qdict_test);
    g_test_add_func("/public/iterapi", qdict_iterapi_test);
    g_test_add_func("/public/flatten", qdict_flatten_test);
    g_test_add_func("/public/array_split", qdict_array_split_test);

    g_test_add_func("/errors/put_exists", qdict_put_exists_test);
    g_test_add_func("/errors/get_not_exists", qdict_get_not_exists_test);

    /* The Big one */
    if (g_test_slow()) {
        g_test_add_func("/stress/test", qdict_stress_test);
    }

    return g_test_run();
}
コード例 #2
0
static void delay(void)
{
	if (g_test_slow())
		g_usleep(G_USEC_PER_SEC / 10);

	while (gtk_events_pending())
		gtk_main_iteration();
}
コード例 #3
0
ファイル: gdbus-close-pending.c プロジェクト: GNOME/glib
static void
test_many_times (Fixture       *f,
                 gconstpointer  context)
{
  guint i, n_repeats;

  if (g_test_slow ())
    n_repeats = N_REPEATS_SLOW;
  else
    n_repeats = N_REPEATS;

  for (i = 0; i < n_repeats; i++)
    test_once (f, context);
}
コード例 #4
0
ファイル: test_suite.c プロジェクト: abiggerhammer/hammer
int main(int argc, char** argv) {
  g_test_init(&argc, &argv, NULL);

  // register various test suites...
  register_bitreader_tests();
  register_bitwriter_tests();
  register_parser_tests();
  register_grammar_tests();
  register_misc_tests();
  register_regression_tests();
  if (g_test_slow() || g_test_perf())
    register_benchmark_tests();

  g_test_run();
}
コード例 #5
0
ファイル: test.c プロジェクト: tristanheaven/gtkhash
int main(int argc, char **argv)
{
	gtk_test_init(&argc, &argv);

	hash_init();
	resources_register_resource();
	gui_init();
	list_init();

	// Ignore user input during testing
	gtk_widget_set_sensitive(GTK_WIDGET(gui.window), false);

	if (g_test_slow())
		gtk_widget_show_now(GTK_WIDGET(gui.window));

	callbacks_init();
	test_init();

	return g_test_run();
}
コード例 #6
0
ファイル: ivshmem-test.c プロジェクト: gkurz/qemu
int main(int argc, char **argv)
{
    int ret, fd;
    const char *arch = qtest_get_arch();
    gchar dir[] = "/tmp/ivshmem-test.XXXXXX";

    g_test_init(&argc, &argv, NULL);

    qtest_add_abrt_handler(abrt_handler, NULL);
    /* shm */
    tmpshm = mktempshm(TMPSHMSIZE, &fd);
    if (!tmpshm) {
        goto out;
    }
    tmpshmem = mmap(0, TMPSHMSIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
    g_assert(tmpshmem != MAP_FAILED);
    /* server */
    if (mkdtemp(dir) == NULL) {
        g_error("mkdtemp: %s", g_strerror(errno));
    }
    tmpdir = dir;
    tmpserver = g_strconcat(tmpdir, "/server", NULL);

    qtest_add_func("/ivshmem/single", test_ivshmem_single);
    qtest_add_func("/ivshmem/hotplug", test_ivshmem_hotplug);
    qtest_add_func("/ivshmem/memdev", test_ivshmem_memdev);
    if (g_test_slow()) {
        qtest_add_func("/ivshmem/pair", test_ivshmem_pair);
        if (strcmp(arch, "ppc64") != 0) {
            qtest_add_func("/ivshmem/server", test_ivshmem_server);
        }
    }

out:
    ret = g_test_run();
    cleanup();
    return ret;
}
コード例 #7
0
ファイル: int-set.c プロジェクト: svn2github/gwyddion
void
test_int_set_serialize(void)
{
    GRand *rng = g_rand_new_with_seed(42);
    gsize niter = g_test_slow() ? 200 : 100;

    for (guint iter = 0; iter < niter; iter++) {
        GwyIntSet *original = gwy_int_set_new();
        int_set_randomize(original, rng);
        GwyIntSet *copy;

        serializable_duplicate(GWY_SERIALIZABLE(original),
                               int_set_assert_equal_object);
        serializable_assign(GWY_SERIALIZABLE(original),
                            int_set_assert_equal_object);
        copy = GWY_INT_SET(serialize_and_back(G_OBJECT(original),
                                              int_set_assert_equal_object));
        int_set_assert_order(copy);
        g_object_unref(copy);
        g_object_unref(original);
    }
    g_rand_free(rng);
}
コード例 #8
0
ファイル: treeview-scrolling.c プロジェクト: rightpeter/gtk
int
main (int argc, char **argv)
{
	gtk_test_init (&argc, &argv);

	/* Scrolls before realization */
	add_tests (FALSE, BEFORE, FALSE, 0.0, scroll_no_align);
	if (g_test_thorough ())
		add_tests (TRUE, BEFORE, FALSE, 0.0, scroll_no_align);

	add_tests (FALSE, BEFORE, TRUE, 0.0, scroll_align_0_0);
	if (g_test_thorough ())
		add_tests (TRUE, BEFORE, TRUE, 0.0, scroll_align_0_0);

	add_tests (FALSE, BEFORE, TRUE, 0.5, scroll_align_0_5);
	if (g_test_thorough ())
		add_tests (TRUE, BEFORE, TRUE, 0.5, scroll_align_0_5);

	add_tests (FALSE, BEFORE, TRUE, 1.0, scroll_align_1_0);
	if (g_test_thorough ())
		add_tests (TRUE, BEFORE, TRUE, 1.0, scroll_align_1_0);

	/* Scrolls after realization */
	add_tests (FALSE, AFTER, FALSE, 0.0, scroll_after_no_align);
	if (g_test_thorough ())
		add_tests (TRUE, AFTER, FALSE, 0.0, scroll_after_no_align);

	add_tests (FALSE, AFTER, TRUE, 0.0, scroll_after_align_0_0);
	if (g_test_thorough ())
		add_tests (TRUE, AFTER, TRUE, 0.0, scroll_after_align_0_0);

	add_tests (FALSE, AFTER, TRUE, 0.5, scroll_after_align_0_5);
	if (g_test_thorough ())
		add_tests (TRUE, AFTER, TRUE, 0.5, scroll_after_align_0_5);

	add_tests (FALSE, AFTER, TRUE, 1.0, scroll_after_align_1_0);
	if (g_test_thorough ())
		add_tests (TRUE, AFTER, TRUE, 1.0, scroll_after_align_1_0);

	/* Scroll to end before realization, to a real position after */
	if (g_test_thorough ()) {
		add_tests (FALSE, BOTH, FALSE, 0.0, scroll_both_no_align);
		add_tests (TRUE, BOTH, FALSE, 0.0, scroll_both_no_align);

		add_tests (FALSE, BOTH, TRUE, 0.0, scroll_both_align_0_0);
		add_tests (TRUE, BOTH, TRUE, 0.0, scroll_both_align_0_0);

		add_tests (FALSE, BOTH, TRUE, 0.5, scroll_both_align_0_5);
		add_tests (TRUE, BOTH, TRUE, 0.5, scroll_both_align_0_5);

		add_tests (FALSE, BOTH, TRUE, 1.0, scroll_both_align_1_0);
		add_tests (TRUE, BOTH, TRUE, 1.0, scroll_both_align_1_0);
	}

	/* Test different alignments in view with single row */
	g_test_add ("/TreeView/scrolling/single-row/no-align",
		    ScrollFixture, "0",
		    scroll_fixture_single_setup,
		    scroll_no_align,
		    scroll_fixture_teardown);
	g_test_add ("/TreeView/scrolling/single-row/align-0.0",
		    ScrollFixture, "0",
		    scroll_fixture_single_setup,
		    scroll_align_0_0,
		    scroll_fixture_teardown);
	g_test_add ("/TreeView/scrolling/single-row/align-0.5",
		    ScrollFixture, "0",
		    scroll_fixture_single_setup,
		    scroll_align_0_5,
		    scroll_fixture_teardown);
	g_test_add ("/TreeView/scrolling/single-row/align-1.0",
		    ScrollFixture, "0",
		    scroll_fixture_single_setup,
		    scroll_align_1_0,
		    scroll_fixture_teardown);

	/* Test scrolling in a very large model; also very slow */
	if (g_test_slow ()) {
		g_test_add ("/TreeView/scrolling/large-model/constant-height/middle-no-align",
			    ScrollFixture, "50000",
			    scroll_fixture_constant_big_setup,
			    scroll_no_align,
			    scroll_fixture_teardown);
		g_test_add ("/TreeView/scrolling/large-model/constant-height/end-no-align",
			    ScrollFixture, "99999",
			    scroll_fixture_constant_big_setup,
			    scroll_no_align,
			    scroll_fixture_teardown);

		g_test_add ("/TreeView/scrolling/large-model/mixed-height/middle-no-align",
			    ScrollFixture, "50000",
			    scroll_fixture_mixed_big_setup,
			    scroll_no_align,
			    scroll_fixture_teardown);
		g_test_add ("/TreeView/scrolling/large-model/mixed-height/end-no-align",
			    ScrollFixture, "99999",
			    scroll_fixture_mixed_big_setup,
			    scroll_no_align,
			    scroll_fixture_teardown);
	}

	/* Test scrolling to a newly created row */
	g_test_add ("/TreeView/scrolling/new-row/path-0", ScrollFixture,
		    GINT_TO_POINTER (0),
		    scroll_fixture_constant_setup,
		    scroll_new_row,
		    scroll_fixture_teardown);
	g_test_add ("/TreeView/scrolling/new-row/path-4", ScrollFixture,
		    GINT_TO_POINTER (4),
		    scroll_fixture_constant_setup,
		    scroll_new_row,
		    scroll_fixture_teardown);
	/* We scroll to 8 to test a partial visible row.  The 8 is
	 * based on my font setting of "Vera Sans 11" and
	 * the separators set to 0.  (This should be made dynamic; FIXME).
	 */
	g_test_add ("/TreeView/scrolling/new-row/path-8", ScrollFixture,
		    GINT_TO_POINTER (8),
		    scroll_fixture_constant_setup,
		    scroll_new_row,
		    scroll_fixture_teardown);
	g_test_add ("/TreeView/scrolling/new-row/path-500", ScrollFixture,
		    GINT_TO_POINTER (500),
		    scroll_fixture_constant_setup,
		    scroll_new_row,
		    scroll_fixture_teardown);
	g_test_add ("/TreeView/scrolling/new-row/path-999", ScrollFixture,
		    GINT_TO_POINTER (999),
		    scroll_fixture_constant_setup,
		    scroll_new_row,
		    scroll_fixture_teardown);

	g_test_add ("/TreeView/scrolling/new-row/tree", ScrollFixture,
		    NULL,
		    scroll_fixture_tree_setup,
		    scroll_new_row_tree,
		    scroll_fixture_teardown);

	/* Test scrolling to a newly created row, in a mixed height model */
	g_test_add ("/TreeView/scrolling/new-row-mixed/path-0", ScrollFixture,
		    GINT_TO_POINTER (0),
		    scroll_fixture_mixed_setup,
		    scroll_new_row,
		    scroll_fixture_teardown);
	g_test_add ("/TreeView/scrolling/new-row-mixed/path-3", ScrollFixture,
		    GINT_TO_POINTER (3),
		    scroll_fixture_mixed_setup,
		    scroll_new_row,
		    scroll_fixture_teardown);
	/* We scroll to 8 to test a partial visible row.  The 8 is
	 * based on my font setting of "Vera Sans 11" and
	 * the separators set to 0.  (This should be made dynamic; FIXME).
	 */
	g_test_add ("/TreeView/scrolling/new-row-mixed/path-5", ScrollFixture,
		    GINT_TO_POINTER (5),
		    scroll_fixture_mixed_setup,
		    scroll_new_row,
		    scroll_fixture_teardown);
	g_test_add ("/TreeView/scrolling/new-row-mixed/path-500", ScrollFixture,
		    GINT_TO_POINTER (500),
		    scroll_fixture_mixed_setup,
		    scroll_new_row,
		    scroll_fixture_teardown);
	g_test_add ("/TreeView/scrolling/new-row-mixed/path-999", ScrollFixture,
		    GINT_TO_POINTER (999),
		    scroll_fixture_mixed_setup,
		    scroll_new_row,
		    scroll_fixture_teardown);

	g_test_add ("/TreeView/scrolling/new-row-mixed/tree", ScrollFixture,
		    NULL,
		    scroll_fixture_mixed_tree_setup,
		    scroll_new_row_tree,
		    scroll_fixture_teardown);

	/* Misc. tests */
	g_test_add ("/TreeView/scrolling/specific/bug-316689",
			ScrollFixture, NULL,
		    scroll_fixture_constant_setup, test_bug316689,
		    scroll_fixture_teardown);
	g_test_add_func ("/TreeView/scrolling/specific/bug-359231",
			test_bug359231);
	g_test_add ("/TreeView/scrolling/specific/bug-93584",
		    ScrollFixture, NULL,
		    scroll_fixture_tree_setup, test_bug93584,
		    scroll_fixture_teardown);
	g_test_add ("/TreeView/scrolling/specific/bug-111500",
		    ScrollFixture, NULL,
		    scroll_fixture_tree_setup, test_bug111500,
		    scroll_fixture_teardown);
	g_test_add ("/TreeView/scrolling/specific/bug-111500-mixed",
		    ScrollFixture, NULL,
		    scroll_fixture_mixed_tree_setup, test_bug111500_mixed,
		    scroll_fixture_teardown);
	g_test_add ("/TreeView/scrolling/specific/bug-163214",
		    ScrollFixture, NULL,
		    scroll_fixture_constant_setup, test_bug163214,
		    scroll_fixture_teardown);

	return g_test_run ();
}
コード例 #9
0
int
main (int argc, char **argv)
{
  clutter_test_init (&argc, &argv);

  /* This file is run through a sed script during the make step so the
     lines containing the tests need to be formatted on a single line
     each. To comment out a test use the SKIP or TODO macros. Using
     #if 0 would break the script. */

  /* sanity check for the test suite itself */
  TEST_CONFORM_TODO ("/suite", verify_failure);

  TEST_CONFORM_SIMPLE ("/actor", actor_add_child);
  TEST_CONFORM_SIMPLE ("/actor", actor_insert_child);
  TEST_CONFORM_SIMPLE ("/actor", actor_raise_child);
  TEST_CONFORM_SIMPLE ("/actor", actor_lower_child);
  TEST_CONFORM_SIMPLE ("/actor", actor_replace_child);
  TEST_CONFORM_SIMPLE ("/actor", actor_remove_child);
  TEST_CONFORM_SIMPLE ("/actor", actor_remove_all);
  TEST_CONFORM_SIMPLE ("/actor", actor_container_signals);
  TEST_CONFORM_SIMPLE ("/actor", actor_destruction);
  TEST_CONFORM_SIMPLE ("/actor", actor_anchors);
  TEST_CONFORM_SIMPLE ("/actor", actor_pick);
  TEST_CONFORM_SIMPLE ("/actor", actor_fixed_size);
  TEST_CONFORM_SIMPLE ("/actor", actor_preferred_size);
  TEST_CONFORM_SIMPLE ("/actor", actor_basic_layout);
  TEST_CONFORM_SIMPLE ("/actor", actor_margin_layout);
  TEST_CONFORM_SIMPLE ("/actor", actor_offscreen_redirect);
  TEST_CONFORM_SIMPLE ("/actor", actor_shader_effect);

  TEST_CONFORM_SIMPLE ("/actor/iter", actor_iter_traverse_children);
  TEST_CONFORM_SIMPLE ("/actor/iter", actor_iter_traverse_remove);
  TEST_CONFORM_SIMPLE ("/actor/iter", actor_iter_assignment);

  TEST_CONFORM_SIMPLE ("/actor/invariants", actor_initial_state);
  TEST_CONFORM_SIMPLE ("/actor/invariants", actor_shown_not_parented);
  TEST_CONFORM_SIMPLE ("/actor/invariants", actor_visibility_not_recursive);
  TEST_CONFORM_SIMPLE ("/actor/invariants", actor_realized);
  TEST_CONFORM_SIMPLE ("/actor/invariants", actor_realize_not_recursive);
  TEST_CONFORM_SIMPLE ("/actor/invariants", actor_map_recursive);
  TEST_CONFORM_SIMPLE ("/actor/invariants", actor_mapped);
  TEST_CONFORM_SIMPLE ("/actor/invariants", actor_show_on_set_parent);
  TEST_CONFORM_SIMPLE ("/actor/invariants", clone_no_map);
  TEST_CONFORM_SIMPLE ("/actor/invariants", actor_contains);
  TEST_CONFORM_SIMPLE ("/actor/invariants", default_stage);
  TEST_CONFORM_SIMPLE ("/actor/invariants", actor_pivot_transformation);

  TEST_CONFORM_SIMPLE ("/actor/opacity", opacity_label);
  TEST_CONFORM_SIMPLE ("/actor/opacity", opacity_rectangle);
  TEST_CONFORM_SIMPLE ("/actor/opacity", opacity_paint);

  TEST_CONFORM_SIMPLE ("/text", text_utf8_validation);
  TEST_CONFORM_SIMPLE ("/text", text_set_empty);
  TEST_CONFORM_SIMPLE ("/text", text_set_text);
  TEST_CONFORM_SIMPLE ("/text", text_append_some);
  TEST_CONFORM_SIMPLE ("/text", text_prepend_some);
  TEST_CONFORM_SIMPLE ("/text", text_insert);
  TEST_CONFORM_SIMPLE ("/text", text_delete_chars);
  TEST_CONFORM_SIMPLE ("/text", text_delete_text);
  TEST_CONFORM_SIMPLE ("/text", text_cursor);
  TEST_CONFORM_SIMPLE ("/text", text_event);
  TEST_CONFORM_SIMPLE ("/text", text_get_chars);
  TEST_CONFORM_SIMPLE ("/text", text_cache);
  TEST_CONFORM_SIMPLE ("/text", text_password_char);
  TEST_CONFORM_SIMPLE ("/text", text_idempotent_use_markup);

  TEST_CONFORM_SIMPLE ("/rectangle", rectangle_set_size);
  TEST_CONFORM_SIMPLE ("/rectangle", rectangle_set_color);

  TEST_CONFORM_SIMPLE ("/texture", texture_pick_with_alpha);
  TEST_CONFORM_SIMPLE ("/texture", texture_fbo);
  TEST_CONFORM_SIMPLE ("/texture/cairo", texture_cairo);

  TEST_CONFORM_SIMPLE ("/interval", interval_initial_state);
  TEST_CONFORM_SIMPLE ("/interval", interval_transform);

  TEST_CONFORM_SIMPLE ("/path", path_base);

  TEST_CONFORM_SIMPLE ("/binding-pool", binding_pool);

  TEST_CONFORM_SIMPLE ("/model", list_model_populate);
  TEST_CONFORM_SIMPLE ("/model", list_model_iterate);
  TEST_CONFORM_SIMPLE ("/model", list_model_filter);
  TEST_CONFORM_SIMPLE ("/model", list_model_from_script);
  TEST_CONFORM_SIMPLE ("/model", list_model_row_changed);

  TEST_CONFORM_SIMPLE ("/color", color_from_string_valid);
  TEST_CONFORM_SIMPLE ("/color", color_from_string_invalid);
  TEST_CONFORM_SIMPLE ("/color", color_to_string);
  TEST_CONFORM_SIMPLE ("/color", color_hls_roundtrip);
  TEST_CONFORM_SIMPLE ("/color", color_operators);

  TEST_CONFORM_SIMPLE ("/units", units_constructors);
  TEST_CONFORM_SIMPLE ("/units", units_string);
  TEST_CONFORM_SIMPLE ("/units", units_cache);

  TEST_CONFORM_SIMPLE ("/group", group_depth_sorting);

  TEST_CONFORM_SIMPLE ("/script", script_single);
  TEST_CONFORM_SIMPLE ("/script", script_child);
  TEST_CONFORM_SIMPLE ("/script", script_implicit_alpha);
  TEST_CONFORM_SIMPLE ("/script", script_object_property);
  TEST_CONFORM_SIMPLE ("/script", script_animation);
  TEST_CONFORM_SIMPLE ("/script", script_named_object);
  TEST_CONFORM_SIMPLE ("/script", script_layout_property);
  TEST_CONFORM_SIMPLE ("/script", animator_base);
  TEST_CONFORM_SIMPLE ("/script", animator_properties);
  TEST_CONFORM_SIMPLE ("/script", animator_multi_properties);
  TEST_CONFORM_SIMPLE ("/script", state_base);
  TEST_CONFORM_SIMPLE ("/script", script_margin);

  TEST_CONFORM_SIMPLE ("/timeline", timeline_base);
  TEST_CONFORM_SIMPLE ("/timeline", timeline_markers_from_script);
  TEST_CONFORM_SKIP (g_test_slow (), "/timeline", timeline_interpolation);
  TEST_CONFORM_SKIP (g_test_slow (), "/timeline", timeline_rewind);
  TEST_CONFORM_SIMPLE ("/timeline", timeline_progress_mode);
  TEST_CONFORM_SIMPLE ("/timeline", timeline_progress_step);

  TEST_CONFORM_SIMPLE ("/score", score_base);

  TEST_CONFORM_SIMPLE ("/behaviours", behaviours_base);

  TEST_CONFORM_SIMPLE ("/events", events_touch);

  /* FIXME - see bug https://bugzilla.gnome.org/show_bug.cgi?id=655588 */
  TEST_CONFORM_TODO ("/cally", cally_text);

#if 0
  TEST_CONFORM_SIMPLE ("/cogl", test_cogl_object);
  TEST_CONFORM_SIMPLE ("/cogl", test_cogl_fixed);
  TEST_CONFORM_SIMPLE ("/cogl", test_cogl_materials);
  TEST_CONFORM_SIMPLE ("/cogl", test_cogl_premult);
  TEST_CONFORM_SIMPLE ("/cogl", test_cogl_readpixels);

  TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_npot_texture);
  TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_multitexture);
  TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_mipmaps);
  TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_rectangle);
  TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_pixmap_x11);
  TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_get_set_data);
  TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_atlas_migration);

  TEST_CONFORM_SIMPLE ("/cogl/vertex-buffer", test_cogl_vertex_buffer_contiguous);
  TEST_CONFORM_SIMPLE ("/cogl/vertex-buffer", test_cogl_vertex_buffer_interleved);
  TEST_CONFORM_SIMPLE ("/cogl/vertex-buffer", test_cogl_vertex_buffer_mutability);

  /* left to the end because they aren't currently very orthogonal and tend to
   * break subsequent tests! */
  TEST_CONFORM_SIMPLE ("/cogl", test_cogl_viewport);
#endif

  return g_test_run ();
}