Commit 851777dc authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

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

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