Skip to content

Commit 2f9c209

Browse files
dpellebrammool
authored andcommitted
patch 8.2.2959: sound_playfile() is not tested on MS-Windows
Problem: sound_playfile() is not tested on MS-Windows. Solution: Make it work and enable the test. (Dominique Pellé, closes #8338)
1 parent f7a023e commit 2f9c209

3 files changed

Lines changed: 13 additions & 14 deletions

File tree

src/sound.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,9 @@ f_sound_playevent(typval_T *argvars, typval_T *rettv)
355355
if (wp == NULL)
356356
return;
357357

358-
PlaySoundW(wp, NULL, SND_ASYNC | SND_ALIAS);
358+
if (PlaySoundW(wp, NULL, SND_ASYNC | SND_ALIAS))
359+
rettv->vval.v_number = ++sound_id;
359360
free(wp);
360-
361-
rettv->vval.v_number = ++sound_id;
362361
}
363362

364363
void

src/testdir/test_sound.vim

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,15 @@ func Test_play_silent()
7575
endfunc
7676

7777
func Test_play_event_error()
78-
" Do not run test on Windows as:
79-
" - playing event with callback is not supported on Windows.
80-
" - FIXME: even without callback, sound_playevent('') does not return 0 on Windows. Bug?
81-
CheckNotMSWindows
82-
83-
call assert_equal(0, sound_playevent(''))
84-
call assert_equal(0, sound_playevent(test_null_string()))
85-
call assert_equal(0, sound_playevent('doesnotexist'))
86-
call assert_equal(0, sound_playevent('doesnotexist', 'doesnotexist'))
87-
call assert_equal(0, sound_playevent(test_null_string(), test_null_string()))
88-
call assert_equal(0, sound_playevent(test_null_string(), test_null_function()))
78+
" FIXME: sound_playevent() doesn't return 0 in case of error on Windows.
79+
if !has('win32')
80+
call assert_equal(0, sound_playevent(''))
81+
call assert_equal(0, sound_playevent(test_null_string()))
82+
call assert_equal(0, sound_playevent('doesnotexist'))
83+
call assert_equal(0, sound_playevent('doesnotexist', 'doesnotexist'))
84+
call assert_equal(0, sound_playevent(test_null_string(), test_null_string()))
85+
call assert_equal(0, sound_playevent(test_null_string(), test_null_function()))
86+
endif
8987

9088
call assert_equal(0, sound_playfile(''))
9189
call assert_equal(0, sound_playfile(test_null_string()))

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2959,
753755
/**/
754756
2958,
755757
/**/

0 commit comments

Comments
 (0)