]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - tests/src/plymouth.c
1b70f304f64ddde41f5a664cf88416b63c6d5900
[sojka/lightdm.git] / tests / src / plymouth.c
1 #include <stdlib.h>
2 #include <string.h>
3 #include <glib.h>
4 #include <glib-object.h>
5
6 #include "status.h"
7
8 static GKeyFile *config;
9
10 int
11 main (int argc, char **argv)
12 {
13 #if !defined(GLIB_VERSION_2_36)
14     g_type_init ();
15 #endif
16
17     status_connect (NULL, NULL);
18
19     config = g_key_file_new ();
20     g_key_file_load_from_file (config, g_build_filename (g_getenv ("LIGHTDM_TEST_ROOT"), "script", NULL), G_KEY_FILE_NONE, NULL);
21
22     if (!g_key_file_get_boolean (config, "test-plymouth-config", "enabled", NULL))
23         return EXIT_FAILURE;
24
25     if (argc == 2 && strcmp (argv[1], "--ping") == 0)
26     {
27         if (g_key_file_get_boolean (config, "test-plymouth-config", "active", NULL))
28         {
29             status_notify ("PLYMOUTH PING ACTIVE=TRUE");
30             return EXIT_SUCCESS;
31         }
32         else
33         {
34             status_notify ("PLYMOUTH PING ACTIVE=FALSE");
35             return EXIT_FAILURE;
36         }
37     }
38     if (argc == 2 && strcmp (argv[1], "--has-active-vt") == 0)
39     {
40         if (g_key_file_get_boolean (config, "test-plymouth-config", "has-active-vt", NULL))
41         {          
42             status_notify ("PLYMOUTH HAS-ACTIVE-VT=TRUE");
43             return EXIT_SUCCESS;
44         }
45         else
46         {
47             status_notify ("PLYMOUTH HAS-ACTIVE-VT=FALSE");
48             return EXIT_FAILURE;
49         }
50     }
51     if (argc == 2 && strcmp (argv[1], "deactivate") == 0)
52         status_notify ("PLYMOUTH DEACTIVATE");
53     if (argc == 2 && strcmp (argv[1], "quit") == 0)
54         status_notify ("PLYMOUTH QUIT RETAIN-SPLASH=FALSE");
55     if (argc == 3 && strcmp (argv[1], "quit") == 0 && strcmp (argv[2], "--retain-splash") == 0)
56         status_notify ("PLYMOUTH QUIT RETAIN-SPLASH=TRUE");
57
58     return EXIT_SUCCESS;
59 }