Commit a4590d2b authored by Vitaly Lipatov's avatar Vitaly Lipatov Committed by Alexandre Julliard

- remove return: now break loop if can't change state during test

- add test for value returned by SwapMouseButton - fix SwapMouseButton return value (it returns previous state)
parent 030dbe2d
...@@ -2405,10 +2405,16 @@ INT WINAPI GetSystemMetrics( INT index ) ...@@ -2405,10 +2405,16 @@ INT WINAPI GetSystemMetrics( INT index )
/*********************************************************************** /***********************************************************************
* SwapMouseButton (USER32.@) * SwapMouseButton (USER32.@)
* Reverse or restore the meaning of the left and right mouse buttons
* fSwap [I ] TRUE - reverse, FALSE - original
* RETURN
* previous state
*/ */
BOOL WINAPI SwapMouseButton( BOOL fSwap ) BOOL WINAPI SwapMouseButton( BOOL fSwap )
{ {
return SystemParametersInfoW(SPI_SETMOUSEBUTTONSWAP, fSwap, 0, 0); BOOL prev = GetSystemMetrics(SM_SWAPBUTTON);
SystemParametersInfoW(SPI_SETMOUSEBUTTONSWAP, fSwap, 0, 0);
return prev;
} }
......
...@@ -1011,7 +1011,7 @@ static void test_SPI_SETMOUSEBUTTONSWAP( void ) /* 33 */ ...@@ -1011,7 +1011,7 @@ static void test_SPI_SETMOUSEBUTTONSWAP( void ) /* 33 */
rc=SystemParametersInfoA( SPI_SETMOUSEBUTTONSWAP, vals[i], 0, rc=SystemParametersInfoA( SPI_SETMOUSEBUTTONSWAP, vals[i], 0,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE ); SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
if (!test_error_msg(rc,"SPI_{GET,SET}MOUSEBUTTONSWAP")) if (!test_error_msg(rc,"SPI_{GET,SET}MOUSEBUTTONSWAP"))
return; break;
test_change_message( SPI_SETMOUSEBUTTONSWAP, 0 ); test_change_message( SPI_SETMOUSEBUTTONSWAP, 0 );
test_reg_key( SPI_SETMOUSEBUTTONSWAP_REGKEY, test_reg_key( SPI_SETMOUSEBUTTONSWAP_REGKEY,
...@@ -1019,6 +1019,10 @@ static void test_SPI_SETMOUSEBUTTONSWAP( void ) /* 33 */ ...@@ -1019,6 +1019,10 @@ static void test_SPI_SETMOUSEBUTTONSWAP( void ) /* 33 */
vals[i] ? "1" : "0" ); vals[i] ? "1" : "0" );
eq( GetSystemMetrics( SM_SWAPBUTTON ), (int)vals[i], eq( GetSystemMetrics( SM_SWAPBUTTON ), (int)vals[i],
"SM_SWAPBUTTON", "%d" ); "SM_SWAPBUTTON", "%d" );
rc=SwapMouseButton((BOOL)vals[i^1]);
eq( GetSystemMetrics( SM_SWAPBUTTON ), (int)vals[i^1],
"SwapMouseButton", "%d" );
ok( rc==vals[i], "SwapMouseButton does not return previous state (really %d)\n", rc );
} }
rc=SystemParametersInfoA( SPI_SETMOUSEBUTTONSWAP, old_b, 0, rc=SystemParametersInfoA( SPI_SETMOUSEBUTTONSWAP, old_b, 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment