user32/tests: Fix some of the sysparams tests on Win9x and NT4.

This commit is contained in:
Alexandre Julliard 2008-11-20 20:46:54 +01:00
parent dcd8cf7214
commit 3359f4d4e5
1 changed files with 22 additions and 14 deletions

View File

@ -224,7 +224,7 @@ static BOOL test_error_msg ( int rc, const char *name )
if (rc==0)
{
if (last_error==0xdeadbeef || last_error==ERROR_INVALID_SPI_VALUE)
if (last_error==0xdeadbeef || last_error==ERROR_INVALID_SPI_VALUE || last_error==ERROR_INVALID_PARAMETER)
{
trace("%s not supported on this platform. Skipping test\n", name);
}
@ -1778,7 +1778,7 @@ static void test_SPI_SETSHOWSOUNDS( void ) /* 57 */
rc=SystemParametersInfoA( SPI_SETSHOWSOUNDS, vals[i], 0,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
test_change_message( SPI_SETSHOWSOUNDS, 0 );
test_change_message( SPI_SETSHOWSOUNDS, 1 );
test_reg_key( SPI_SETSHOWSOUNDS_REGKEY,
SPI_SETSHOWSOUNDS_VALNAME,
vals[i] ? "1" : "0" );
@ -1814,7 +1814,7 @@ static void test_SPI_SETKEYBOARDPREF( void ) /* 69 */
rc=SystemParametersInfoA( SPI_SETKEYBOARDPREF, vals[i], 0,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
test_change_message( SPI_SETKEYBOARDPREF, 0 );
test_change_message( SPI_SETKEYBOARDPREF, 1 );
test_reg_key_ex2( SPI_SETKEYBOARDPREF_REGKEY, SPI_SETKEYBOARDPREF_REGKEY_LEGACY,
SPI_SETKEYBOARDPREF_VALNAME, SPI_SETKEYBOARDPREF_VALNAME_LEGACY,
vals[i] ? "1" : "0" );
@ -1848,7 +1848,7 @@ static void test_SPI_SETSCREENREADER( void ) /* 71 */
rc=SystemParametersInfoA( SPI_SETSCREENREADER, vals[i], 0,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
test_change_message( SPI_SETSCREENREADER, 0 );
test_change_message( SPI_SETSCREENREADER, 1 );
test_reg_key_ex2( SPI_SETSCREENREADER_REGKEY, SPI_SETSCREENREADER_REGKEY_LEGACY,
SPI_SETSCREENREADER_VALNAME, SPI_SETSCREENREADER_VALNAME_LEGACY,
vals[i] ? "1" : "0" );
@ -1917,7 +1917,7 @@ static void test_SPI_SETLOWPOWERACTIVE( void ) /* 85 */
rc=SystemParametersInfoA( SPI_SETLOWPOWERACTIVE, vals[i], 0,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
test_change_message( SPI_SETLOWPOWERACTIVE, 0 );
test_change_message( SPI_SETLOWPOWERACTIVE, 1 );
test_reg_key( SPI_SETLOWPOWERACTIVE_REGKEY,
SPI_SETLOWPOWERACTIVE_VALNAME,
vals[i] ? "1" : "0" );
@ -1954,7 +1954,7 @@ static void test_SPI_SETPOWEROFFACTIVE( void ) /* 86 */
rc=SystemParametersInfoA( SPI_SETPOWEROFFACTIVE, vals[i], 0,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
test_change_message( SPI_SETPOWEROFFACTIVE, 0 );
test_change_message( SPI_SETPOWEROFFACTIVE, 1 );
test_reg_key( SPI_SETPOWEROFFACTIVE_REGKEY,
SPI_SETPOWEROFFACTIVE_VALNAME,
vals[i] ? "1" : "0" );
@ -2206,7 +2206,7 @@ static void test_SPI_SETWHEELSCROLLCHARS( void ) /* 108 */
{
BOOL rc;
UINT old_chars;
const UINT vals[]={0,32767};
const UINT vals[]={32767,0};
unsigned int i;
trace("testing SPI_{GET,SET}WHEELSCROLLCHARS\n");
@ -2224,7 +2224,7 @@ static void test_SPI_SETWHEELSCROLLCHARS( void ) /* 108 */
rc=SystemParametersInfoA( SPI_SETWHEELSCROLLCHARS, vals[i], 0,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
if (!test_error_msg(rc,"SPI_SETWHEELSCROLLCHARS")) return;
test_change_message( SPI_SETWHEELSCROLLCHARS, 0 );
sprintf( buf, "%d", vals[i] );
test_reg_key( SPI_SETMOUSESCROLLCHARS_REGKEY,
@ -2474,6 +2474,8 @@ static void test_GetSystemMetrics( void)
INT CaptionWidth;
MINIMIZEDMETRICS minim;
NONCLIENTMETRICS ncm;
SIZE screen;
minim.cbSize = sizeof( minim);
ncm.cbSize = sizeof( ncm);
SystemParametersInfo( SPI_GETMINIMIZEDMETRICS, 0, &minim, 0);
@ -2549,8 +2551,9 @@ static void test_GetSystemMetrics( void)
/* SM_SECURE */
ok_gsm( SM_CXEDGE, 2);
ok_gsm( SM_CYEDGE, 2);
ok_gsm( SM_CXMINSPACING, GetSystemMetrics( SM_CXMINIMIZED) + minim.iHorzGap );
ok_gsm( SM_CYMINSPACING, GetSystemMetrics( SM_CYMINIMIZED) + minim.iVertGap );
/* sign-extension for iHorzGap/iVertGap is broken on Win9x */
ok_gsm( SM_CXMINSPACING, GetSystemMetrics( SM_CXMINIMIZED) + (short)minim.iHorzGap );
ok_gsm( SM_CYMINSPACING, GetSystemMetrics( SM_CYMINIMIZED) + (short)minim.iVertGap );
/* SM_CXSMICON */
/* SM_CYSMICON */
ok_gsm( SM_CYSMCAPTION, ncm.iSmCaptionHeight + 1);
@ -2566,10 +2569,15 @@ static void test_GetSystemMetrics( void)
/* SM_ARRANGE */
ok_gsm( SM_CXMINIMIZED, minim.iWidth + 6);
ok_gsm( SM_CYMINIMIZED, GetSystemMetrics( SM_CYCAPTION) + 5);
ok_gsm( SM_CXMAXTRACK, GetSystemMetrics( SM_CXVIRTUALSCREEN) +
4 + 2 * GetSystemMetrics( SM_CXFRAME));
ok_gsm( SM_CYMAXTRACK, GetSystemMetrics( SM_CYVIRTUALSCREEN) +
4 + 2 * GetSystemMetrics( SM_CYFRAME));
screen.cx = GetSystemMetrics( SM_CXVIRTUALSCREEN );
screen.cy = GetSystemMetrics( SM_CYVIRTUALSCREEN );
if (!screen.cx || !screen.cy) /* not supported on NT4 */
{
screen.cx = GetSystemMetrics( SM_CXSCREEN );
screen.cy = GetSystemMetrics( SM_CYSCREEN );
}
ok_gsm( SM_CXMAXTRACK, screen.cx + 4 + 2 * GetSystemMetrics(SM_CXFRAME));
ok_gsm( SM_CYMAXTRACK, screen.cy + 4 + 2 * GetSystemMetrics(SM_CYFRAME));
/* the next two cannot really be tested as they depend on (application)
* toolbars */
/* SM_CXMAXIMIZED */