shell32/tests: Use SetRect instead of open coding it.

Michael Stefaniuc mstefani at redhat.de
Tue Apr 12 05:32:50 CDT 2016


Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
---
 dlls/shell32/tests/appbar.c   | 30 ++++++------------------------
 dlls/shell32/tests/ebrowser.c | 20 ++++++++++----------
 dlls/shell32/tests/shlview.c  |  3 +--
 3 files changed, 17 insertions(+), 36 deletions(-)

diff --git a/dlls/shell32/tests/appbar.c b/dlls/shell32/tests/appbar.c
index 8138131..ca72f3f 100644
--- a/dlls/shell32/tests/appbar.c
+++ b/dlls/shell32/tests/appbar.c
@@ -232,10 +232,7 @@ static void test_setpos(void)
     windows[0].registered = TRUE;
     windows[0].to_be_deleted = FALSE;
     windows[0].edge = ABE_BOTTOM;
-    windows[0].desired_rect.left = 0;
-    windows[0].desired_rect.right = screen_width;
-    windows[0].desired_rect.top = screen_height - 15;
-    windows[0].desired_rect.bottom = screen_height;
+    SetRect(&windows[0].desired_rect, 0, screen_height - 15, screen_width, screen_height);
     SetWindowLongPtrA(windows[0].hwnd, GWLP_USERDATA, (LONG_PTR)&windows[0]);
     testwindow_setpos(windows[0].hwnd);
     do_events();
@@ -253,10 +250,7 @@ static void test_setpos(void)
     windows[1].registered = TRUE;
     windows[1].to_be_deleted = FALSE;
     windows[1].edge = ABE_BOTTOM;
-    windows[1].desired_rect.left = 0;
-    windows[1].desired_rect.right = screen_width;
-    windows[1].desired_rect.top = screen_height - 10;
-    windows[1].desired_rect.bottom = screen_height;
+    SetRect(&windows[1].desired_rect, 0, screen_height - 10, screen_width, screen_height);
     SetWindowLongPtrA(windows[1].hwnd, GWLP_USERDATA, (LONG_PTR)&windows[1]);
     testwindow_setpos(windows[1].hwnd);
 
@@ -285,10 +279,7 @@ static void test_setpos(void)
     windows[2].registered = TRUE;
     windows[2].to_be_deleted = FALSE;
     windows[2].edge = ABE_BOTTOM;
-    windows[2].desired_rect.left = 0;
-    windows[2].desired_rect.right = screen_width;
-    windows[2].desired_rect.top = screen_height - 10;
-    windows[2].desired_rect.bottom = screen_height;
+    SetRect(&windows[2].desired_rect, 0, screen_height - 10, screen_width, screen_height);
     SetWindowLongPtrA(windows[2].hwnd, GWLP_USERDATA, (LONG_PTR)&windows[2]);
     testwindow_setpos(windows[2].hwnd);
 
@@ -299,10 +290,7 @@ static void test_setpos(void)
 
     /* move windows[2] to the right side of the screen */
     windows[2].edge = ABE_RIGHT;
-    windows[2].desired_rect.left = screen_width - 15;
-    windows[2].desired_rect.right = screen_width;
-    windows[2].desired_rect.top = 0;
-    windows[2].desired_rect.bottom = screen_height;
+    SetRect(&windows[2].desired_rect, screen_width - 15, 0, screen_width, screen_height);
     testwindow_setpos(windows[2].hwnd);
 
     do_events_until(no_appbars_intersect);
@@ -312,10 +300,7 @@ static void test_setpos(void)
 
     /* move windows[1] to the top of the screen */
     windows[1].edge = ABE_TOP;
-    windows[1].desired_rect.left = 0;
-    windows[1].desired_rect.right = screen_width;
-    windows[1].desired_rect.top = 0;
-    windows[1].desired_rect.bottom = 15;
+    SetRect(&windows[1].desired_rect, 0, 0, screen_width, 15);
     testwindow_setpos(windows[1].hwnd);
 
     do_events_until(no_appbars_intersect);
@@ -325,10 +310,7 @@ static void test_setpos(void)
 
     /* move windows[1] back to the bottom of the screen */
     windows[1].edge = ABE_BOTTOM;
-    windows[1].desired_rect.left = 0;
-    windows[1].desired_rect.right = screen_width;
-    windows[1].desired_rect.top = screen_height - 10;
-    windows[1].desired_rect.bottom = screen_height;
+    SetRect(&windows[1].desired_rect, 0, screen_height - 10, screen_width, screen_height);
     testwindow_setpos(windows[1].hwnd);
 
     do_events_until(no_appbars_intersect);
diff --git a/dlls/shell32/tests/ebrowser.c b/dlls/shell32/tests/ebrowser.c
index 3b22ffb..57f52c9 100644
--- a/dlls/shell32/tests/ebrowser.c
+++ b/dlls/shell32/tests/ebrowser.c
@@ -98,7 +98,7 @@ static HRESULT ebrowser_instantiate(IExplorerBrowser **peb)
 static HRESULT ebrowser_initialize(IExplorerBrowser *peb)
 {
     RECT rc;
-    rc.top = rc.left = 0; rc.bottom = rc.right = 500;
+    SetRect(&rc, 0, 0, 500, 500);
     return IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
 }
 
@@ -802,7 +802,7 @@ static void test_initialization(void)
     /* Initialize with a few different rectangles */
     peb = NULL;
     ebrowser_instantiate(&peb);
-    rc.left = 50; rc.top = 20; rc.right = 100; rc.bottom = 80;
+    SetRect(&rc, 50, 20, 100, 80);
     hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
     ok(hr == S_OK, "got (0x%08x)\n", hr);
     hr = IExplorerBrowser_QueryInterface(peb, &IID_IShellBrowser, (void**)&psb);
@@ -861,7 +861,7 @@ static void test_initialization(void)
     ebrowser_instantiate(&peb);
     hr = IExplorerBrowser_SetOptions(peb, EBO_NOBORDER);
     ok(hr == S_OK, "got 0x%08x\n", hr);
-    rc.left = 50; rc.top = 20; rc.right = 100; rc.bottom = 80;
+    SetRect(&rc, 50, 20, 100, 80);
 
     hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
     ok(hr == S_OK, "got (0x%08x)\n", hr);
@@ -889,7 +889,7 @@ static void test_initialization(void)
     ok(lres == 0, "Got refcount %d\n", lres);
 
     ebrowser_instantiate(&peb);
-    rc.left = -1; rc.top = -1; rc.right = 1; rc.bottom = 1;
+    SetRect(&rc, -1, -1, 1, 1);
     hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
     ok(hr == S_OK, "got (0x%08x)\n", hr);
     IExplorerBrowser_Destroy(peb);
@@ -897,7 +897,7 @@ static void test_initialization(void)
     ok(lres == 0, "Got refcount %d\n", lres);
 
     ebrowser_instantiate(&peb);
-    rc.left = 10; rc.top = 10; rc.right = 5; rc.bottom = 5;
+    SetRect(&rc, 10, 10, 5, 5);
     hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
     ok(hr == S_OK, "got (0x%08x)\n", hr);
     IExplorerBrowser_Destroy(peb);
@@ -905,7 +905,7 @@ static void test_initialization(void)
     ok(lres == 0, "Got refcount %d\n", lres);
 
     ebrowser_instantiate(&peb);
-    rc.left = 10; rc.top = 10; rc.right = 5; rc.bottom = 5;
+    SetRect(&rc, 10, 10, 5, 5);
     hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
     ok(hr == S_OK, "got (0x%08x)\n", hr);
     IExplorerBrowser_Destroy(peb);
@@ -1105,12 +1105,12 @@ static void test_basics(void)
     hr = IExplorerBrowser_SetRect(peb, NULL, rc);
     ok(hr == S_OK, "got (0x%08x)\n", hr);
 
-    rc.left = 100; rc.top = 100; rc.right = 10; rc.bottom = 10;
+    SetRect(&rc, 100, 100, 10, 10);
     hr = IExplorerBrowser_SetRect(peb, NULL, rc);
     ok(hr == S_OK, "got (0x%08x)\n", hr);
 
     /* SetRect with DeferWindowPos */
-    rc.left = rc.top = 0; rc.right = rc.bottom = 10;
+    SetRect(&rc, 0, 0, 10, 10);
     hdwp = BeginDeferWindowPos(1);
     hr = IExplorerBrowser_SetRect(peb, &hdwp, rc);
     ok(hr == S_OK, "got (0x%08x)\n", hr);
@@ -1125,7 +1125,7 @@ static void test_basics(void)
     ok(!lres, "EndDeferWindowPos succeeded unexpectedly.\n");
 
     /* Test positioning */
-    rc.left = 10; rc.top = 20; rc.right = 50; rc.bottom = 50;
+    SetRect(&rc, 10, 20, 50, 50);
     hr = IExplorerBrowser_SetRect(peb, NULL, rc);
     ok(hr == S_OK, "got (0x%08x)\n", hr);
     hr = IExplorerBrowser_QueryInterface(peb, &IID_IShellBrowser, (void**)&psb);
@@ -1715,7 +1715,7 @@ static void test_InputObject(void)
     hr = IInputObject_TranslateAcceleratorIO(pio, &msg_a);
     todo_wine ok(hr == E_FAIL, "Got 0x%08x\n", hr);
 
-    rc.left = 0; rc.top = 0; rc.right = 100; rc.bottom = 100;
+    SetRect(&rc, 0, 0, 100, 100);
     hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
     ok(hr == S_OK, "Got 0x%08x\n", hr);
 
diff --git a/dlls/shell32/tests/shlview.c b/dlls/shell32/tests/shlview.c
index 8b2b5b4..2c683e3 100644
--- a/dlls/shell32/tests/shlview.c
+++ b/dlls/shell32/tests/shlview.c
@@ -761,8 +761,7 @@ if (0)
     settings.ViewMode = FVM_ICON;
     settings.fFlags = 0;
     hwnd_view = (HWND)0xdeadbeef;
-    r.left = r.top = 0;
-    r.right = r.bottom = 100;
+    SetRect(&r, 0, 0, 100, 100);
     hr = IShellView_CreateViewWindow(view, NULL, &settings, browser, &r, &hwnd_view);
     ok(hr == S_OK, "got (0x%08x)\n", hr);
     ok(IsWindow(hwnd_view), "got %p\n", hwnd_view);
-- 
2.4.11



More information about the wine-patches mailing list