Mercurial > vim
comparison src/testdir/test_sound.vim @ 18017:988e5a868b60 v8.1.2004
patch 8.1.2004: more functions can be used as methods
Commit: https://github.com/vim/vim/commit/f6ed61e1489e40eada55a4f1782e1ed82bcad7d9
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 7 19:05:09 2019 +0200
patch 8.1.2004: more functions can be used as methods
Problem: More functions can be used as methods.
Solution: Make various functions usable as a method.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 07 Sep 2019 19:15:04 +0200 |
parents | 10696f279e20 |
children | 08940efa6b4e |
comparison
equal
deleted
inserted
replaced
18016:834b7854aa3c | 18017:988e5a868b60 |
---|---|
11 | 11 |
12 func Test_play_event() | 12 func Test_play_event() |
13 if has('win32') | 13 if has('win32') |
14 throw 'Skipped: Playing event with callback is not supported on Windows' | 14 throw 'Skipped: Playing event with callback is not supported on Windows' |
15 endif | 15 endif |
16 let id = sound_playevent('bell', 'PlayCallback') | 16 let id = 'bell'->sound_playevent('PlayCallback') |
17 if id == 0 | 17 if id == 0 |
18 throw 'Skipped: bell event not available' | 18 throw 'Skipped: bell event not available' |
19 endif | 19 endif |
20 " Stop it quickly, avoid annoying the user. | 20 " Stop it quickly, avoid annoying the user. |
21 sleep 20m | 21 sleep 20m |
22 call sound_stop(id) | 22 eval id->sound_stop() |
23 sleep 30m | 23 sleep 30m |
24 call assert_equal(id, g:id) | 24 call assert_equal(id, g:id) |
25 call assert_equal(1, g:result) " sound was aborted | 25 call assert_equal(1, g:result) " sound was aborted |
26 endfunc | 26 endfunc |
27 | 27 |
33 if id1 == 0 | 33 if id1 == 0 |
34 throw 'Skipped: playing a sound is not working' | 34 throw 'Skipped: playing a sound is not working' |
35 endif | 35 endif |
36 | 36 |
37 " play until the end | 37 " play until the end |
38 let id2 = sound_playfile(fname, 'PlayCallback') | 38 let id2 = fname->sound_playfile('PlayCallback') |
39 call assert_true(id2 > 0) | 39 call assert_true(id2 > 0) |
40 sleep 500m | 40 sleep 500m |
41 call assert_equal(id2, g:id) | 41 call assert_equal(id2, g:id) |
42 call assert_equal(0, g:result) | 42 call assert_equal(0, g:result) |
43 | 43 |