Mercurial > vim
comparison src/testdir/test_termcodes.vim @ 16340:2f70fc41ff7e v8.1.1175
patch 8.1.1175: no test for dragging a tab and double click for new tab
commit https://github.com/vim/vim/commit/e3e3828f935392bb3c2147a000db1c7b094a4360
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Apr 15 20:55:31 2019 +0200
patch 8.1.1175: no test for dragging a tab and double click for new tab
Problem: No test for dragging a tab with the mouse and for creating a new
tab by double clicking in the tabline.
Solution: Add two tests. (Dominique Pelle, closes #4258)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 15 Apr 2019 21:00:05 +0200 |
parents | 6b2412d0509f |
children | 06f3eb443e93 |
comparison
equal
deleted
inserted
replaced
16339:2b833d3a9a7e | 16340:2f70fc41ff7e |
---|---|
287 | 287 |
288 let &mouse = save_mouse | 288 let &mouse = save_mouse |
289 let &term = save_term | 289 let &term = save_term |
290 let &ttymouse = save_ttymouse | 290 let &ttymouse = save_ttymouse |
291 endfunc | 291 endfunc |
292 | |
293 func Test_xterm_mouse_drag_to_move_tab() | |
294 let save_mouse = &mouse | |
295 let save_term = &term | |
296 let save_ttymouse = &ttymouse | |
297 " Set 'mousetime' to 1 to avoid recognizing a double-click in the loop | |
298 set mouse=a term=xterm mousetime=1 | |
299 let row = 1 | |
300 | |
301 for ttymouse_val in ['xterm', 'sgr'] | |
302 exe 'set ttymouse=' . ttymouse_val | |
303 e Xtab1 | |
304 tabnew Xtab2 | |
305 | |
306 let a = split(execute(':tabs'), "\n") | |
307 call assert_equal(['Tab page 1', | |
308 \ ' Xtab1', | |
309 \ 'Tab page 2', | |
310 \ '> Xtab2'], a) | |
311 redraw | |
312 | |
313 " Click in tab2 and drag it to tab1. | |
314 " Check getcharmod() to verify that click is not | |
315 " interpreted as a spurious double-click. | |
316 call MouseLeftClick(row, 10) | |
317 call assert_equal(0, getcharmod()) | |
318 for col in [9, 8, 7, 6] | |
319 call MouseLeftDrag(row, col) | |
320 endfor | |
321 call MouseLeftRelease(row, col) | |
322 let a = split(execute(':tabs'), "\n") | |
323 call assert_equal(['Tab page 1', | |
324 \ '> Xtab2', | |
325 \ 'Tab page 2', | |
326 \ ' Xtab1'], a) | |
327 | |
328 %bwipe! | |
329 endfor | |
330 | |
331 let &mouse = save_mouse | |
332 let &term = save_term | |
333 let &ttymouse = save_ttymouse | |
334 set mousetime& | |
335 endfunc | |
336 | |
337 func Test_xterm_mouse_double_click_to_create_tab() | |
338 let save_mouse = &mouse | |
339 let save_term = &term | |
340 let save_ttymouse = &ttymouse | |
341 " Set 'mousetime' to a small value, so that double-click works but we don't | |
342 " have to wait long to avoid a triple-click. | |
343 set mouse=a term=xterm mousetime=100 | |
344 let row = 1 | |
345 let col = 10 | |
346 | |
347 for ttymouse_val in ['xterm', 'sgr'] | |
348 exe 'set ttymouse=' . ttymouse_val | |
349 e Xtab1 | |
350 tabnew Xtab2 | |
351 | |
352 let a = split(execute(':tabs'), "\n") | |
353 call assert_equal(['Tab page 1', | |
354 \ ' Xtab1', | |
355 \ 'Tab page 2', | |
356 \ '> Xtab2'], a) | |
357 | |
358 redraw | |
359 call MouseLeftClick(row, col) | |
360 " Check getcharmod() to verify that first click is not | |
361 " interpreted as a spurious double-click. | |
362 call assert_equal(0, getcharmod()) | |
363 call MouseLeftRelease(row, col) | |
364 call MouseLeftClick(row, col) | |
365 call assert_equal(32, getcharmod()) " double-click | |
366 call MouseLeftRelease(row, col) | |
367 let a = split(execute(':tabs'), "\n") | |
368 call assert_equal(['Tab page 1', | |
369 \ ' Xtab1', | |
370 \ 'Tab page 2', | |
371 \ '> [No Name]', | |
372 \ 'Tab page 3', | |
373 \ ' Xtab2'], a) | |
374 | |
375 if ttymouse_val !=# 'sgr' | |
376 " We need to sleep, or else MouseLeftClick() in next loop | |
377 " iteration will be interpreted as a spurious triple-click. | |
378 sleep 100m | |
379 endif | |
380 %bwipe! | |
381 endfor | |
382 | |
383 let &mouse = save_mouse | |
384 let &term = save_term | |
385 let &ttymouse = save_ttymouse | |
386 set mousetime& | |
387 endfunc |