File tests/misc/menus_filetypes.c copied from file tests/misc/menus_cs.c (similarity 62%) (mode: 100644) (index 0bc33be04..af60a2fbd) |
3 |
3 |
#include <stddef.h> /* NULL */ |
#include <stddef.h> /* NULL */ |
4 |
4 |
#include <string.h> /* strcpy() */ |
#include <string.h> /* strcpy() */ |
5 |
5 |
|
|
6 |
|
#include "../../src/cfg/config.h" |
|
7 |
6 |
#include "../../src/compat/fs_limits.h" |
#include "../../src/compat/fs_limits.h" |
8 |
7 |
#include "../../src/engine/keys.h" |
#include "../../src/engine/keys.h" |
9 |
8 |
#include "../../src/modes/modes.h" |
#include "../../src/modes/modes.h" |
|
11 |
10 |
#include "../../src/ui/ui.h" |
#include "../../src/ui/ui.h" |
12 |
11 |
#include "../../src/utils/fs.h" |
#include "../../src/utils/fs.h" |
13 |
12 |
#include "../../src/cmd_core.h" |
#include "../../src/cmd_core.h" |
|
13 |
|
#include "../../src/filelist.h" |
|
14 |
|
#include "../../src/filetype.h" |
14 |
15 |
#include "../../src/status.h" |
#include "../../src/status.h" |
15 |
16 |
|
|
16 |
17 |
#include "utils.h" |
#include "utils.h" |
17 |
18 |
|
|
|
19 |
|
static char cwd[PATH_MAX + 1]; |
|
20 |
|
|
18 |
21 |
SETUP_ONCE() |
SETUP_ONCE() |
19 |
22 |
{ |
{ |
20 |
|
static char cwd[PATH_MAX + 1]; |
|
21 |
23 |
assert_non_null(get_cwd(cwd, sizeof(cwd))); |
assert_non_null(get_cwd(cwd, sizeof(cwd))); |
22 |
24 |
|
|
23 |
|
make_abs_path(cfg.colors_dir, sizeof(cfg.colors_dir), TEST_DATA_PATH, |
|
24 |
|
"color-schemes/", cwd); |
|
|
25 |
|
ft_init(NULL); |
|
26 |
|
ft_reset(0); |
25 |
27 |
} |
} |
26 |
28 |
|
|
27 |
29 |
SETUP() |
SETUP() |
|
... |
... |
SETUP() |
34 |
36 |
other_view = &rwin; |
other_view = &rwin; |
35 |
37 |
view_setup(&lwin); |
view_setup(&lwin); |
36 |
38 |
|
|
|
39 |
|
make_abs_path(lwin.curr_dir, sizeof(lwin.curr_dir), TEST_DATA_PATH, "", cwd); |
|
40 |
|
populate_dir_list(&lwin, 0); |
|
41 |
|
|
37 |
42 |
curr_stats.load_stage = -1; |
curr_stats.load_stage = -1; |
38 |
43 |
curr_stats.save_msg = 0; |
curr_stats.save_msg = 0; |
39 |
44 |
} |
} |
|
... |
... |
TEARDOWN() |
52 |
57 |
|
|
53 |
58 |
TEST(enter_loads_selected_colorscheme) |
TEST(enter_loads_selected_colorscheme) |
54 |
59 |
{ |
{ |
55 |
|
assert_success(exec_commands("colorscheme", &lwin, CIT_COMMAND)); |
|
56 |
|
|
|
57 |
|
strcpy(cfg.cs.name, "test-scheme"); |
|
58 |
|
cfg.cs.color[WIN_COLOR].fg = 1; |
|
59 |
|
cfg.cs.color[WIN_COLOR].bg = 2; |
|
60 |
|
cfg.cs.color[WIN_COLOR].attr = 3; |
|
|
60 |
|
assert_success(exec_commands("file", &lwin, CIT_COMMAND)); |
61 |
61 |
|
|
62 |
|
(void)vle_keys_exec(WK_G); |
|
63 |
62 |
(void)vle_keys_exec(WK_CR); |
(void)vle_keys_exec(WK_CR); |
64 |
63 |
|
|
65 |
|
assert_string_equal("good", cfg.cs.name); |
|
66 |
|
assert_int_equal(-1, cfg.cs.color[WIN_COLOR].fg); |
|
67 |
|
assert_int_equal(-1, cfg.cs.color[WIN_COLOR].bg); |
|
68 |
|
assert_int_equal(0, cfg.cs.color[WIN_COLOR].attr); |
|
|
64 |
|
char new_path[PATH_MAX + 1]; |
|
65 |
|
make_abs_path(new_path, sizeof(new_path), TEST_DATA_PATH, "color-schemes", |
|
66 |
|
cwd); |
|
67 |
|
assert_true(paths_are_same(lwin.curr_dir, new_path)); |
69 |
68 |
|
|
70 |
69 |
(void)vle_keys_exec(WK_ESC); |
(void)vle_keys_exec(WK_ESC); |
71 |
70 |
} |
} |