Patch 8.2.3526
Problem:    Tests have clumsy check for X11 based GUI.
Solution:   Add CheckX11BasedGui.
Files:      src/testdir/check.vim, src/testdir/test_gui.vim,
            src/testdir/test_gui_init.vim, src/testdir/setup_gui.vim


*** ../vim-8.2.3525/src/testdir/check.vim       2021-07-05 16:48:59.501911723 
+0100
--- src/testdir/check.vim       2021-10-16 21:56:06.735092496 +0100
***************
*** 217,222 ****
--- 217,230 ----
    endif
  endfunc
  
+ " Command to check for X11 based GUI
+ command CheckX11BasedGui call CheckX11BasedGui()
+ func CheckX11BasedGui()
+   if !g:x11_based_gui
+     throw 'Skipped: requires X11 based GUI'
+   endif
+ endfunc
+ 
  " Command to check for satisfying any of the conditions.
  " e.g. CheckAnyOf Feature:bsd Feature:sun Linux
  command -nargs=+ CheckAnyOf call CheckAnyOf(<f-args>)
*** ../vim-8.2.3525/src/testdir/test_gui.vim    2021-10-16 20:52:01.772842109 
+0100
--- src/testdir/test_gui.vim    2021-10-16 21:43:54.228787007 +0100
***************
*** 61,71 ****
  endfunc
  
  func Test_getfontname_with_arg()
!   let skipped = ''
  
!   if !g:x11_based_gui
!     let skipped = g:not_implemented
!   elseif has('gui_athena') || has('gui_motif')
      " Invalid font name. The result should be an empty string.
      call assert_equal('', getfontname('notexist'))
  
--- 61,69 ----
  endfunc
  
  func Test_getfontname_with_arg()
!   CheckX11BasedGui
  
!   if has('gui_athena') || has('gui_motif')
      " Invalid font name. The result should be an empty string.
      call assert_equal('', getfontname('notexist'))
  
***************
*** 82,101 ****
      let fname = 'Bitstream Vera Sans Mono 12'
      call assert_equal(fname, getfontname(fname))
    endif
- 
-   if !empty(skipped)
-     throw skipped
-   endif
  endfunc
  
  func Test_getfontname_without_arg()
!   let skipped = ''
  
    let fname = getfontname()
  
!   if !g:x11_based_gui
!     let skipped = g:not_implemented
!   elseif has('gui_kde')
      " 'expected' is the value specified by SetUp() above.
      call assert_equal('Courier 10 Pitch/8/-1/5/50/0/0/0/0/0', fname)
    elseif has('gui_athena') || has('gui_motif')
--- 80,93 ----
      let fname = 'Bitstream Vera Sans Mono 12'
      call assert_equal(fname, getfontname(fname))
    endif
  endfunc
  
  func Test_getfontname_without_arg()
!   CheckX11BasedGui
  
    let fname = getfontname()
  
!   if has('gui_kde')
      " 'expected' is the value specified by SetUp() above.
      call assert_equal('Courier 10 Pitch/8/-1/5/50/0/0/0/0/0', fname)
    elseif has('gui_athena') || has('gui_motif')
***************
*** 106,115 ****
      " 'expected' is DEFAULT_FONT of gui_gtk_x11.c.
      call assert_equal('Monospace 10', fname)
    endif
- 
-   if !empty(skipped)
-     throw skipped
-   endif
  endfunc
  
  func Test_getwinpos()
--- 98,103 ----
***************
*** 120,167 ****
  endfunc
  
  func Test_quoteplus()
!   let g:test_is_flaky = 1
!   let skipped = ''
  
!   if !g:x11_based_gui
!     let skipped = g:not_supported . 'quoteplus'
!   else
!     let quoteplus_saved = @+
  
!     let test_call     = 'Can you hear me?'
!     let test_response = 'Yes, I can.'
!     let vim_exe = GetVimCommand()
!     let testee = 'VIMRUNTIME=' . $VIMRUNTIME . '; export VIMRUNTIME;'
!           \ . vim_exe . ' --noplugin --not-a-term -c ''%s'''
!     " Ignore the "failed to create input context" error.
!     let cmd = 'call test_ignore_error("E285") | '
!         \ . 'gui -f | '
!         \ . 'call feedkeys("'
!           \ . '\"+p'
!           \ . ':s/' . test_call . '/' . test_response . '/\<CR>'
!           \ . '\"+yis'
!           \ . ':q!\<CR>", "tx")'
!     let run_vimtest = printf(testee, cmd)
! 
!     " Set the quoteplus register to test_call, and another gvim will launched.
!     " Then, it first tries to paste the content of its own quotedplus register
!     " onto it.  Second, it tries to substitute test_response for the pasted
!     " sentence.  If the sentence is identical to test_call, the substitution
!     " should succeed.  Third, it tries to yank the result of the substitution
!     " to its own quoteplus register, and last it quits.  When system()
!     " returns, the content of the quoteplus register should be identical to
!     " test_response if those quoteplus registers are synchronized properly
!     " with/through the X11 clipboard.
!     let @+ = test_call
!     call system(run_vimtest)
!     call assert_equal(test_response, @+)
  
!     let @+ = quoteplus_saved
!   endif
  
!   if !empty(skipped)
!     throw skipped
!   endif
  endfunc
  
  func Test_set_background()
--- 108,148 ----
  endfunc
  
  func Test_quoteplus()
!   CheckX11BasedGui
  
!   let g:test_is_flaky = 1
  
!   let quoteplus_saved = @+
  
!   let test_call     = 'Can you hear me?'
!   let test_response = 'Yes, I can.'
!   let vim_exe = GetVimCommand()
!   let testee = 'VIMRUNTIME=' . $VIMRUNTIME . '; export VIMRUNTIME;'
!         \ . vim_exe . ' --noplugin --not-a-term -c ''%s'''
!   " Ignore the "failed to create input context" error.
!   let cmd = 'call test_ignore_error("E285") | '
!         \ . 'gui -f | '
!         \ . 'call feedkeys("'
!         \ . '\"+p'
!         \ . ':s/' . test_call . '/' . test_response . '/\<CR>'
!         \ . '\"+yis'
!         \ . ':q!\<CR>", "tx")'
!   let run_vimtest = printf(testee, cmd)
! 
!   " Set the quoteplus register to test_call, and another gvim will launched.
!   " Then, it first tries to paste the content of its own quotedplus register
!   " onto it.  Second, it tries to substitute test_response for the pasted
!   " sentence.  If the sentence is identical to test_call, the substitution
!   " should succeed.  Third, it tries to yank the result of the substitution
!   " to its own quoteplus register, and last it quits.  When system()
!   " returns, the content of the quoteplus register should be identical to
!   " test_response if those quoteplus registers are synchronized properly
!   " with/through the X11 clipboard.
!   let @+ = test_call
!   call system(run_vimtest)
!   call assert_equal(test_response, @+)
  
!   let @+ = quoteplus_saved
  endfunc
  
  func Test_set_background()
***************
*** 333,340 ****
    let &guicursor = guicursor_saved
  endfunc
  
  func Test_set_guifont()
!   let skipped = ''
  
    let guifont_saved = &guifont
    if has('xfontset')
--- 314,342 ----
    let &guicursor = guicursor_saved
  endfunc
  
+ func Test_set_guifont_errors()
+   if has('win32')
+     " Invalid font names are accepted in GTK GUI
+     call assert_fails('set guifont=xa1bc23d7f', 'E596:')
+   endif
+ 
+   " This only works if 'renderoptions' exists and does not work for Windows XP
+   " and older.
+   if exists('+renderoptions') && windowsversion() !~ '^[345]\.'
+     " doing this four times used to cause a crash
+     set renderoptions=type:directx
+     for i in range(5)
+       set guifont=
+     endfor
+     set renderoptions=
+     for i in range(5)
+       set guifont=
+     endfor
+   endif
+ endfunc
+ 
  func Test_set_guifont()
!   CheckX11BasedGui
  
    let guifont_saved = &guifont
    if has('xfontset')
***************
*** 343,351 ****
      set guifontset=
    endif
  
!   if !g:x11_based_gui
!     let skipped = g:not_implemented
!   elseif has('gui_athena') || has('gui_motif')
      " Non-empty font list with invalid font names.
      "
      " This test is twofold: (1) It checks if the command fails as expected
--- 345,351 ----
      set guifontset=
    endif
  
!   if has('gui_athena') || has('gui_motif')
      " Non-empty font list with invalid font names.
      "
      " This test is twofold: (1) It checks if the command fails as expected
***************
*** 384,416 ****
      call assert_equal('Monospace 10', getfontname())
    endif
  
-   if has('win32')
-     " Invalid font names are accepted in GTK GUI
-     call assert_fails('set guifont=xa1bc23d7f', 'E596:')
-   endif
- 
-   " This only works if 'renderoptions' exists and does not work for Windows XP
-   " and older.
-   if exists('+renderoptions') && windowsversion() !~ '^[345]\.'
-     " doing this four times used to cause a crash
-     set renderoptions=type:directx
-     for i in range(5)
-       set guifont=
-     endfor
-     set renderoptions=
-     for i in range(5)
-       set guifont=
-     endfor
-   endif
- 
    if has('xfontset')
      let &guifontset = guifontset_saved
    endif
    let &guifont = guifont_saved
- 
-   if !empty(skipped)
-     throw skipped
-   endif
  endfunc
  
  func Test_set_guifontset()
--- 384,393 ----
***************
*** 485,496 ****
  endfunc
  
  func Test_set_guifontwide()
    call assert_fails('set guifontwide=*', 'E533:')
-   let skipped = ''
  
!   if !g:x11_based_gui
!     let skipped = g:not_implemented
!   elseif has('gui_gtk')
      let guifont_saved = &guifont
      let guifontwide_saved = &guifontwide
  
--- 462,472 ----
  endfunc
  
  func Test_set_guifontwide()
+   CheckX11BasedGui
+ 
    call assert_fails('set guifontwide=*', 'E533:')
  
!   if has('gui_gtk')
      let guifont_saved = &guifont
      let guifontwide_saved = &guifontwide
  
