]> granicus.if.org Git - vim/commitdiff
patch 8.2.2959: sound_playfile() is not tested on MS-Windows v8.2.2959
authorDominique Pelle <dominique.pelle@gmail.com>
Mon, 7 Jun 2021 18:28:45 +0000 (20:28 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 7 Jun 2021 18:28:45 +0000 (20:28 +0200)
Problem:    sound_playfile() is not tested on MS-Windows.
Solution:   Make it work and enable the test. (Dominique PellĂ©, closes #8338)

src/sound.c
src/testdir/test_sound.vim
src/version.c

index 9d91f6c086d003b7419889f50722f3c1ecad4a6a..702fd257a7d21b516856102418e69409835e7f02 100644 (file)
@@ -355,10 +355,9 @@ f_sound_playevent(typval_T *argvars, typval_T *rettv)
     if (wp == NULL)
        return;
 
-    PlaySoundW(wp, NULL, SND_ASYNC | SND_ALIAS);
+    if (PlaySoundW(wp, NULL, SND_ASYNC | SND_ALIAS))
+       rettv->vval.v_number = ++sound_id;
     free(wp);
-
-    rettv->vval.v_number = ++sound_id;
 }
 
     void
index cc01bf6a747604b4929d8d879eb5a91d1bf7cbe8..ff58262bff0ea2e8c60c26c59a317ac8cfb8a09d 100644 (file)
@@ -75,17 +75,15 @@ func Test_play_silent()
 endfunc
 
 func Test_play_event_error()
-  " Do not run test on Windows as:
-  " - playing event with callback is not supported on Windows.
-  " - FIXME: even without callback, sound_playevent('') does not return 0 on Windows. Bug?
-  CheckNotMSWindows
-
-  call assert_equal(0, sound_playevent(''))
-  call assert_equal(0, sound_playevent(test_null_string()))
-  call assert_equal(0, sound_playevent('doesnotexist'))
-  call assert_equal(0, sound_playevent('doesnotexist', 'doesnotexist'))
-  call assert_equal(0, sound_playevent(test_null_string(), test_null_string()))
-  call assert_equal(0, sound_playevent(test_null_string(), test_null_function()))
+  " FIXME: sound_playevent() doesn't return 0 in case of error on Windows.
+  if !has('win32')
+    call assert_equal(0, sound_playevent(''))
+    call assert_equal(0, sound_playevent(test_null_string()))
+    call assert_equal(0, sound_playevent('doesnotexist'))
+    call assert_equal(0, sound_playevent('doesnotexist', 'doesnotexist'))
+    call assert_equal(0, sound_playevent(test_null_string(), test_null_string()))
+    call assert_equal(0, sound_playevent(test_null_string(), test_null_function()))
+  endif
 
   call assert_equal(0, sound_playfile(''))
   call assert_equal(0, sound_playfile(test_null_string()))
index e39ee98fc66709b67ccb4324bcebe3c37cc2f93a..13a5200470e48681fc22826791c5fe74df6e0f33 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2959,
 /**/
     2958,
 /**/