user32/tests: In sysparams fix another case where a test changes a users desktop setting.
Made several tests pass on NT4 (no SP), Vista and Win2k8.
This commit is contained in:
parent
7bde2792c2
commit
ebbf99abce
|
@ -709,11 +709,15 @@ static void test_SPI_SETBORDER( void ) /* 6 */
|
|||
BOOL rc;
|
||||
UINT old_border;
|
||||
NONCLIENTMETRICSA ncmsave;
|
||||
INT CaptionWidth;
|
||||
INT CaptionWidth,
|
||||
PaddedBorderWidth;
|
||||
|
||||
ncmsave.cbSize = sizeof( ncmsave);
|
||||
rc=SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &ncmsave, 0);
|
||||
ok(rc!=0,"SystemParametersInfoA: rc=%d err=%d\n",rc,GetLastError());
|
||||
if( !rc) {
|
||||
win_skip("SPI_GETNONCLIENTMETRICS is not available\n");
|
||||
return;
|
||||
}
|
||||
/* CaptionWidth from the registry may have different value of iCaptionWidth
|
||||
* from the non client metrics (observed on WinXP).
|
||||
* Fix this so we can safely restore settings with the nonclientmetrics */
|
||||
|
@ -735,8 +739,10 @@ static void test_SPI_SETBORDER( void ) /* 6 */
|
|||
if (!test_error_msg(rc,"SPI_{GET,SET}BORDER"))
|
||||
return;
|
||||
/* FIXME: include new PaddedBorderWidth parameter */
|
||||
if( old_border != ncmsave.iBorderWidth){
|
||||
win_skip( "Can not reliable restore border width yet\n");
|
||||
PaddedBorderWidth = ncmsave.iBorderWidth - old_border;
|
||||
if( PaddedBorderWidth){
|
||||
win_skip( "Can not reliable restore border width yet (PaddedBorderWidth = %d)\n",
|
||||
PaddedBorderWidth);
|
||||
return;
|
||||
}
|
||||
/* This will restore sane values if the test hang previous run. */
|
||||
|
@ -1395,6 +1401,7 @@ static void test_SPI_SETNONCLIENTMETRICS( void ) /* 44 */
|
|||
Ncmstart.cbSize = sizeof(NONCLIENTMETRICSA);
|
||||
|
||||
trace("testing SPI_{GET,SET}NONCLIENTMETRICS\n");
|
||||
change_counter = 0;
|
||||
SetLastError(0xdeadbeef);
|
||||
rc=SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &Ncmorig, FALSE );
|
||||
if (!test_error_msg(rc,"SPI_{GET,SET}NONCLIENTMETRICS"))
|
||||
|
@ -1448,7 +1455,7 @@ static void test_SPI_SETNONCLIENTMETRICS( void ) /* 44 */
|
|||
ok(rc!=0,"SystemParametersInfoA: rc=%d err=%d\n",rc,GetLastError());
|
||||
/* test registry entries */
|
||||
TEST_NONCLIENTMETRICS_REG( Ncmcur)
|
||||
/* test the systemm metrics with these settings */
|
||||
/* test the system metrics with these settings */
|
||||
test_GetSystemMetrics();
|
||||
/* now for something invalid: increase the {menu|caption|smcaption} fonts
|
||||
by a large amount will increase the {menu|caption|smcaption} height*/
|
||||
|
@ -1483,19 +1490,22 @@ static void test_SPI_SETNONCLIENTMETRICS( void ) /* 44 */
|
|||
"SmCaptionHeight: %d expected %d\n", Ncmcur.iSmCaptionHeight, expect);
|
||||
|
||||
ok( Ncmcur.iCaptionWidth == 8 ||
|
||||
Ncmcur.iCaptionWidth == 12 || /* Vista, W7b */
|
||||
Ncmcur.iCaptionWidth == Ncmstart.iCaptionWidth, /* with windows XP theme, the value never changes */
|
||||
"CaptionWidth: %d expected 8\n", Ncmcur.iCaptionWidth);
|
||||
"CaptionWidth: %d expected 8, 12 or %d\n", Ncmcur.iCaptionWidth, Ncmstart.iCaptionWidth);
|
||||
ok( Ncmcur.iScrollWidth == 8,
|
||||
"ScrollWidth: %d expected 8\n", Ncmcur.iScrollWidth);
|
||||
ok( Ncmcur.iScrollHeight == 8,
|
||||
"ScrollHeight: %d expected 8\n", Ncmcur.iScrollHeight);
|
||||
/* test the systemm metrics with these settings */
|
||||
/* test the system metrics with these settings */
|
||||
test_GetSystemMetrics();
|
||||
/* restore */
|
||||
rc=SystemParametersInfoA( SPI_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS),
|
||||
&Ncmorig, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
|
||||
test_change_message( SPI_SETNONCLIENTMETRICS, 0 );
|
||||
ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%d\n",rc,GetLastError());
|
||||
/* test the system metrics with these settings */
|
||||
test_GetSystemMetrics();
|
||||
}
|
||||
|
||||
static void test_SPI_SETMINIMIZEDMETRICS( void ) /* 44 */
|
||||
|
@ -2414,6 +2424,14 @@ static DWORD WINAPI SysParamsThreadFunc( LPVOID lpParam )
|
|||
test_SPI_SETMOUSEBUTTONSWAP(); /* 33 */
|
||||
test_SPI_SETFASTTASKSWITCH(); /* 36 */
|
||||
test_SPI_SETDRAGFULLWINDOWS(); /* 37 */
|
||||
/* test_WM_DISPLAYCHANGE seems to be somewhat buggy on
|
||||
* some versions of Windows (Vista, Win2k8, Win7B) in that
|
||||
* not all metrics are properly restored. Problems are
|
||||
* SM_CXMAXTRACK, SM_CYMAXTRACK
|
||||
* Fortunately setting the Non-Client metrics like in
|
||||
* test_SPI_SETNONCLIENTMETRICS will corect this. That is why
|
||||
* we do the DISPLAY change now... */
|
||||
test_WM_DISPLAYCHANGE();
|
||||
test_SPI_SETNONCLIENTMETRICS(); /* 42 */
|
||||
test_SPI_SETMINIMIZEDMETRICS(); /* 44 */
|
||||
test_SPI_SETICONMETRICS(); /* 46 */
|
||||
|
@ -2433,7 +2451,6 @@ static DWORD WINAPI SysParamsThreadFunc( LPVOID lpParam )
|
|||
test_SPI_SETWHEELSCROLLCHARS(); /* 108 */
|
||||
test_SPI_SETWALLPAPER(); /* 115 */
|
||||
|
||||
test_WM_DISPLAYCHANGE();
|
||||
|
||||
SendMessageA( ghTestWnd, WM_DESTROY, 0, 0 );
|
||||
return 0;
|
||||
|
@ -2514,10 +2531,11 @@ static void test_GetSystemMetrics( void)
|
|||
{
|
||||
TEXTMETRICA tmMenuFont;
|
||||
UINT IconSpacing, IconVerticalSpacing;
|
||||
BOOL rc;
|
||||
|
||||
HDC hdc = CreateIC( "Display", 0, 0, 0);
|
||||
UINT avcwCaption;
|
||||
INT CaptionWidth;
|
||||
INT CaptionWidthfromreg;
|
||||
MINIMIZEDMETRICS minim;
|
||||
NONCLIENTMETRICS ncm;
|
||||
SIZE screen;
|
||||
|
@ -2525,11 +2543,14 @@ static void test_GetSystemMetrics( void)
|
|||
minim.cbSize = sizeof( minim);
|
||||
ncm.cbSize = sizeof( ncm);
|
||||
SystemParametersInfo( SPI_GETMINIMIZEDMETRICS, 0, &minim, 0);
|
||||
SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
|
||||
|
||||
rc = SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
|
||||
if( !rc) {
|
||||
win_skip("SPI_GETNONCLIENTMETRICS is not available\n");
|
||||
return;
|
||||
}
|
||||
/* CaptionWidth from the registry may have different value of iCaptionWidth
|
||||
* from the non client metrics (observed on WinXP) */
|
||||
CaptionWidth = metricfromreg(
|
||||
CaptionWidthfromreg = metricfromreg(
|
||||
"Control Panel\\Desktop\\WindowMetrics","CaptionWidth", dpi);
|
||||
get_text_metr_size( hdc, &ncm.lfMenuFont, &tmMenuFont, NULL);
|
||||
get_text_metr_size( hdc, &ncm.lfCaptionFont, NULL, &avcwCaption);
|
||||
|
@ -2573,8 +2594,8 @@ static void test_GetSystemMetrics( void)
|
|||
/* SM_RESERVED2 */
|
||||
/* SM_RESERVED3 */
|
||||
/* SM_RESERVED4 */
|
||||
ok_gsm( SM_CXMIN, 3 * max( CaptionWidth, 8) + GetSystemMetrics( SM_CYSIZE) +
|
||||
4 + 4 * avcwCaption + 2 * GetSystemMetrics( SM_CXFRAME));
|
||||
ok_gsm( SM_CXMIN, 3 * max( CaptionWidthfromreg >= 0 ? CaptionWidthfromreg : ncm.iCaptionWidth, 8) +
|
||||
GetSystemMetrics( SM_CYSIZE) + 4 + 4 * avcwCaption + 2 * GetSystemMetrics( SM_CXFRAME));
|
||||
ok_gsm( SM_CYMIN, GetSystemMetrics( SM_CYCAPTION) +
|
||||
2 * GetSystemMetrics( SM_CYFRAME));
|
||||
ok_gsm_2( SM_CXSIZE,
|
||||
|
@ -2661,8 +2682,8 @@ static void test_GetSystemMetrics( void)
|
|||
ncm.iBorderWidth, ncm.iCaptionWidth, ncm.iCaptionHeight, IconSpacing, IconVerticalSpacing);
|
||||
trace( "MenuHeight %d MenuWidth %d ScrollHeight %d ScrollWidth %d SmCaptionHeight %d SmCaptionWidth %d\n",
|
||||
ncm.iMenuHeight, ncm.iMenuWidth, ncm.iScrollHeight, ncm.iScrollWidth, ncm.iSmCaptionHeight, ncm.iSmCaptionWidth);
|
||||
trace( "Captionfontchar width %d MenuFont %d,%d CaptionWidth from registry: %d\n",
|
||||
avcwCaption, tmMenuFont.tmHeight, tmMenuFont.tmExternalLeading, CaptionWidth);
|
||||
trace( "Captionfontchar width %d MenuFont %d,%d CaptionWidth from registry: %d screen %d,%d\n",
|
||||
avcwCaption, tmMenuFont.tmHeight, tmMenuFont.tmExternalLeading, CaptionWidthfromreg, screen.cx, screen.cy);
|
||||
}
|
||||
ReleaseDC( 0, hdc);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue