appinfo-test.c 627 Bytes
Newer Older
1 2 3 4 5 6 7 8
#include <stdlib.h>
#include <gio/gio.h>

int
main (int argc, char *argv[])
{
  const gchar *envvar;

9
  g_test_init (&argc, &argv, NULL);
10 11

  envvar = g_getenv ("GIO_LAUNCHED_DESKTOP_FILE");
12 13 14 15 16
  if (envvar != NULL)
    {
      gchar *expected;
      gint pid_from_env;

17
      expected = g_test_build_filename (G_TEST_BUILT, "appinfo-test.desktop", NULL);
18 19 20 21 22 23 24 25
      g_assert_cmpstr (envvar, ==, expected);
      g_free (expected);

      envvar = g_getenv ("GIO_LAUNCHED_DESKTOP_FILE_PID");
      g_assert (envvar != NULL);
      pid_from_env = atoi (envvar);
      g_assert_cmpint (pid_from_env, ==, getpid ());
    }
26 27 28 29

  return 0;
}