Michael Stefaniuc : user32/tests: Use SetRect instead of open coding it.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Apr 18 10:37:03 CDT 2016
Module: wine
Branch: master
Commit: 4ee81394878f5917f9484a4ce0952aa07f866c9d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4ee81394878f5917f9484a4ce0952aa07f866c9d
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Mon Apr 18 10:12:23 2016 +0200
user32/tests: Use SetRect instead of open coding it.
Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/tests/edit.c | 11 ++---------
dlls/user32/tests/sysparams.c | 5 +----
dlls/user32/tests/uitools.c | 3 +--
dlls/user32/tests/win.c | 6 +++---
4 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/dlls/user32/tests/edit.c b/dlls/user32/tests/edit.c
index 6ff7225..c9e31f7 100644
--- a/dlls/user32/tests/edit.c
+++ b/dlls/user32/tests/edit.c
@@ -574,11 +574,7 @@ static HWND create_child_editcontrol (DWORD style, DWORD exstyle)
HWND editWnd;
RECT rect;
BOOL b;
-
- rect.left = 0;
- rect.top = 0;
- rect.right = 300;
- rect.bottom = 300;
+ SetRect(&rect, 0, 0, 300, 300);
b = AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
ok(b, "AdjustWindowRect failed\n");
@@ -1468,10 +1464,7 @@ static void test_margins(void)
the rectangle must not change */
SendMessageA(hwEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(10, 10));
- old_rect.left = 1;
- old_rect.right = 99;
- old_rect.top = 1;
- old_rect.bottom = 99;
+ SetRect(&old_rect, 1, 1, 99, 99);
SendMessageA(hwEdit, EM_SETRECT, 0, (LPARAM)&old_rect);
SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&old_rect);
SendMessageA(hwEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(10, 10));
diff --git a/dlls/user32/tests/sysparams.c b/dlls/user32/tests/sysparams.c
index cffc815..075a0c7 100644
--- a/dlls/user32/tests/sysparams.c
+++ b/dlls/user32/tests/sysparams.c
@@ -1835,10 +1835,7 @@ static void test_SPI_SETWORKAREA( void ) /* 47 */
* Changing the work area by just one pixel should make this occurrence
* reasonably unlikely.
*/
- curr_val.left = old_area.left;
- curr_val.top = old_area.top;
- curr_val.right = old_area.right-1;
- curr_val.bottom = old_area.bottom-1;
+ SetRect(&curr_val, old_area.left, old_area.top, old_area.right - 1, old_area.bottom - 1);
rc=SystemParametersInfoA( SPI_SETWORKAREA, 0, &curr_val,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
if (!test_error_msg(rc,"SPI_SETWORKAREA")) return;
diff --git a/dlls/user32/tests/uitools.c b/dlls/user32/tests/uitools.c
index 5f10b00..e1ddf2b 100644
--- a/dlls/user32/tests/uitools.c
+++ b/dlls/user32/tests/uitools.c
@@ -49,8 +49,7 @@ static void test_FillRect(void)
/* select black brush */
old_brush = SelectObject(hdcmem, GetStockObject(BLACK_BRUSH));
- r.left = r.top = 0;
- r.right = r.bottom = 5;
+ SetRect(&r, 0, 0, 5, 5);
FillRect(hdcmem, &r, 0);
SelectObject(hdcmem, old_brush);
/* bitmap filled with last selected brush */
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index dd5f967..673b9b5 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -7578,7 +7578,7 @@ static void test_winregion(void)
ok( ret == ERROR, "Expected ERROR, got %d\n", ret);
ok( GetLastError() == 0xdeadbeef, "Expected , got %d\n", GetLastError());
- r.left = r.top = r.right = r.bottom = 0;
+ SetRectEmpty(&r);
ret = pGetWindowRgnBox(hwnd, &r);
ok( ret == SIMPLEREGION, "Expected SIMPLEREGION, got %d\n", ret);
ok( r.left == 2 && r.top == 3 && r.right == 10 && r.bottom == 15,
@@ -7589,10 +7589,10 @@ static void test_winregion(void)
hrgn = CreateRectRgn(2, 3, 10, 15);
ret = pMirrorRgn( hwnd, hrgn );
ok( ret == TRUE, "MirrorRgn failed %u\n", ret );
- r.left = r.top = r.right = r.bottom = 0;
+ SetRectEmpty(&r);
GetWindowRect( hwnd, &r );
width = r.right - r.left;
- r.left = r.top = r.right = r.bottom = 0;
+ SetRectEmpty(&r);
ret = GetRgnBox( hrgn, &r );
ok( ret == SIMPLEREGION, "GetRgnBox failed %u\n", ret );
ok( r.left == width - 10 && r.top == 3 && r.right == width - 2 && r.bottom == 15,
More information about the wine-cvs
mailing list