0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.0047: cannot skip tests for specific MS-Windows platform

Problem:    Cannot skip tests for specific MS-Windows platform.
Solution:   Add windowsversion().
This commit is contained in:
Bram Moolenaar 2019-12-27 13:49:24 +01:00
parent 5666fcd0bd
commit 0c1e3744ff
7 changed files with 39 additions and 6 deletions

View File

@ -10382,6 +10382,13 @@ wincol() The result is a Number, which is the virtual column of the
cursor in the window. This is counting screen cells from the cursor in the window. This is counting screen cells from the
left side of the window. The leftmost column is one. left side of the window. The leftmost column is one.
*windowsversion()*
windowsversion()
The result is a String. For MS-Windows it indicates the OS
version. E.g, Windows 10 is "10.0", Windows 8 is "6.2",
Windows XP is "5.1". For non-MS-Windows systems the result is
an empty string.
winheight({nr}) *winheight()* winheight({nr}) *winheight()*
The result is a Number, which is the height of window {nr}. The result is a Number, which is the height of window {nr}.
{nr} can be the window number or the |window-ID|. {nr} can be the window number or the |window-ID|.

View File

@ -276,6 +276,7 @@ static void f_type(typval_T *argvars, typval_T *rettv);
static void f_virtcol(typval_T *argvars, typval_T *rettv); static void f_virtcol(typval_T *argvars, typval_T *rettv);
static void f_visualmode(typval_T *argvars, typval_T *rettv); static void f_visualmode(typval_T *argvars, typval_T *rettv);
static void f_wildmenumode(typval_T *argvars, typval_T *rettv); static void f_wildmenumode(typval_T *argvars, typval_T *rettv);
static void f_windowsversion(typval_T *argvars, typval_T *rettv);
static void f_wordcount(typval_T *argvars, typval_T *rettv); static void f_wordcount(typval_T *argvars, typval_T *rettv);
static void f_xor(typval_T *argvars, typval_T *rettv); static void f_xor(typval_T *argvars, typval_T *rettv);
@ -864,6 +865,7 @@ static funcentry_T global_functions[] =
{"win_splitmove", 2, 3, FEARG_1, f_win_splitmove}, {"win_splitmove", 2, 3, FEARG_1, f_win_splitmove},
{"winbufnr", 1, 1, FEARG_1, f_winbufnr}, {"winbufnr", 1, 1, FEARG_1, f_winbufnr},
{"wincol", 0, 0, 0, f_wincol}, {"wincol", 0, 0, 0, f_wincol},
{"windowsversion", 0, 0, 0, f_windowsversion},
{"winheight", 1, 1, FEARG_1, f_winheight}, {"winheight", 1, 1, FEARG_1, f_winheight},
{"winlayout", 0, 1, FEARG_1, f_winlayout}, {"winlayout", 0, 1, FEARG_1, f_winlayout},
{"winline", 0, 0, 0, f_winline}, {"winline", 0, 0, 0, f_winline},
@ -8407,6 +8409,16 @@ f_wildmenumode(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
#endif #endif
} }
/*
* "windowsversion()" function
*/
static void
f_windowsversion(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
rettv->v_type = VAR_STRING;
rettv->vval.v_string = vim_strsave((char_u *)windowsVersion);
}
/* /*
* "wordcount()" function * "wordcount()" function
*/ */

View File

@ -1724,6 +1724,9 @@ EXTERN int did_echo_string_emsg INIT(= FALSE);
// Used for checking if local variables or arguments used in a lambda. // Used for checking if local variables or arguments used in a lambda.
EXTERN int *eval_lavars_used INIT(= NULL); EXTERN int *eval_lavars_used INIT(= NULL);
// Only filled for Win32.
EXTERN char windowsVersion[20] INIT(= {0});
#endif #endif
#ifdef MSWIN #ifdef MSWIN

View File

