From d4c62162e94bfac42652cd8020b91b3733742a38 Mon Sep 17 00:00:00 2001 From: Rein Klazes Date: Fri, 27 Jan 2006 19:19:19 +0100 Subject: [PATCH] user: Fix SPI_{G|S}ETFONTSMOOTHING with tests. --- dlls/user/sysparams.c | 8 ++++-- dlls/user/tests/sysparams.c | 49 ++++++++++++++++++++++++++++++++----- 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/dlls/user/sysparams.c b/dlls/user/sysparams.c index 900a499fa01..d678f4330ca 100644 --- a/dlls/user/sysparams.c +++ b/dlls/user/sysparams.c @@ -1898,13 +1898,17 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam, WINE_SPI_WARN(SPI_SETANIMATION); /* 73 WINVER >= 0x400 */ case SPI_GETFONTSMOOTHING: + { + UINT tmpval; ret = get_uint_param( SPI_SETFONTSMOOTHING_IDX, SPI_SETFONTSMOOTHING_REGKEY, SPI_SETFONTSMOOTHING_VALNAME, - &font_smoothing, pvParam ); + &font_smoothing, &tmpval ); + *(UINT *) pvParam = ( tmpval != 0); break; - + } case SPI_SETFONTSMOOTHING: + uiParam = uiParam ? 2 : 0; /* Win NT4/2k/XP behavior */ ret = set_uint_param( SPI_SETFONTSMOOTHING_IDX, SPI_SETFONTSMOOTHING_REGKEY, SPI_SETFONTSMOOTHING_VALNAME, diff --git a/dlls/user/tests/sysparams.c b/dlls/user/tests/sysparams.c index ac7c9078e9f..4b73230c527 100644 --- a/dlls/user/tests/sysparams.c +++ b/dlls/user/tests/sysparams.c @@ -39,6 +39,7 @@ static int strict; static int dpi; +static int iswin9x; static HDC hdc; #define eq(received, expected, label, type) \ @@ -118,6 +119,8 @@ static HDC hdc; #define SPI_SETSCREENREADER_VALNAME "On" #define SPI_SETSCREENREADER_REGKEY_LEGACY "Control Panel\\Accessibility" #define SPI_SETSCREENREADER_VALNAME_LEGACY "Blind Access" +#define SPI_SETFONTSMOOTHING_REGKEY "Control Panel\\Desktop" +#define SPI_SETFONTSMOOTHING_VALNAME "FontSmoothing" #define SPI_SETLOWPOWERACTIVE_REGKEY "Control Panel\\Desktop" #define SPI_SETLOWPOWERACTIVE_VALNAME "LowPowerActive" #define SPI_SETPOWEROFFACTIVE_REGKEY "Control Panel\\Desktop" @@ -675,7 +678,6 @@ static void test_SPI_SETBORDER( void ) /* 6 */ { BOOL rc; UINT old_border; - int iswin9x; NONCLIENTMETRICSA ncmsave; INT CaptionWidth; @@ -689,11 +691,6 @@ static void test_SPI_SETBORDER( void ) /* 6 */ "Control Panel\\Desktop\\WindowMetrics","CaptionWidth", dpi); ncmsave.iCaptionWidth = CaptionWidth; - /* The SPI_SETBORDER seems to be buggy on Win9x/ME (looks like you need to - * do it twice to make the intended change). So skip parts of the tests on - * those platforms */ - iswin9x = GetVersion() & 0x80000000; - /* These tests hang when XFree86 4.0 for Windows is running (tested on * WinNT, SP2, Cygwin/XFree 4.1.0. Skip the test when XFree86 is * running. @@ -711,6 +708,9 @@ static void test_SPI_SETBORDER( void ) /* 6 */ if ( old_border == 7 || old_border == 20 ) old_border = 1; + /* The SPI_SETBORDER seems to be buggy on Win9x/ME (looks like you need to + * do it twice to make the intended change). So skip parts of the tests on + * those platforms */ if( !iswin9x) { test_setborder(1, 1, dpi); test_setborder(0, 1, dpi); @@ -1837,6 +1837,41 @@ static void test_SPI_SETSCREENREADER( void ) /* 71 */ ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError()); } +static void test_SPI_SETFONTSMOOTHING( void ) /* 75 */ +{ + BOOL rc; + BOOL old_b; + const UINT vals[]={0xffffffff,0,1,2}; + unsigned int i; + + trace("testing SPI_{GET,SET}FONTSMOOTHING\n"); + if( iswin9x) return; /* 95/98/ME don't seem to implement this fully */ + SetLastError(0xdeadbeef); + rc=SystemParametersInfoA( SPI_GETFONTSMOOTHING, 0, &old_b, 0 ); + if (!test_error_msg(rc,"SPI_{GET,SET}FONTSMOOTHING")) + return; + + for (i=0;i