annotate src/testdir/screendump.vim @ 16818:14c0e527b63c

Added tag v8.1.1410 for changeset 069ee8dc8c8dbc316f71aeb8e936d45150a8487e
author Bram Moolenaar <Bram@vim.org>
date Mon, 27 May 2019 22:00:07 +0200
parents 8cc31b1b1d23
children 18ec0b92f431
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Functions shared by tests making screen dumps.
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 " Only load this script once.
13329
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13322
diff changeset
4 if exists('*CanRunVimInTerminal')
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 finish
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 endif
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents: 13845
diff changeset
8 " For most tests we need to be able to run terminal Vim with 256 colors. On
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents: 13845
diff changeset
9 " MS-Windows the console only has 16 colors and the GUI can't run in a
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents: 13845
diff changeset
10 " terminal.
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents: 13845
diff changeset
11 func CanRunVimInTerminal()
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents: 13845
diff changeset
12 return has('terminal') && !has('win32')
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents: 13845
diff changeset
13 endfunc
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents: 13845
diff changeset
14
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents: 13845
diff changeset
15 " Skip the rest if there is no terminal feature at all.
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents: 13845
diff changeset
16 if !has('terminal')
13329
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13322
diff changeset
17 finish
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13322
diff changeset
18 endif
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13322
diff changeset
19
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 source shared.vim
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 " Run Vim with "arguments" in a new terminal window.
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 " By default uses a size of 20 lines and 75 columns.
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 " Returns the buffer number of the terminal.
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 "
13541
296d02b0637f patch 8.0.1644: terminal API tests still fail
Christian Brabandt <cb@256bit.org>
parents: 13537
diff changeset
26 " Options is a dictionary, these items are recognized:
296d02b0637f patch 8.0.1644: terminal API tests still fail
Christian Brabandt <cb@256bit.org>
parents: 13537
diff changeset
27 " "rows" - height of the terminal window (max. 20)
296d02b0637f patch 8.0.1644: terminal API tests still fail
Christian Brabandt <cb@256bit.org>
parents: 13537
diff changeset
28 " "cols" - width of the terminal window (max. 78)
16477
8cc31b1b1d23 patch 8.1.1242: no cmdline redraw when tabpages have different 'cmdheight'
Bram Moolenaar <Bram@vim.org>
parents: 16328
diff changeset
29 " "statusoff" - number of lines the status is offset from default
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 func RunVimInTerminal(arguments, options)
13515
eb960e9c75c8 patch 8.0.1631: testing with Vim running in terminal is a bit flaky
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
31 " If Vim doesn't exit a swap file remains, causing other tests to fail.
eb960e9c75c8 patch 8.0.1631: testing with Vim running in terminal is a bit flaky
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
32 " Remove it here.
eb960e9c75c8 patch 8.0.1631: testing with Vim running in terminal is a bit flaky
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
33 call delete(".swp")
eb960e9c75c8 patch 8.0.1631: testing with Vim running in terminal is a bit flaky
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
34
13529
f5655d70484f patch 8.0.1638: popup test fails depending on environment variable
Christian Brabandt <cb@256bit.org>
parents: 13515
diff changeset
35 if exists('$COLORFGBG')
f5655d70484f patch 8.0.1638: popup test fails depending on environment variable
Christian Brabandt <cb@256bit.org>
parents: 13515
diff changeset
36 " Clear $COLORFGBG to avoid 'background' being set to "dark", which will
f5655d70484f patch 8.0.1638: popup test fails depending on environment variable
Christian Brabandt <cb@256bit.org>
parents: 13515
diff changeset
37 " only be corrected if the response to t_RB is received, which may be too
f5655d70484f patch 8.0.1638: popup test fails depending on environment variable
Christian Brabandt <cb@256bit.org>
parents: 13515
diff changeset
38 " late.
f5655d70484f patch 8.0.1638: popup test fails depending on environment variable
Christian Brabandt <cb@256bit.org>
parents: 13515
diff changeset
39 let $COLORFGBG = ''
f5655d70484f patch 8.0.1638: popup test fails depending on environment variable
Christian Brabandt <cb@256bit.org>
parents: 13515
diff changeset
40 endif
f5655d70484f patch 8.0.1638: popup test fails depending on environment variable
Christian Brabandt <cb@256bit.org>
parents: 13515
diff changeset
41
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 " Make a horizontal and vertical split, so that we can get exactly the right
13535
e9ffb5b35266 patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents: 13529
diff changeset
43 " size terminal window. Works only when the current window is full width.
e9ffb5b35266 patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents: 13529
diff changeset
44 call assert_equal(&columns, winwidth(0))
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 split
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 vsplit
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47
13322
0dc2e4998a15 patch 8.0.1535: C syntax test still fails when using gvim
Christian Brabandt <cb@256bit.org>
parents: 13320
diff changeset
48 " Always do this with 256 colors and a light background.
0dc2e4998a15 patch 8.0.1535: C syntax test still fails when using gvim
Christian Brabandt <cb@256bit.org>
parents: 13320
diff changeset
49 set t_Co=256 background=light
0dc2e4998a15 patch 8.0.1535: C syntax test still fails when using gvim
Christian Brabandt <cb@256bit.org>
parents: 13320
diff changeset
50 hi Normal ctermfg=NONE ctermbg=NONE
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51
13541
296d02b0637f patch 8.0.1644: terminal API tests still fail
Christian Brabandt <cb@256bit.org>
parents: 13537
diff changeset
52 " Make the window 20 lines high and 75 columns, unless told otherwise.
296d02b0637f patch 8.0.1644: terminal API tests still fail
Christian Brabandt <cb@256bit.org>
parents: 13537
diff changeset
53 let rows = get(a:options, 'rows', 20)
296d02b0637f patch 8.0.1644: terminal API tests still fail
Christian Brabandt <cb@256bit.org>
parents: 13537
diff changeset
54 let cols = get(a:options, 'cols', 75)
16477
8cc31b1b1d23 patch 8.1.1242: no cmdline redraw when tabpages have different 'cmdheight'
Bram Moolenaar <Bram@vim.org>
parents: 16328
diff changeset
55 let statusoff = get(a:options, 'statusoff', 1)
13537
3fa880445c99 patch 8.0.1642: running Vim in terminal fails with two windows
Christian Brabandt <cb@256bit.org>
parents: 13535
diff changeset
56
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 let cmd = GetVimCommandClean()
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents: 13845
diff changeset
58
13320
a90063ec1cd6 patch 8.0.1534: C syntax test fails when using gvim
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
59 " Add -v to have gvim run in the terminal (if possible)
a90063ec1cd6 patch 8.0.1534: C syntax test fails when using gvim
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
60 let cmd .= ' -v ' . a:arguments
16314
606a49386aa1 patch 8.1.1162: incorrect coverage information; typo in color name
Bram Moolenaar <Bram@vim.org>
parents: 16249
diff changeset
61 let buf = term_start(cmd, {
606a49386aa1 patch 8.1.1162: incorrect coverage information; typo in color name
Bram Moolenaar <Bram@vim.org>
parents: 16249
diff changeset
62 \ 'curwin': 1,
606a49386aa1 patch 8.1.1162: incorrect coverage information; typo in color name
Bram Moolenaar <Bram@vim.org>
parents: 16249
diff changeset
63 \ 'term_rows': rows,
606a49386aa1 patch 8.1.1162: incorrect coverage information; typo in color name
Bram Moolenaar <Bram@vim.org>
parents: 16249
diff changeset
64 \ 'term_cols': cols,
606a49386aa1 patch 8.1.1162: incorrect coverage information; typo in color name
Bram Moolenaar <Bram@vim.org>
parents: 16249
diff changeset
65 \ })
13845
f22db93bd887 patch 8.0.1794: duplicate term options after renaming
Christian Brabandt <cb@256bit.org>
parents: 13798
diff changeset
66 if &termwinsize == ''
15653
59a1ff689b4d patch 8.1.0834: GUI may wait too long before dealing with messages
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
67 " in the GUI we may end up with a different size, try to set it.
59a1ff689b4d patch 8.1.0834: GUI may wait too long before dealing with messages
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
68 if term_getsize(buf) != [rows, cols]
59a1ff689b4d patch 8.1.0834: GUI may wait too long before dealing with messages
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
69 call term_setsize(buf, rows, cols)
59a1ff689b4d patch 8.1.0834: GUI may wait too long before dealing with messages
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
70 endif
13698
404b89cb1e2a patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents: 13650
diff changeset
71 call assert_equal([rows, cols], term_getsize(buf))
404b89cb1e2a patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents: 13650
diff changeset
72 else
404b89cb1e2a patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents: 13650
diff changeset
73 let rows = term_getsize(buf)[0]
404b89cb1e2a patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents: 13650
diff changeset
74 let cols = term_getsize(buf)[1]
404b89cb1e2a patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents: 13650
diff changeset
75 endif
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents: 13845
diff changeset
77 " Wait for "All" or "Top" of the ruler to be shown in the last line or in
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents: 13845
diff changeset
78 " the status line of the last window. This can be quite slow (e.g. when
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents: 13845
diff changeset
79 " using valgrind).
13798
415185e2c970 patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents: 13698
diff changeset
80 " If it fails then show the terminal contents for debugging.
415185e2c970 patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents: 13698
diff changeset
81 try
16477
8cc31b1b1d23 patch 8.1.1242: no cmdline redraw when tabpages have different 'cmdheight'
Bram Moolenaar <Bram@vim.org>
parents: 16328
diff changeset
82 call WaitFor({-> len(term_getline(buf, rows)) >= cols - 1 || len(term_getline(buf, rows - statusoff)) >= cols - 1})
13798
415185e2c970 patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents: 13698
diff changeset
83 catch /timed out after/
415185e2c970 patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents: 13698
diff changeset
84 let lines = map(range(1, rows), {key, val -> term_getline(buf, val)})
415185e2c970 patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents: 13698
diff changeset
85 call assert_report('RunVimInTerminal() failed, screen contents: ' . join(lines, "<NL>"))
415185e2c970 patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents: 13698
diff changeset
86 endtry
13559
af68603e213d patch 8.0.1653: screen dump is made too soon
Christian Brabandt <cb@256bit.org>
parents: 13541
diff changeset
87
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 return buf
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 endfunc
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 " Stop a Vim running in terminal buffer "buf".
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 func StopVimInTerminal(buf)
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 call assert_equal("running", term_getstatus(a:buf))
14025
eb5ee7479d31 patch 8.1.0030: stoping Vim running in a terminal may not work
Christian Brabandt <cb@256bit.org>
parents: 14019
diff changeset
94
eb5ee7479d31 patch 8.1.0030: stoping Vim running in a terminal may not work
Christian Brabandt <cb@256bit.org>
parents: 14019
diff changeset
95 " CTRL-O : works both in Normal mode and Insert mode to start a command line.
eb5ee7479d31 patch 8.1.0030: stoping Vim running in a terminal may not work
Christian Brabandt <cb@256bit.org>
parents: 14019
diff changeset
96 " In Command-line it's inserted, the CTRL-U removes it again.
14031
d1eac0853a20 patch 8.1.0033: keys to stop Vim in terminal are wrong
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
97 call term_sendkeys(a:buf, "\<C-O>:\<C-U>qa!\<cr>")
14025
eb5ee7479d31 patch 8.1.0030: stoping Vim running in a terminal may not work
Christian Brabandt <cb@256bit.org>
parents: 14019
diff changeset
98
13798
415185e2c970 patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents: 13698
diff changeset
99 call WaitForAssert({-> assert_equal("finished", term_getstatus(a:buf))})
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 only!
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 endfunc
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 " Verify that Vim running in terminal buffer "buf" matches the screen dump.
13329
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13322
diff changeset
104 " "options" is passed to term_dumpwrite().
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 " The file name used is "dumps/{filename}.dump".
14693
156a7c5328a7 patch 8.1.0359: no clue what test failed when using a screendump twice
Christian Brabandt <cb@256bit.org>
parents: 14031
diff changeset
106 " Optionally an extra argument can be passed which is prepended to the error
156a7c5328a7 patch 8.1.0359: no clue what test failed when using a screendump twice
Christian Brabandt <cb@256bit.org>
parents: 14031
diff changeset
107 " message. Use this when using the same dump file with different options.
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 " Will wait for up to a second for the screen dump to match.
14693
156a7c5328a7 patch 8.1.0359: no clue what test failed when using a screendump twice
Christian Brabandt <cb@256bit.org>
parents: 14031
diff changeset
109 " Returns non-zero when verification fails.
156a7c5328a7 patch 8.1.0359: no clue what test failed when using a screendump twice
Christian Brabandt <cb@256bit.org>
parents: 14031
diff changeset
110 func VerifyScreenDump(buf, filename, options, ...)
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 let reference = 'dumps/' . a:filename . '.dump'
16150
b23048205589 patch 8.1.1080: when a screendump test fails, moving the file is a hassle
Bram Moolenaar <Bram@vim.org>
parents: 15916
diff changeset
112 let testfile = 'failed/' . a:filename . '.dump'
b23048205589 patch 8.1.1080: when a screendump test fails, moving the file is a hassle
Bram Moolenaar <Bram@vim.org>
parents: 15916
diff changeset
113
16326
1679b9f54946 patch 8.1.1168: not all screen update code of terminal is executed in tests
Bram Moolenaar <Bram@vim.org>
parents: 16314
diff changeset
114 " Redraw to execut the code that updates the screen. Otherwise we get the
1679b9f54946 patch 8.1.1168: not all screen update code of terminal is executed in tests
Bram Moolenaar <Bram@vim.org>
parents: 16314
diff changeset
115 " text and attributes only from the internal buffer.
1679b9f54946 patch 8.1.1168: not all screen update code of terminal is executed in tests
Bram Moolenaar <Bram@vim.org>
parents: 16314
diff changeset
116 redraw
1679b9f54946 patch 8.1.1168: not all screen update code of terminal is executed in tests
Bram Moolenaar <Bram@vim.org>
parents: 16314
diff changeset
117
16150
b23048205589 patch 8.1.1080: when a screendump test fails, moving the file is a hassle
Bram Moolenaar <Bram@vim.org>
parents: 15916
diff changeset
118 let did_mkdir = 0
b23048205589 patch 8.1.1080: when a screendump test fails, moving the file is a hassle
Bram Moolenaar <Bram@vim.org>
parents: 15916
diff changeset
119 if !isdirectory('failed')
b23048205589 patch 8.1.1080: when a screendump test fails, moving the file is a hassle
Bram Moolenaar <Bram@vim.org>
parents: 15916
diff changeset
120 let did_mkdir = 1
b23048205589 patch 8.1.1080: when a screendump test fails, moving the file is a hassle
Bram Moolenaar <Bram@vim.org>
parents: 15916
diff changeset
121 call mkdir('failed')
b23048205589 patch 8.1.1080: when a screendump test fails, moving the file is a hassle
Bram Moolenaar <Bram@vim.org>
parents: 15916
diff changeset
122 endif
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 let i = 0
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 while 1
15103
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14693
diff changeset
126 " leave some time for updating the original window
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14693
diff changeset
127 sleep 10m
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 call delete(testfile)
13329
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13322
diff changeset
129 call term_dumpwrite(a:buf, testfile, a:options)
15916
95648dc0124f patch 8.1.0964: cannot see in CI why a screenshot test failed
Bram Moolenaar <Bram@vim.org>
parents: 15653
diff changeset
130 let testdump = readfile(testfile)
16249
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
131 if filereadable(reference)
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
132 let refdump = readfile(reference)
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
133 else
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
134 " Must be a new screendump, always fail
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
135 let refdump = []
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
136 endif
15916
95648dc0124f patch 8.1.0964: cannot see in CI why a screenshot test failed
Bram Moolenaar <Bram@vim.org>
parents: 15653
diff changeset
137 if refdump == testdump
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 call delete(testfile)
16150
b23048205589 patch 8.1.1080: when a screendump test fails, moving the file is a hassle
Bram Moolenaar <Bram@vim.org>
parents: 15916
diff changeset
139 if did_mkdir
b23048205589 patch 8.1.1080: when a screendump test fails, moving the file is a hassle
Bram Moolenaar <Bram@vim.org>
parents: 15916
diff changeset
140 call delete('failed', 'd')
b23048205589 patch 8.1.1080: when a screendump test fails, moving the file is a hassle
Bram Moolenaar <Bram@vim.org>
parents: 15916
diff changeset
141 endif
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 break
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 endif
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 if i == 100
16249
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
145 " Leave the failed dump around for inspection.
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
146 if filereadable(reference)
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
147 let msg = 'See dump file difference: call term_dumpdiff("' . testfile . '", "' . reference . '")'
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
148 if a:0 == 1
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
149 let msg = a:1 . ': ' . msg
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
150 endif
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
151 if len(testdump) != len(refdump)
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
152 let msg = msg . '; line count is ' . len(testdump) . ' instead of ' . len(refdump)
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
153 endif
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
154 else
67e43b01497f patch 8.1.1129: when making a new screendump test have to create the file
Bram Moolenaar <Bram@vim.org>
parents: 16150
diff changeset
155 let msg = 'See new dump file: call term_dumpload("' . testfile . '")'
15916
95648dc0124f patch 8.1.0964: cannot see in CI why a screenshot test failed
Bram Moolenaar <Bram@vim.org>
parents: 15653
diff changeset
156 endif
95648dc0124f patch 8.1.0964: cannot see in CI why a screenshot test failed
Bram Moolenaar <Bram@vim.org>
parents: 15653
diff changeset
157 for i in range(len(refdump))
95648dc0124f patch 8.1.0964: cannot see in CI why a screenshot test failed
Bram Moolenaar <Bram@vim.org>
parents: 15653
diff changeset
158 if i >= len(testdump)
95648dc0124f patch 8.1.0964: cannot see in CI why a screenshot test failed
Bram Moolenaar <Bram@vim.org>
parents: 15653
diff changeset
159 break
95648dc0124f patch 8.1.0964: cannot see in CI why a screenshot test failed
Bram Moolenaar <Bram@vim.org>
parents: 15653
diff changeset
160 endif
95648dc0124f patch 8.1.0964: cannot see in CI why a screenshot test failed
Bram Moolenaar <Bram@vim.org>
parents: 15653
diff changeset
161 if testdump[i] != refdump[i]
95648dc0124f patch 8.1.0964: cannot see in CI why a screenshot test failed
Bram Moolenaar <Bram@vim.org>
parents: 15653
diff changeset
162 let msg = msg . '; difference in line ' . (i + 1) . ': "' . testdump[i] . '"'
95648dc0124f patch 8.1.0964: cannot see in CI why a screenshot test failed
Bram Moolenaar <Bram@vim.org>
parents: 15653
diff changeset
163 endif
95648dc0124f patch 8.1.0964: cannot see in CI why a screenshot test failed
Bram Moolenaar <Bram@vim.org>
parents: 15653
diff changeset
164 endfor
14693
156a7c5328a7 patch 8.1.0359: no clue what test failed when using a screendump twice
Christian Brabandt <cb@256bit.org>
parents: 14031
diff changeset
165 call assert_report(msg)
156a7c5328a7 patch 8.1.0359: no clue what test failed when using a screendump twice
Christian Brabandt <cb@256bit.org>
parents: 14031
diff changeset
166 return 1
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 endif
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 let i += 1
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 endwhile
14693
156a7c5328a7 patch 8.1.0359: no clue what test failed when using a screendump twice
Christian Brabandt <cb@256bit.org>
parents: 14031
diff changeset
170 return 0
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 endfunc