@ -758,8 +758,6 @@ null_libintl_wputenv(const wchar_t *envstring UNUSED)
# define VER_PLATFORM_WIN32_WINDOWS 1 # define VER_PLATFORM_WIN32_WINDOWS 1
#endif #endif
DWORD g_PlatformId;
#ifdef HAVE_ACL #ifdef HAVE_ACL
# ifndef PROTO # ifndef PROTO
# include <aclapi.h> # include <aclapi.h>
@ -806,8 +804,7 @@ win32_enable_privilege(LPTSTR lpszPrivilege, BOOL bEnable)
#endif #endif
/* /*
* Set g_PlatformId to VER_PLATFORM_WIN32_NT (NT) or * Set "win8_or_later" and fill in "windowsVersion".
* VER_PLATFORM_WIN32_WINDOWS (Win95).
*/ */
void void
PlatformId(void) PlatformId(void)
@ -821,7 +818,8 @@ PlatformId(void)
ovi.dwOSVersionInfoSize = sizeof(ovi); ovi.dwOSVersionInfoSize = sizeof(ovi);
GetVersionEx(&ovi); GetVersionEx(&ovi);
g_PlatformId = ovi.dwPlatformId; vim_snprintf(windowsVersion, sizeof(windowsVersion), "%d.%d",
(int)ovi.dwMajorVersion, (int)ovi.dwMinorVersion);
if ((ovi.dwMajorVersion == 6 && ovi.dwMinorVersion >= 2) if ((ovi.dwMajorVersion == 6 && ovi.dwMinorVersion >= 2)
|| ovi.dwMajorVersion > 6) || ovi.dwMajorVersion > 6)

View File

@ -10,6 +10,8 @@ set nomore
" The terminal size is restored at the end. " The terminal size is restored at the end.
" Clear out t_WS, we don't want to resize the actual terminal. " Clear out t_WS, we don't want to resize the actual terminal.
let script = [ let script = [
\ '" DO NOT EDIT: Generated with gen_opt_test.vim',
\ '',
\ 'let save_columns = &columns', \ 'let save_columns = &columns',
\ 'let save_lines = &lines', \ 'let save_lines = &lines',
\ 'let save_term = &term', \ 'let save_term = &term',
@ -123,7 +125,7 @@ let test_values = {
\ 'printmbfont': [['', 'r:some', 'b:Bold,c:yes'], ['xxx']], \ 'printmbfont': [['', 'r:some', 'b:Bold,c:yes'], ['xxx']],
\ 'printoptions': [['', 'header:0', 'left:10pc,top:5pc'], ['xxx']], \ 'printoptions': [['', 'header:0', 'left:10pc,top:5pc'], ['xxx']],
\ 'scrollopt': [['', 'ver', 'ver,hor'], ['xxx']], \ 'scrollopt': [['', 'ver', 'ver,hor'], ['xxx']],
\ 'renderoptions': [['', 'type:directx'], ['xxx']], \ 'renderoptions': [[''], ['xxx']],
\ 'selection': [['old', 'inclusive'], ['', 'xxx']], \ 'selection': [['old', 'inclusive'], ['', 'xxx']],
\ 'selectmode': [['', 'mouse', 'key,cmd'], ['xxx']], \ 'selectmode': [['', 'mouse', 'key,cmd'], ['xxx']],
\ 'sessionoptions': [['', 'blank', 'help,options,slash'], ['xxx']], \ 'sessionoptions': [['', 'blank', 'help,options,slash'], ['xxx']],

View File

@ -389,6 +389,15 @@ func Test_set_values()
endif endif
endfunc endfunc
func Test_renderoptions()
" Only do this for Windows Vista and later, fails on Windows XP and earlier.
" Doesn't hurt to do this on a non-Windows system.
if windowsversion() !~ '^[345]\.'
set renderoptions=type:directx
set rop=type:directx
endif
endfunc
func ResetIndentexpr() func ResetIndentexpr()
set indentexpr= set indentexpr=
endfunc endfunc

View File

@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
47,
/**/ /**/
46, 46,
/**/ /**/