Beispiel #1
0
int main(int argc, char** argv)
{
    SoupServer* server;
    SoupURI* soup_uri;

    gtk_test_init(&argc, &argv, NULL);

    /* Hopefully make test independent of the path it's called from. */
    testutils_relative_chdir("Source/WebKit/gtk/tests/resources/test.html", argv[0]);

    server = soup_server_new(SOUP_SERVER_PORT, 0, NULL);
    soup_server_run_async(server);

    soup_server_add_handler(server, NULL, server_callback, NULL, NULL);

    soup_uri = soup_uri_new("http://127.0.0.1/");
    soup_uri_set_port(soup_uri, soup_server_get_port(server));

    base_uri = soup_uri_to_string(soup_uri, FALSE);
    soup_uri_free(soup_uri);

    g_test_bug_base("https://bugs.webkit.org/");
    g_test_add_func("/webkit/webview/icon-uri", test_webkit_web_view_icon_uri);
    g_test_add_func("/webkit/webview/adjustments", test_webkit_web_view_adjustments);
    g_test_add_func("/webkit/webview/destroy", test_webkit_web_view_destroy);
    g_test_add_func("/webkit/webview/grab_focus", test_webkit_web_view_grab_focus);
    g_test_add_func("/webkit/webview/window-features", test_webkit_web_view_window_features);
    g_test_add_func("/webkit/webview/webview-in-offscreen-window-does-not-crash", test_webkit_web_view_in_offscreen_window_does_not_crash);
    g_test_add_func("/webkit/webview/webview-does-not-steal-focus", test_webkit_web_view_does_not_steal_focus);
    g_test_add_data_func("/webkit/webview/fullscreen", GINT_TO_POINTER(FALSE), test_webkit_web_view_fullscreen);
    g_test_add_data_func("/webkit/webview/fullscreen-blocked", GINT_TO_POINTER(TRUE), test_webkit_web_view_fullscreen);
    g_test_add_func("/webkit/webview/file-chooser", test_webkit_web_view_file_chooser);

    return g_test_run ();
}
Beispiel #2
0
G_GNUC_NORETURN
static void test_run(G_GNUC_UNUSED void *data)
{
	gui_set_view(GUI_VIEW_TEXT);
	delay();

	// Test plain hash
	for (int i = 0; i < HASH_FUNCS_N; i++) {
		char *str = g_strdup_printf("/hash/func/%s", hash.funcs[i].name);
		g_test_add_data_func(str, &hash.funcs[i],
			(GTestDataFunc)test_hash_func);
		g_free(str);
	}

	// Test HMAC
	for (int i = 0; i < HASH_FUNCS_N; i++) {
		if (!hash.funcs[i].supported || !hash.funcs[i].hmac_supported)
			continue;

		char *str = g_strdup_printf("/hash/func/HMAC-%s", hash.funcs[i].name);
		g_test_add_data_func(str, &hash.funcs[i],
			(GTestDataFunc)test_hash_func_hmac);
		g_free(str);
	}

	g_test_set_nonfatal_assertions();

	exit(g_test_run());
}
Beispiel #3
0
int
main (int argc, char **argv)
{
	SoupServer *server;
	SoupURI *uri;
	int ret;

	test_init (argc, argv, NULL);

	server = soup_test_server_new (SOUP_TEST_SERVER_IN_THREAD);
	soup_server_add_handler (server, NULL, server_callback, NULL, NULL);
	uri = soup_test_server_get_uri (server, "http", NULL);
	base_uri = soup_uri_to_string (uri, FALSE);
	soup_uri_free (uri);

	g_test_add_data_func ("/context/blocking/explicit", GINT_TO_POINTER (FALSE), do_test1);
	g_test_add_data_func ("/context/blocking/thread-default", GINT_TO_POINTER (TRUE), do_test1);
	g_test_add_data_func ("/context/nested/explicit", GINT_TO_POINTER (FALSE), do_test2);
	g_test_add_data_func ("/context/nested/thread-default", GINT_TO_POINTER (TRUE), do_test2);
	g_test_add_func ("/context/multiple", do_multicontext_test);

	ret = g_test_run ();

	g_free (base_uri);
	soup_test_server_quit_unref (server);

	test_cleanup ();
	return ret;
}
Beispiel #4
0
int
main (int argc, char **argv)
{
	SoupServer *server;
	int ret;

	test_init (argc, argv, NULL);

	server = soup_test_server_new (TRUE);
	soup_server_add_handler (server, NULL, server_callback, NULL, NULL);
	base_uri = g_strdup_printf ("http://127.0.0.1:%u/",
				    soup_server_get_port (server));

	g_test_add_data_func ("/context/blocking/explicit", GINT_TO_POINTER (FALSE), do_test1);
	g_test_add_data_func ("/context/blocking/thread-default", GINT_TO_POINTER (TRUE), do_test1);
	g_test_add_data_func ("/context/nested/explicit", GINT_TO_POINTER (FALSE), do_test2);
	g_test_add_data_func ("/context/nested/thread-default", GINT_TO_POINTER (TRUE), do_test2);
	g_test_add_func ("/context/multiple", do_multicontext_test);

	ret = g_test_run ();

	g_free (base_uri);
	soup_test_server_quit_unref (server);

	test_cleanup ();
	return ret;
}
Beispiel #5
0
int
main (int argc, char **argv)
{
        char *our_response, *freegeoip_response, *fedora_geoip_response;
        int ret;

#if (!GLIB_CHECK_VERSION (2, 36, 0))
        g_type_init ();
#endif
        g_test_init (&argc, &argv, NULL);
        g_test_bug_base ("http://bugzilla.gnome.org/show_bug.cgi?id=");

        our_response = get_our_server_response ("ip=213.243.180.91");
        g_test_add_data_func ("/geoip/gclue-server-format",
                              our_response,
                              test_response_data);

        freegeoip_response = get_freegeoip_response ();
        g_test_add_data_func ("/geoip/freegeoip-format",
                              freegeoip_response,
                              test_response_data);

        fedora_geoip_response = get_fedora_geoip_response ();
        g_test_add_data_func ("/geoip/fedora-geoip-format",
                              fedora_geoip_response,
                              test_response_data);

        ret = g_test_run ();
        g_free (freegeoip_response);
        g_free (fedora_geoip_response);
        g_free (our_response);

        return ret;
}
Beispiel #6
0
int
main (int argc, char **argv)
{
	int ret;

	test_init (argc, argv, NULL);
	apache_init ();

	base_uri = "http://127.0.0.1:47524/";

	g_test_add_data_func ("/auth/main-tests", main_tests, do_batch_tests);
	g_test_add_data_func ("/auth/relogin-tests", relogin_tests, do_batch_tests);
	g_test_add_data_func ("/auth/basic-root-pspec-test", basic_root_pspace_test, do_batch_tests);
	g_test_add_func ("/auth/pipelined-auth", do_pipelined_auth_test);
	g_test_add_func ("/auth/digest-expiration", do_digest_expiration_test);
	g_test_add_func ("/auth/async-auth/good-password", do_async_auth_good_password_test);
	g_test_add_func ("/auth/async-auth/bad-password", do_async_auth_bad_password_test);
	g_test_add_func ("/auth/async-auth/no-password", do_async_auth_no_password_test);
	g_test_add_func ("/auth/select-auth", do_select_auth_test);
	g_test_add_func ("/auth/auth-close", do_auth_close_test);
	g_test_add_func ("/auth/infinite-auth", do_infinite_auth_test);
	g_test_add_func ("/auth/disappearing-auth", do_disappearing_auth_test);
	g_test_add_func ("/auth/clear-credentials", do_clear_credentials_test);
	g_test_add_func ("/auth/message-do-not-use-auth-cache", do_message_do_not_use_auth_cache_test);
	g_test_add_func ("/auth/authorization-header-request", do_message_has_authorization_header_test);

	ret = g_test_run ();

	test_cleanup ();
	return ret;
}
int main(int argc, char **argv)
{
  g_test_init (&argc, &argv, NULL);

  g_test_add_data_func ("/pixbuf/area-updated/ico", (gconstpointer) "test-images/reftests/squares.ico", test_area_updated_ico);
  g_test_add_data_func ("/pixbuf/area-updated/gif", (gconstpointer) "aero.gif", test_area_updated_anim);
  g_test_add_data_func ("/pixbuf/area-updated/gif2", (gconstpointer) "1_partyanimsm2.gif", test_area_updated_anim);
  g_test_add_data_func ("/pixbuf/area-updated/gif3", (gconstpointer) "test-animation.gif", test_area_updated_anim);

  return g_test_run ();
}
Beispiel #8
0
int
main (int argc, char *argv[])
{
	GError *error = NULL;
	GOptionContext *context;
	gchar **device_paths = NULL;
	guint i = 0;
	const GOptionEntry entries[] = {
		{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &device_paths, "[Device paths...]", NULL },
		{ NULL }
	};

	setlocale (LC_ALL, "");

#if !GLIB_CHECK_VERSION(2, 36, 0)
	g_type_init ();
#endif
	g_test_init (&argc, &argv, NULL);
	g_test_bug_base ("http://bugzilla.gnome.org/show_bug.cgi?id=");

	/* Parse our own command-line options */
	context = g_option_context_new ("- test disc functions");
	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);

	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
		g_print ("Option parsing failed: %s\n", error->message);
		return 1;
	}

	if (device_paths == NULL) {
		/* Don't want to error during check on some other machines */
		if (g_strcmp0 (g_get_user_name (), "hadess") != 0)
			return 0;

		/* We need to handle log messages produced by g_message so they're interpreted correctly by the GTester framework */
		g_log_set_handler (NULL, G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, log_handler, NULL);

		/* NOTE: A disc needs to be in /dev/dvd for this test to do anything useful. Not really any way to work around this. */
		g_test_add_data_func ("/disc/exists", "/dev/dvd", test_disc);
		g_test_add_data_func ("/disc/not-exists", "/this/does/not/exist", test_disc);

		return g_test_run ();
	}

	/* If we're passed device paths, test them instead of running the GTests */
	while (device_paths[i] != NULL)
		test_disc (device_paths[i++]);

	return 0;
}
/* Build the test suite */
static void
test_dbus_suite (void)
{
	g_test_add_func ("/dbus/interface/GetServers/None",   test_getservers_none);
	g_test_add_func ("/dbus/interface/GetServers/UCCS",   test_getservers_uccs);
	g_test_add_data_func ("/dbus/interface/GetServers/SLMock/citrix",  &slmock_table[0], test_getservers_slmock);
	g_test_add_data_func ("/dbus/interface/GetServers/SLMock/freerdp", &slmock_table[1], test_getservers_slmock);
	g_test_add_data_func ("/dbus/interface/GetServers/SLMock/big",     &slmock_table[2], test_getservers_slmock);
	g_test_add_func ("/dbus/interface/GetServers/SLMock/none",   test_getservers_slmock_none);
	g_test_add_func ("/dbus/interface/GetServers/SLMock/two",   test_getservers_slmock_two);
	g_test_add_func ("/dbus/interface/GetDomains/Basic",   test_getdomains_basic);
	g_test_add_func ("/dbus/interface/SetLastUsed/Basic",   test_setlastused_basic);

	return;
}
static void AddTest(const gchar *short_name, guint index,
                    GTestDataFunc test_func) {
  gchar *test_path = g_strdup_printf("/escalate_message_test/%s%d", short_name,
                                     index);
  g_test_add_data_func(test_path, GUINT_TO_POINTER(index), test_func);
  g_free(test_path);
}
Beispiel #11
0
gint main (gint argc, gchar *argv[])
{
	gint ret;

	g_type_init ();
	g_test_init (&argc, &argv, NULL);
	/*Create test suites and use more features of g_test */

	/*Register tests*/
	g_test_add_func ("/libews/connections", connection_tests_run);
	g_test_add_func ("/libews/setoofsettings", set_oof_settings_test_run);
	g_test_add_func ("/libews/getoofsettings", get_oof_settings_test_run);
	g_test_add_func ("/libews/autocompletion", autocompletion_tests_run);

	g_test_add_func ("/libews/syncfolder", op_tests_run);

	/* delete folder uses the data from create_folder test. */
	g_test_add_func ("/libews/createfolder", createfolder_tests_run);
	g_test_add_data_func ("/libews/deletefolder", &folder_id, deletefolder_tests_run);

	g_test_add_func ("/libews/cuditem", cuditem_tests_run);
	g_test_add_func ("/libews/getdelegate", get_delegate_tests_run);

	g_test_add_func ("/libews/getattachment", get_attachments_tests_run);

	ret = g_test_run ();
	finalize_test_data ();

	return ret;
}
Beispiel #12
0
int
main (int argc, char **argv)
{
  const GType *otypes;
  guint i;

  gtk_test_init (&argc, &argv);
  pixbuf_init ();
  gtk_test_register_all_types();
  
  otypes = gtk_test_list_all_types (NULL);
  for (i = 0; otypes[i]; i++)
    {
      gchar *testname;
      
      testname = g_strdup_printf ("/Default Values/%s",
				  g_type_name (otypes[i]));
      g_test_add_data_func (testname,
                            &otypes[i],
			    test_type);
      g_free (testname);
    }
  
  return g_test_run();
}
Beispiel #13
0
int
main (int argc, char **argv)
{
	SoupServer *server;
	char *uri;
	int ret;

	/* Force this test to use the dummy TLS backend */
	g_setenv ("GIO_USE_TLS", "dummy", TRUE);

	test_init (argc, argv, NULL);

	/* Make a non-SSL server and pretend that it's ssl, which is fine
	 * since we won't ever actually talk to it anyway. We don't
	 * currently test that failing to construct an SSL server works.
	 */
	server = soup_test_server_new (TRUE);
	soup_server_add_handler (server, NULL, server_handler, NULL, NULL);
	uri = g_strdup_printf ("https://127.0.0.1:%u/",
			       soup_server_get_port (server));

	g_test_add_func ("/no-ssl/session-properties", do_session_property_tests);
	g_test_add_data_func ("/no-ssl/request-error", uri, do_ssl_tests);

	ret = g_test_run ();

	g_free (uri);
	soup_test_server_quit_unref (server);

	test_cleanup ();
	return ret;
}
Beispiel #14
0
int main(int argc, char *argv[])
{
	guint i;

	if (!setlocale (LC_ALL, ""))
		g_error ("Locale not supported by C library!\n");

	g_test_init (&argc, &argv, NULL);
	g_test_bug_base ("http://bugzilla.mate.org/enter_bug.cgi?product=mate-terminal");

	for (i = 0; i < G_N_ELEMENTS (tests); ++i)
	{
		const TestEntry *test = &tests[i];
		char *name;

		name = g_strdup_printf ("/%s/%s/%s/%d/%s/%s",
		                        algos[test->algorithm],
		                        test->passphrase,
		                        test->seed,
		                        test->count,
		                        test->hex,
		                        test->btoe);
		g_test_add_data_func (name, test, skey_test);
		g_free (name);
	}

	return g_test_run ();
}
int
main (int argc, char **argv)
{
  char   *locale;
  char   *contents;

  /* Running in some locales will
   * break the tests as "ü" will be transliterated to
   * "ue" in de_DE, and 'u"' in the C locale.
   *
   * Work around that by forcing en_US with UTF-8 in
   * our tests
   * https://bugzilla.gnome.org/show_bug.cgi?id=650342 */

  locale = setlocale (LC_ALL, "en_US.UTF-8");
  if (locale == NULL)
    {
      g_debug("Missing en_US.UTF-8 locale, ignoring test.");
      return 0;
    }

  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  g_test_init (&argc, &argv, NULL);

  if (g_file_get_contents (TEST_SRCDIR "/canonicalization-test.txt", &contents, NULL, NULL) == FALSE)
    {
      g_warning ("Failed to load '%s'", TEST_SRCDIR "/canonicalization-test.txt");
      return 1;
    }

  g_test_add_data_func ("/printers/canonicalization", contents, test_canonicalization);

  return g_test_run ();
}
Beispiel #16
0
int
main (int argc, char **argv)
{
  const GType *otypes;
  guint i;
  gchar *schema_dir;
  GTestDBus *bus;
  GMainLoop *loop;
  gint result;

  /* These must be set before before gtk_test_init */
  g_setenv ("GIO_USE_VFS", "local", TRUE);
  g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
  g_setenv ("G_ENABLE_DIAGNOSTIC", "0", TRUE);

  gtk_test_init (&argc, &argv);
  gtk_test_register_all_types();

  /* g_test_build_filename must be called after gtk_test_init */
  schema_dir = g_test_build_filename (G_TEST_BUILT, "", NULL);
  g_setenv ("GSETTINGS_SCHEMA_DIR", schema_dir, TRUE);

  /* Create one test bus for all tests, as we have a lot of very small
   * and quick tests.
   */
  bus = g_test_dbus_new (G_TEST_DBUS_NONE);
  g_test_dbus_up (bus);

  otypes = gtk_test_list_all_types (NULL);
  for (i = 0; otypes[i]; i++)
    {
      gchar *testname;

      if (otypes[i] == GTK_TYPE_FILE_CHOOSER_NATIVE)
        continue;

      testname = g_strdup_printf ("/Default Values/%s",
				  g_type_name (otypes[i]));
      g_test_add_data_func (testname,
                            &otypes[i],
			    test_type);
      g_free (testname);
    }

  result = g_test_run();

  /* Work around the annoying issue that g_test_dbus_down is giving
   * us an "Error while sending AddMatch" that comes out of an idle
   */
  loop = g_main_loop_new (NULL, FALSE);
  g_timeout_add (1000, (GSourceFunc)g_main_loop_quit, loop);
  g_main_loop_run (loop);
  g_main_loop_unref (loop);

  g_test_dbus_down (bus);
  g_object_unref (bus);
  g_free (schema_dir);

  return result;
}
Beispiel #17
0
int
main (int argc, char **argv)
{
	SoupServer *server;
	SoupURI *uri;
	guint port;
	int ret;

	/* Force this test to use the dummy TLS backend */
	g_setenv ("GIO_USE_TLS", "dummy", TRUE);

	test_init (argc, argv, NULL);

	/* Make a non-SSL server and pretend that it's ssl, which is fine
	 * since we won't ever actually talk to it anyway. We don't
	 * currently test that failing to construct an SSL server works.
	 */
	server = soup_test_server_new (TRUE);
	soup_server_add_handler (server, NULL, server_handler, NULL, NULL);
	uri = soup_test_server_get_uri (server, "http", NULL);
	port = uri->port;
	soup_uri_set_scheme (uri, SOUP_URI_SCHEME_HTTPS);
	soup_uri_set_port (uri, port);

	g_test_add_func ("/no-ssl/session-properties", do_session_property_tests);
	g_test_add_data_func ("/no-ssl/request-error", uri, do_ssl_tests);

	ret = g_test_run ();

	soup_uri_free (uri);
	soup_test_server_quit_unref (server);

	test_cleanup ();
	return ret;
}
Beispiel #18
0
static int
run_all_tests (int argc, char **argv)
{
    GFile *dir, *file;
    GFileInfo *info;
    GFileEnumerator *children;
    GList *list = NULL;

    dir = g_file_new_for_path ("uri");
    children = g_file_enumerate_children (dir,
                                          G_FILE_ATTRIBUTE_STANDARD_NAME,
                                          0, NULL, NULL);
    while ((info = g_file_enumerator_next_file (children, NULL, NULL))) {
        const gchar *name = g_file_info_get_attribute_byte_string (info,
                            G_FILE_ATTRIBUTE_STANDARD_NAME);
        if (!g_str_has_suffix (name, ".test"))
            continue;
        list = g_list_insert_sorted (list, (gchar *) name, (GCompareFunc) strcmp);
    }

    while (list) {
        gchar *test_id = g_strconcat ("/", list->data, NULL);
        file = g_file_get_child (dir, list->data);
        g_test_add_data_func (test_id, file, run_test);
        g_free (test_id);
        list = g_list_delete_link (list, list);
    }

    return g_test_run ();
}
Beispiel #19
0
int main(int argc, char **argv)
{
	g_test_init(&argc, &argv, NULL);

/*
 * As all our architectures are little-endian except for
 * PowerPC, and the Binder wire-format differs slightly
 * depending on endian-ness, the following guards against test
 * failures when run on PowerPC.
 */
#if BYTE_ORDER == LITTLE_ENDIAN

	g_test_add_data_func("/testgrilreply/gprs-context: "
				"invalid SETUP_DATA_CALL Test 1",
				&reply_data_call_invalid_1,
				test_reply_data_call_invalid);

	g_test_add_data_func("/testgrilreply/gprs-context: "
				"invalid SETUP_DATA_CALL Test 2",
				&reply_data_call_invalid_2,
				test_reply_data_call_invalid);

	g_test_add_data_func("/testgrilreply/gprs-context: "
				"invalid SETUP_DATA_CALL Test 3",
				&reply_data_call_invalid_3,
				test_reply_data_call_invalid);

	g_test_add_data_func("/testgrilreply/gprs-context: "
				"invalid SETUP_DATA_CALL Test 4",
				&reply_data_call_invalid_4,
				test_reply_data_call_invalid);

	g_test_add_data_func("/testgrilreply/gprs-context: "
				"invalid SETUP_DATA_CALL Test 5",
				&reply_data_call_invalid_5,
				test_reply_data_call_invalid);

	g_test_add_data_func("/testgrilreply/gprs-context: "
				"invalid SETUP_DATA_CALL Test 6",
				&reply_data_call_invalid_6,
				test_reply_data_call_invalid);

	g_test_add_data_func("/testgrilreply/gprs-context: "
				"invalid SETUP_DATA_CALL Test 7",
				&reply_data_call_invalid_7,
				test_reply_data_call_invalid);

	g_test_add_data_func("/testgrilreply/gprs-context: "
				"valid SETUP_DATA_CALL Test 1",
				&reply_data_call_valid_1,
				test_reply_data_call_valid);

#endif

	return g_test_run();
}
Beispiel #20
0
int main(int argc, char* argv[])
{
    g_test_init(&argc, &argv, NULL);
    g_test_add_func(TEST_PREFIX "null", test_history_null);
    g_test_add_func(TEST_PREFIX "basic", test_history_basic);
    g_test_add_func(TEST_PREFIX "clear", test_history_clear);
    g_test_add_func(TEST_PREFIX "median", test_history_median);
    g_test_add_func(TEST_PREFIX "size", test_history_size);
    g_test_add_func(TEST_PREFIX "interval", test_history_interval);
    g_test_add_data_func(TEST_PREFIX "data1", &data1, test_history_data);
    g_test_add_data_func(TEST_PREFIX "data2", &data2, test_history_data);
    g_test_add_data_func(TEST_PREFIX "data3", &data3, test_history_data);
    g_test_add_data_func(TEST_PREFIX "data4", &data4, test_history_data);
    g_test_add_data_func(TEST_PREFIX "data5", &data5, test_history_data);
    test_init(&test_opt, argc, argv);
    return g_test_run();
}
Beispiel #21
0
int main (int argc, char **argv)
{
  TestData td = {NULL,};
  int r;

  test_data_init (&td);

  g_test_init (&argc, &argv, NULL);

  g_test_add_data_func ("/test-pull-c/multi-nochange", &td, test_pull_multi_nochange);
  g_test_add_data_func ("/test-pull-c/multi-ok-error-repeat", &td, test_pull_multi_error_then_ok);

  r = g_test_run();
  g_clear_object (&td.repo);

  return r;
}
int main (int argc, char *argv[])
{
  g_test_init (&argc, &argv, NULL);

  g_test_add_data_func ("/utf8/offsets", longline, test_utf8);
  g_test_add_func ("/utf8/lengths", test_length);
  g_test_add_func ("/utf8/find", test_find);

  return g_test_run ();
}
Beispiel #23
0
static void
add_gtk_container_tests_for_type (GType  type)
{
  gchar const* name = g_type_name (type);
  GString    * path = g_string_new ("");

  g_string_append_printf (path, "/%s/<<GtkContainer>>/GType", name);
  g_test_add_data_func (path->str, GSIZE_TO_POINTER (type), (void (*) ())test_container_type);
  g_string_set_size (path, 0);

  g_string_append_printf (path, "/%s/<<GtkContainer>>/add", name);
  g_test_add_data_func (path->str, GSIZE_TO_POINTER (type), (void (*) ())test_container_add);
  g_string_set_size (path, 0);

  g_string_append_printf (path, "/%s/<<GtkContainer>>/remove", name);
  g_test_add_data_func (path->str, GSIZE_TO_POINTER (type), (void (*) ())test_container_remove);

  g_string_free (path, TRUE);
}
Beispiel #24
0
static void
add_gtk_widget_tests_for_type (GType  type)
{
  gchar const* name = g_type_name (type);
  GString* path = g_string_new ("");

  g_string_append_printf (path, "/%s/<<GtkWidget>>/GType", name);
  g_test_add_data_func (path->str, GSIZE_TO_POINTER (type), (void (*) ())test_widget_type);
  g_string_set_size (path, 0);

  g_string_append_printf (path, "/%s/<<GtkWidget>>/life-cycle", name);
  g_test_add_data_func (path->str, GSIZE_TO_POINTER (type), (void (*) ())test_widget_life_cycle);
  g_string_set_size (path, 0);

  g_string_append_printf (path, "/%s/<<GtkWidget>>/windows", name);
  g_test_add_data_func (path->str, GSIZE_TO_POINTER (type), (void (*) ())test_widget_windows);

  g_string_free (path, TRUE);
}
Beispiel #25
0
static void
add_render_tests (gpointer element, gpointer user_data)
{
	const char *filename = element;
	char *test_path = g_strdup_printf ("/render/%s", (char *) element + sizeof (SUITE_DATA_DIRECTORY));

	g_test_add_data_func (test_path, filename, render_test);

	g_free (test_path);
}
Beispiel #26
0
int main(int argc, char **argv)
{
    size_t i;

    g_test_init(&argc, &argv, NULL);

    g_assert(qcrypto_init(NULL) == 0);

    for (i = 0; i < G_N_ELEMENTS(test_data); i++) {
        g_test_add_data_func(test_data[i].path, &test_data[i], test_xts);
    }

    return g_test_run();
}
Beispiel #27
0
int
main (int argc, char *argv[])
{
  guint i;

  setlocale (LC_ALL, "");

  g_test_init (&argc, &argv, NULL);

  for (i = 0; i < G_N_ELEMENTS (tests); ++i)
    {
      gchar *name;

      name = g_strdup_printf ("/gschema/%s%s", tests[i].name, tests[i].opt ? "/opt" : "");
      g_test_add_data_func (name, &tests[i], (gpointer) test_schema);
      g_free (name);

      name = g_strdup_printf ("/gschema/%s%s/subprocess/do_compile", tests[i].name, tests[i].opt ? "/opt" : "");
      g_test_add_data_func (name, &tests[i], (gpointer) test_schema_do_compile);
      g_free (name);
    }

  return g_test_run ();
}
Beispiel #28
0
static void
add_tests(const gchar **testlist, const gchar *path, void (test_func)(gconstpointer))
{
    const gchar **ptr;
    gchar *testname;
    
    for(ptr = testlist; *ptr; ptr += 2)
	{
	    if((!have_wmf && strstr(ptr[0], "WMF")) || (!have_emf && strstr(ptr[0], "EMF")))
            continue;
		testname = g_strconcat(path, ptr[0], NULL);
		g_test_add_data_func(testname, ptr[1], test_func);
		g_free(testname);
	}
}
Beispiel #29
0
/* This function adds all the RTF tests to the test suite. It skips tests that
load WMF and EMF files if those modules are not compiled into GdkPixbuf. The
human tests are only added if the test suite was invoked with '-m=perf
-m=thorough'.*/
void
add_rtf_tests(void)
{
    check_wmf_and_emf();
    
    /* Fail cases */
	/* Nonexistent filename case */
	g_test_add_data_func("/rtf/parse/fail/Nonexistent filename", "", rtf_fail_case);
	/* Cases from http://www.codeproject.com/KB/recipes/RtfConverter.aspx */
	add_tests(codeprojectfailcases, "/rtf/parse/fail/", rtf_fail_case);
	/* Other */
	add_tests(variousfailcases, "/rtf/parse/fail/", rtf_fail_case);

	/* Pass cases */
	/* Examples from 'RTF Pocket Guide' by Sean M. Burke */
	add_tests(rtfbookexamples, "/rtf/parse/pass/", rtf_parse_pass_case);
	/* From http://www.codeproject.com/KB/recipes/RtfConverter.aspx */
	add_tests(codeprojectpasscases, "/rtf/parse/pass/", rtf_parse_pass_case);
	/* Other */
	add_tests(variouspasscases, "/rtf/parse/pass/", rtf_parse_pass_case);
	/* These tests export the RTF to a string and re-import it */
	add_tests(rtfbookexamples, "/rtf/write/", rtf_write_pass_case);
	add_tests(codeprojectpasscases, "/rtf/write/", rtf_write_pass_case);
	add_tests(variouspasscases, "/rtf/write/", rtf_write_pass_case);
    /* RTFD tests */
    g_test_add_data_func("/rtf/parse/pass/RTFD test", "rtfdtest.rtfd", rtf_parse_pass_case);
    g_test_add_data_func("/rtf/write/RTFD test", "rtfdtest.rtfd", rtf_write_pass_case);
    
    /* Human tests -- only on thorough testing */
    if(g_test_thorough())
    {
        add_tests(rtfbookexamples, "/rtf/parse/human/", rtf_parse_human_approval_case);
        add_tests(codeprojectpasscases, "/rtf/parse/human/", rtf_parse_human_approval_case);
        add_tests(variouspasscases, "/rtf/parse/human/", rtf_parse_human_approval_case);
    }
}
Beispiel #30
0
int main(int argc, char **argv)
{
    size_t i;
    char name[64];

    g_test_init(&argc, &argv, NULL);
    g_assert(qcrypto_init(NULL) == 0);

    for (i = 512; i <= 64 * KiB; i *= 2) {
        memset(name, 0 , sizeof(name));
        snprintf(name, sizeof(name), "/crypto/hash/speed-%zu", i);
        g_test_add_data_func(name, (void *)i, test_hash_speed);
    }

    return g_test_run();
}