Merge branch 'experimental' into cookie_daemon
[uzbl-mobile] / tests / test-command.c
1 /* -*- c-basic-offset: 4; -*- */
2 #define _POSIX_SOURCE
3
4 #include <gtk/gtk.h>
5 #include <gdk/gdkx.h>
6 #include <gdk/gdkkeysyms.h>
7 #include <sys/socket.h>
8 #include <sys/stat.h>
9 #include <sys/types.h>
10 #include <sys/un.h>
11 #include <sys/utsname.h>
12 #include <sys/time.h>
13 #include <webkit/webkit.h>
14 #include <libsoup/soup.h>
15 #include <JavaScriptCore/JavaScript.h>
16
17 #include <stdio.h>
18 #include <string.h>
19 #include <unistd.h>
20 #include <stdlib.h>
21 #include <errno.h>
22 #include <fcntl.h>
23 #include <signal.h>
24
25 #include <uzbl.h>
26 #include <config.h>
27
28 extern Uzbl uzbl;
29
30 void
31 test_keycmd (void) {
32   add_binding("insert", "set insert_mode = 1");
33   add_binding("command", "set insert_mode = 0");
34
35   /* the 'keycmd' command */
36   parse_command("keycmd", "insert", NULL);
37
38   g_assert_cmpint(1, ==, uzbl.behave.insert_mode);
39   g_assert_cmpstr("", ==, uzbl.state.keycmd);
40
41   /* setting the keycmd variable directly, equivalent to the 'keycmd' comand */
42   set_var_value("keycmd", "command");
43
44   g_assert_cmpint(0, ==, uzbl.behave.insert_mode);
45   g_assert_cmpstr("", ==, uzbl.state.keycmd);
46 }
47
48 int
49 main (int argc, char *argv[]) {
50     g_type_init();
51     g_test_init(&argc, &argv, NULL);
52
53     g_test_add_func("/test-command/keycmd", test_keycmd);
54
55     initialize(argc, argv);
56
57     return g_test_run();
58 }
59
60 /* vi: set et ts=4: */