Mercurial > vim
annotate src/testdir/test_signals.vim @ 16275:ed5172ae1c32 v8.1.1142
patch 8.1.1142: no test for dragging the window separators with the mouse
commit https://github.com/vim/vim/commit/3fb01a53c685d8d7e7bd83c33500de80aed0d7c8
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Apr 9 21:52:02 2019 +0200
patch 8.1.1142: no test for dragging the window separators with the mouse
Problem: No test for dragging the window separators with the mouse.
Solution: Add a test. (Dominique Pelle, closes https://github.com/vim/vim/issues/4226)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 09 Apr 2019 22:00:05 +0200 |
parents | 1ab0d1f7807a |
children | a0e98821a2ed |
rev | line source |
---|---|
16084
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 " Test signal handling. |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 if !has('unix') |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 finish |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 endif |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 |
16192
1ab0d1f7807a
patch 8.1.1101: signals test may fail in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
16084
diff
changeset
|
7 if has('gui_running') |
1ab0d1f7807a
patch 8.1.1101: signals test may fail in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
16084
diff
changeset
|
8 " Signals only work for terminals, and won't work for GUI. |
1ab0d1f7807a
patch 8.1.1101: signals test may fail in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
16084
diff
changeset
|
9 finish |
1ab0d1f7807a
patch 8.1.1101: signals test may fail in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
16084
diff
changeset
|
10 endif |
1ab0d1f7807a
patch 8.1.1101: signals test may fail in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
16084
diff
changeset
|
11 |
16084
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 source shared.vim |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 " Test signal WINCH (window resize signal) |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 func Test_signal_WINCH() |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 let signals = system('kill -l') |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 if signals !~ '\<WINCH\>' |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 " signal WINCH is not available, skip the test. |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 return |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 endif |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 " We do not actually want to change the size of the terminal. |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 let old_WS = '' |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 if exists('&t_WS') |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 let old_WS = &t_WS |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 let &t_WS = '' |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 endif |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 let old_lines = &lines |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 let old_columns = &columns |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 let new_lines = &lines - 2 |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 let new_columns = &columns - 2 |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 exe 'set lines=' . new_lines |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 exe 'set columns=' . new_columns |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 call assert_equal(new_lines, &lines) |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 call assert_equal(new_columns, &columns) |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 " Send signal and wait for signal to be processed. |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 " 'lines' and 'columns' should have been restored |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 " after handing signal WINCH. |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 exe 'silent !kill -s WINCH ' . getpid() |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 call WaitForAssert({-> assert_equal(old_lines, &lines)}) |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 call assert_equal(old_columns, &columns) |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 if old_WS != '' |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 let &t_WS = old_WS |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 endif |
ed1482db2d72
patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 endfunc |