***************
*** 561,611 ****
        let &encoding    = encoding_saved
      endif
    endif
- 
-   if !empty(skipped)
-     throw skipped
-   endif
  endfunc
  
  func Test_set_guiligatures()
!   let skipped = ''
! 
!   if !g:x11_based_gui
!     let skipped = g:not_supported . 'guiligatures'
!   else
!     if has('gui_gtk') || has('gui_gtk2') || has('gui_gnome') || 
has('gui_gtk3')
!       " Try correct value
!       set guiligatures=<>=ab
!       call assert_equal("<>=ab", &guiligatures)
!       " Try to throw error
!       try
!         set guiligatures=<>=šab
!         call assert_report("'set guiligatures=<>=šab should have failed")
!       catch
!         call assert_exception('E1243:')
!       endtry
!     endif
!   endif
  
!   if !empty(skipped)
!     throw skipped
    endif
  endfunc
  
  func Test_set_guiheadroom()
!   let skipped = ''
  
!   if !g:x11_based_gui
!     let skipped = g:not_supported . 'guiheadroom'
!   else
!     " Since this script is to be read together with '-U NONE', the default
!     " value must be preserved.
!     call assert_equal(50, &guiheadroom)
!   endif
! 
!   if !empty(skipped)
!     throw skipped
!   endif
  endfunc
  
  func Test_set_guioptions()
--- 537,567 ----
        let &encoding    = encoding_saved
      endif
    endif
  endfunc
  
  func Test_set_guiligatures()
!   CheckX11BasedGui
  
!   if has('gui_gtk') || has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
!     " Try correct value
!     set guiligatures=<>=ab
!     call assert_equal("<>=ab", &guiligatures)
!     " Try to throw error
!     try
!       set guiligatures=<>=šab
!       call assert_report("'set guiligatures=<>=šab should have failed")
!     catch
!       call assert_exception('E1243:')
!     endtry
    endif
  endfunc
  
  func Test_set_guiheadroom()
!   CheckX11BasedGui
  
!   " Since this script is to be read together with '-U NONE', the default
!   " value must be preserved.
!   call assert_equal(50, &guiheadroom)
  endfunc
  
  func Test_set_guioptions()
*** ../vim-8.2.3525/src/testdir/test_gui_init.vim       2020-08-12 
17:50:31.879655802 +0100
--- src/testdir/test_gui_init.vim       2021-10-16 21:45:48.774285000 +0100
***************
*** 22,40 ****
  gui -f
  
  func Test_set_guiheadroom()
!   let skipped = ''
  
!   if !g:x11_based_gui
!     let skipped = g:not_supported . 'guiheadroom'
!   else
!     " The 'expected' value must be consistent with the value specified with
!     " gui_init.vim.
!     call assert_equal(0, &guiheadroom)
!   endif
! 
!   if !empty(skipped)
!     throw skipped
!   endif
  endfunc
  
  func Test_set_guioptions_for_M()
--- 22,32 ----
  gui -f
  
  func Test_set_guiheadroom()
!   CheckX11BasedGui
  
!   " The 'expected' value must be consistent with the value specified with
!   " gui_init.vim.
!   call assert_equal(0, &guiheadroom)
  endfunc
  
  func Test_set_guioptions_for_M()
***************
*** 44,62 ****
  endfunc
  
  func Test_set_guioptions_for_p()
!   let skipped = ''
  
!   if !g:x11_based_gui
!     let skipped = g:not_supported . '''p'' of guioptions'
!   else
!     sleep 200ms
!     " Check if the 'p' option is included.
!     call assert_match('.*p.*', &guioptions)
!   endif
! 
!   if !empty(skipped)
!     throw skipped
!   endif
  endfunc
  
  " vim: shiftwidth=2 sts=2 expandtab
--- 36,46 ----
  endfunc
  
  func Test_set_guioptions_for_p()
!   CheckX11BasedGui
  
!   sleep 200ms
!   " Check if the 'p' option is included.
!   call assert_match('.*p.*', &guioptions)
  endfunc
  
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.3525/src/testdir/setup_gui.vim   2017-03-01 17:27:18.000000000 
+0000
--- src/testdir/setup_gui.vim   2021-10-16 21:47:40.511749470 +0100
***************
*** 5,11 ****
  
  " Reasons for 'skipped'.
  let g:not_supported   = "Skipped: Feature/Option not supported by this GUI: "
- let g:not_implemented = "Skipped: Test not implemented yet for this GUI"
  let g:not_hosted      = "Skipped: Test not hosted by the system/environment"
  
  " For KDE set a font, empty 'guifont' may cause a hang.
--- 5,10 ----
*** ../vim-8.2.3525/src/version.c       2021-10-16 21:14:07.495196461 +0100
--- src/version.c       2021-10-16 21:48:52.096689052 +0100
***************
*** 759,760 ****
--- 759,762 ----
  {   /* Add new patch number below this line */
+ /**/
+     3526,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
173. You keep tracking down the email addresses of all your friends
     (even childhood friends).

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20211016205855.7AEC2C80053%40moolenaar.net.

Raspunde prin e-mail lui