2008-09-02 22:08:20 +02:00
|
|
|
/* Unit tests for appbars
|
|
|
|
*
|
|
|
|
* Copyright 2008 Vincent Povirk for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include <windows.h>
|
2013-10-26 21:10:26 +02:00
|
|
|
#include "shellapi.h"
|
2008-09-02 22:08:20 +02:00
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
|
|
|
#define MSG_APPBAR WM_APP
|
|
|
|
|
2008-09-15 02:54:05 +02:00
|
|
|
static const CHAR testwindow_class[] = "testwindow";
|
2008-09-02 22:08:20 +02:00
|
|
|
|
|
|
|
static HMONITOR (WINAPI *pMonitorFromWindow)(HWND, DWORD);
|
2015-07-22 11:51:29 +02:00
|
|
|
static HRESULT (WINAPI *pGetCurrentProcessExplicitAppUserModelID)(PWSTR*);
|
2008-09-02 22:08:20 +02:00
|
|
|
|
2008-09-22 01:35:25 +02:00
|
|
|
typedef BOOL (*boolean_function)(void);
|
|
|
|
|
2008-09-02 22:08:20 +02:00
|
|
|
struct testwindow_info
|
|
|
|
{
|
2008-09-22 01:35:25 +02:00
|
|
|
HWND hwnd;
|
|
|
|
BOOL registered;
|
2009-06-16 15:07:22 +02:00
|
|
|
BOOL to_be_deleted;
|
2008-09-02 22:08:20 +02:00
|
|
|
RECT desired_rect;
|
|
|
|
UINT edge;
|
|
|
|
RECT allocated_rect;
|
|
|
|
};
|
|
|
|
|
2008-09-22 01:35:25 +02:00
|
|
|
static struct testwindow_info windows[3];
|
|
|
|
|
|
|
|
static int expected_bottom;
|
|
|
|
|
2008-09-02 22:08:20 +02:00
|
|
|
static void testwindow_setpos(HWND hwnd)
|
|
|
|
{
|
2013-10-26 21:10:26 +02:00
|
|
|
struct testwindow_info* info = (struct testwindow_info*)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
2008-09-02 22:08:20 +02:00
|
|
|
APPBARDATA abd;
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
ok(info != NULL, "got unexpected ABN_POSCHANGED notification\n");
|
|
|
|
|
2008-09-22 01:35:25 +02:00
|
|
|
if (!info || !info->registered)
|
2008-09-02 22:08:20 +02:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-06-16 15:07:22 +02:00
|
|
|
if (info->to_be_deleted)
|
|
|
|
{
|
|
|
|
win_skip("Some Win95 and NT4 systems send messages to removed taskbars\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-09-02 22:08:20 +02:00
|
|
|
abd.cbSize = sizeof(abd);
|
|
|
|
abd.hWnd = hwnd;
|
|
|
|
abd.uEdge = info->edge;
|
|
|
|
abd.rc = info->desired_rect;
|
|
|
|
ret = SHAppBarMessage(ABM_QUERYPOS, &abd);
|
|
|
|
ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
|
|
|
|
switch (info->edge)
|
|
|
|
{
|
|
|
|
case ABE_BOTTOM:
|
|
|
|
ok(info->desired_rect.top == abd.rc.top, "ABM_QUERYPOS changed top of rect from %i to %i\n", info->desired_rect.top, abd.rc.top);
|
|
|
|
abd.rc.top = abd.rc.bottom - (info->desired_rect.bottom - info->desired_rect.top);
|
|
|
|
break;
|
|
|
|
case ABE_LEFT:
|
2009-06-06 12:44:53 +02:00
|
|
|
ok(info->desired_rect.right == abd.rc.right, "ABM_QUERYPOS changed right of rect from %i to %i\n", info->desired_rect.right, abd.rc.right);
|
2008-09-02 22:08:20 +02:00
|
|
|
abd.rc.right = abd.rc.left + (info->desired_rect.right - info->desired_rect.left);
|
|
|
|
break;
|
|
|
|
case ABE_RIGHT:
|
2009-06-06 12:44:53 +02:00
|
|
|
ok(info->desired_rect.left == abd.rc.left, "ABM_QUERYPOS changed left of rect from %i to %i\n", info->desired_rect.left, abd.rc.left);
|
2008-09-02 22:08:20 +02:00
|
|
|
abd.rc.left = abd.rc.right - (info->desired_rect.right - info->desired_rect.left);
|
|
|
|
break;
|
|
|
|
case ABE_TOP:
|
2009-06-06 12:44:53 +02:00
|
|
|
ok(info->desired_rect.bottom == abd.rc.bottom, "ABM_QUERYPOS changed bottom of rect from %i to %i\n", info->desired_rect.bottom, abd.rc.bottom);
|
2008-09-02 22:08:20 +02:00
|
|
|
abd.rc.bottom = abd.rc.top + (info->desired_rect.bottom - info->desired_rect.top);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = SHAppBarMessage(ABM_SETPOS, &abd);
|
|
|
|
ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
|
|
|
|
|
|
|
|
info->allocated_rect = abd.rc;
|
|
|
|
MoveWindow(hwnd, abd.rc.left, abd.rc.top, abd.rc.right-abd.rc.left, abd.rc.bottom-abd.rc.top, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static LRESULT CALLBACK testwindow_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
|
|
|
{
|
|
|
|
switch(msg)
|
|
|
|
{
|
|
|
|
case MSG_APPBAR:
|
|
|
|
{
|
|
|
|
switch(wparam)
|
|
|
|
{
|
|
|
|
case ABN_POSCHANGED:
|
|
|
|
testwindow_setpos(hwnd);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-26 21:10:26 +02:00
|
|
|
return DefWindowProcA(hwnd, msg, wparam, lparam);
|
2008-09-02 22:08:20 +02:00
|
|
|
}
|
|
|
|
|
2008-09-22 01:35:25 +02:00
|
|
|
/* process pending messages until a condition is true or 3 seconds pass */
|
|
|
|
static void do_events_until(boolean_function test)
|
|
|
|
{
|
|
|
|
MSG msg;
|
|
|
|
UINT_PTR timerid;
|
|
|
|
BOOL timedout=FALSE;
|
|
|
|
|
|
|
|
timerid = SetTimer(0, 0, 3000, NULL);
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
|
|
|
|
{
|
|
|
|
if (msg.hwnd == 0 && msg.message == WM_TIMER && msg.wParam == timerid)
|
|
|
|
timedout = TRUE;
|
|
|
|
TranslateMessage(&msg);
|
|
|
|
DispatchMessageA(&msg);
|
|
|
|
}
|
|
|
|
if (timedout || test())
|
|
|
|
break;
|
|
|
|
WaitMessage();
|
|
|
|
}
|
|
|
|
|
|
|
|
KillTimer(0, timerid);
|
|
|
|
}
|
|
|
|
|
2008-09-02 22:08:20 +02:00
|
|
|
/* process any pending messages */
|
|
|
|
static void do_events(void)
|
|
|
|
{
|
|
|
|
MSG msg;
|
|
|
|
|
2008-09-15 02:54:05 +02:00
|
|
|
while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
|
2008-09-02 22:08:20 +02:00
|
|
|
{
|
|
|
|
TranslateMessage(&msg);
|
2008-09-15 02:54:05 +02:00
|
|
|
DispatchMessageA(&msg);
|
2008-09-02 22:08:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-22 01:35:25 +02:00
|
|
|
static BOOL no_appbars_intersect(void)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
RECT rc;
|
|
|
|
|
|
|
|
for (i=0; i<2; i++)
|
|
|
|
{
|
|
|
|
for (j=i+1; j<3; j++)
|
|
|
|
{
|
|
|
|
if (windows[i].registered && windows[j].registered &&
|
|
|
|
IntersectRect(&rc, &windows[i].allocated_rect, &windows[j].allocated_rect))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL got_expected_bottom(void)
|
|
|
|
{
|
|
|
|
return (no_appbars_intersect() && windows[1].allocated_rect.bottom == expected_bottom);
|
|
|
|
}
|
|
|
|
|
2008-09-02 22:08:20 +02:00
|
|
|
static void register_testwindow_class(void)
|
|
|
|
{
|
2008-09-15 02:54:05 +02:00
|
|
|
WNDCLASSEXA cls;
|
2008-09-02 22:08:20 +02:00
|
|
|
|
|
|
|
ZeroMemory(&cls, sizeof(cls));
|
|
|
|
cls.cbSize = sizeof(cls);
|
|
|
|
cls.style = 0;
|
|
|
|
cls.lpfnWndProc = testwindow_wndproc;
|
|
|
|
cls.hInstance = NULL;
|
2013-10-26 21:10:26 +02:00
|
|
|
cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
|
2008-09-02 22:08:20 +02:00
|
|
|
cls.hbrBackground = (HBRUSH) COLOR_WINDOW;
|
|
|
|
cls.lpszClassName = testwindow_class;
|
|
|
|
|
2008-09-15 02:54:05 +02:00
|
|
|
RegisterClassExA(&cls);
|
2008-09-02 22:08:20 +02:00
|
|
|
}
|
|
|
|
|
2008-09-22 01:35:25 +02:00
|
|
|
#define test_window_rects(a, b) \
|
|
|
|
ok(!IntersectRect(&rc, &windows[a].allocated_rect, &windows[b].allocated_rect), \
|
|
|
|
"rectangles intersect (%i,%i,%i,%i)/(%i,%i,%i,%i)\n", \
|
|
|
|
windows[a].allocated_rect.left, windows[a].allocated_rect.top, windows[a].allocated_rect.right, windows[a].allocated_rect.bottom, \
|
|
|
|
windows[b].allocated_rect.left, windows[b].allocated_rect.top, windows[b].allocated_rect.right, windows[b].allocated_rect.bottom)
|
|
|
|
|
2008-09-02 22:08:20 +02:00
|
|
|
static void test_setpos(void)
|
|
|
|
{
|
|
|
|
APPBARDATA abd;
|
|
|
|
RECT rc;
|
2008-09-22 01:35:25 +02:00
|
|
|
int screen_width, screen_height;
|
2008-09-02 22:08:20 +02:00
|
|
|
BOOL ret;
|
2009-10-21 11:25:09 +02:00
|
|
|
int org_bottom1;
|
2008-09-02 22:08:20 +02:00
|
|
|
|
|
|
|
screen_width = GetSystemMetrics(SM_CXSCREEN);
|
|
|
|
screen_height = GetSystemMetrics(SM_CYSCREEN);
|
|
|
|
|
2008-09-22 01:35:25 +02:00
|
|
|
/* create and register windows[0] */
|
|
|
|
windows[0].hwnd = CreateWindowExA(WS_EX_TOOLWINDOW|WS_EX_TOPMOST,
|
2008-09-02 22:08:20 +02:00
|
|
|
testwindow_class, testwindow_class, WS_POPUP|WS_VISIBLE, 0, 0, 0, 0,
|
|
|
|
NULL, NULL, NULL, NULL);
|
2008-09-22 01:35:25 +02:00
|
|
|
ok(windows[0].hwnd != NULL, "couldn't create window\n");
|
2008-09-02 22:08:20 +02:00
|
|
|
do_events();
|
|
|
|
abd.cbSize = sizeof(abd);
|
2008-09-22 01:35:25 +02:00
|
|
|
abd.hWnd = windows[0].hwnd;
|
2008-09-02 22:08:20 +02:00
|
|
|
abd.uCallbackMessage = MSG_APPBAR;
|
|
|
|
ret = SHAppBarMessage(ABM_NEW, &abd);
|
|
|
|
ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
|
|
|
|
|
|
|
|
/* ABM_NEW should return FALSE if the window is already registered */
|
|
|
|
ret = SHAppBarMessage(ABM_NEW, &abd);
|
2008-09-02 22:17:09 +02:00
|
|
|
ok(ret == FALSE, "SHAppBarMessage returned %i\n", ret);
|
2008-09-02 22:08:20 +02:00
|
|
|
do_events();
|
|
|
|
|
2008-09-22 01:35:25 +02:00
|
|
|
/* dock windows[0] to the bottom of the screen */
|
|
|
|
windows[0].registered = TRUE;
|
2009-06-16 15:07:22 +02:00
|
|
|
windows[0].to_be_deleted = FALSE;
|
2008-09-22 01:35:25 +02:00
|
|
|
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;
|
2013-10-26 21:10:26 +02:00
|
|
|
SetWindowLongPtrA(windows[0].hwnd, GWLP_USERDATA, (LONG_PTR)&windows[0]);
|
2008-09-22 01:35:25 +02:00
|
|
|
testwindow_setpos(windows[0].hwnd);
|
2008-09-02 22:08:20 +02:00
|
|
|
do_events();
|
|
|
|
|
2008-09-22 01:35:25 +02:00
|
|
|
/* create and register windows[1] */
|
|
|
|
windows[1].hwnd = CreateWindowExA(WS_EX_TOOLWINDOW|WS_EX_TOPMOST,
|
2008-09-02 22:08:20 +02:00
|
|
|
testwindow_class, testwindow_class, WS_POPUP|WS_VISIBLE, 0, 0, 0, 0,
|
|
|
|
NULL, NULL, NULL, NULL);
|
2008-09-22 01:35:25 +02:00
|
|
|
ok(windows[1].hwnd != NULL, "couldn't create window\n");
|
|
|
|
abd.hWnd = windows[1].hwnd;
|
2008-09-02 22:08:20 +02:00
|
|
|
ret = SHAppBarMessage(ABM_NEW, &abd);
|
|
|
|
ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
|
|
|
|
|
2008-09-22 01:35:25 +02:00
|
|
|
/* dock windows[1] to the bottom of the screen */
|
|
|
|
windows[1].registered = TRUE;
|
2009-06-16 15:07:22 +02:00
|
|
|
windows[1].to_be_deleted = FALSE;
|
2008-09-22 01:35:25 +02:00
|
|
|
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;
|
2013-10-26 21:10:26 +02:00
|
|
|
SetWindowLongPtrA(windows[1].hwnd, GWLP_USERDATA, (LONG_PTR)&windows[1]);
|
2008-09-22 01:35:25 +02:00
|
|
|
testwindow_setpos(windows[1].hwnd);
|
2008-09-02 22:08:20 +02:00
|
|
|
|
|
|
|
/* the windows are adjusted to they don't overlap */
|
2008-09-22 01:35:25 +02:00
|
|
|
do_events_until(no_appbars_intersect);
|
|
|
|
test_window_rects(0, 1);
|
|
|
|
|
|
|
|
/* make windows[0] larger, forcing windows[1] to move out of its way */
|
|
|
|
windows[0].desired_rect.top = screen_height - 20;
|
|
|
|
testwindow_setpos(windows[0].hwnd);
|
|
|
|
do_events_until(no_appbars_intersect);
|
|
|
|
test_window_rects(0, 1);
|
2008-09-02 22:08:20 +02:00
|
|
|
|
2008-09-22 01:35:25 +02:00
|
|
|
/* create and register windows[2] */
|
|
|
|
windows[2].hwnd = CreateWindowExA(WS_EX_TOOLWINDOW|WS_EX_TOPMOST,
|
2008-09-02 22:08:20 +02:00
|
|
|
testwindow_class, testwindow_class, WS_POPUP|WS_VISIBLE, 0, 0, 0, 0,
|
|
|
|
NULL, NULL, NULL, NULL);
|
2008-09-22 01:35:25 +02:00
|
|
|
ok(windows[2].hwnd != NULL, "couldn't create window\n");
|
2008-09-02 22:08:20 +02:00
|
|
|
do_events();
|
|
|
|
|
2008-09-22 01:35:25 +02:00
|
|
|
abd.hWnd = windows[2].hwnd;
|
2008-09-02 22:08:20 +02:00
|
|
|
ret = SHAppBarMessage(ABM_NEW, &abd);
|
|
|
|
ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
|
|
|
|
|
2008-09-22 01:35:25 +02:00
|
|
|
/* dock windows[2] to the bottom of the screen */
|
|
|
|
windows[2].registered = TRUE;
|
2009-06-16 15:07:22 +02:00
|
|
|
windows[2].to_be_deleted = FALSE;
|
2008-09-22 01:35:25 +02:00
|
|
|
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;
|
2013-10-26 21:10:26 +02:00
|
|
|
SetWindowLongPtrA(windows[2].hwnd, GWLP_USERDATA, (LONG_PTR)&windows[2]);
|
2008-09-22 01:35:25 +02:00
|
|
|
testwindow_setpos(windows[2].hwnd);
|
|
|
|
|
|
|
|
do_events_until(no_appbars_intersect);
|
|
|
|
test_window_rects(0, 1);
|
|
|
|
test_window_rects(0, 2);
|
|
|
|
test_window_rects(1, 2);
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
testwindow_setpos(windows[2].hwnd);
|
|
|
|
|
|
|
|
do_events_until(no_appbars_intersect);
|
|
|
|
test_window_rects(0, 1);
|
|
|
|
test_window_rects(0, 2);
|
|
|
|
test_window_rects(1, 2);
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
testwindow_setpos(windows[1].hwnd);
|
|
|
|
|
|
|
|
do_events_until(no_appbars_intersect);
|
|
|
|
test_window_rects(0, 1);
|
|
|
|
test_window_rects(0, 2);
|
|
|
|
test_window_rects(1, 2);
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
testwindow_setpos(windows[1].hwnd);
|
|
|
|
|
|
|
|
do_events_until(no_appbars_intersect);
|
|
|
|
test_window_rects(0, 1);
|
|
|
|
test_window_rects(0, 2);
|
|
|
|
test_window_rects(1, 2);
|
|
|
|
|
|
|
|
/* removing windows[0] will cause windows[1] to move down into its space */
|
|
|
|
expected_bottom = max(windows[0].allocated_rect.bottom, windows[1].allocated_rect.bottom);
|
2009-10-21 11:25:09 +02:00
|
|
|
org_bottom1 = windows[1].allocated_rect.bottom;
|
|
|
|
ok(windows[0].allocated_rect.bottom > windows[1].allocated_rect.bottom,
|
|
|
|
"Expected windows[0] to be lower than windows[1]\n");
|
2008-09-22 01:35:25 +02:00
|
|
|
|
|
|
|
abd.hWnd = windows[0].hwnd;
|
2009-06-16 15:07:22 +02:00
|
|
|
windows[0].to_be_deleted = TRUE;
|
2008-09-02 22:08:20 +02:00
|
|
|
ret = SHAppBarMessage(ABM_REMOVE, &abd);
|
|
|
|
ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
|
2008-09-22 01:35:25 +02:00
|
|
|
windows[0].registered = FALSE;
|
|
|
|
DestroyWindow(windows[0].hwnd);
|
|
|
|
|
|
|
|
do_events_until(got_expected_bottom);
|
2008-09-02 22:08:20 +02:00
|
|
|
|
2009-10-21 11:25:09 +02:00
|
|
|
if (windows[1].allocated_rect.bottom == org_bottom1)
|
|
|
|
win_skip("Some broken Vista boxes don't move the higher appbar down\n");
|
|
|
|
else
|
|
|
|
ok(windows[1].allocated_rect.bottom == expected_bottom,
|
|
|
|
"windows[1]'s bottom is %i, expected %i\n",
|
|
|
|
windows[1].allocated_rect.bottom, expected_bottom);
|
2008-09-02 22:08:20 +02:00
|
|
|
|
2008-09-22 01:35:25 +02:00
|
|
|
test_window_rects(1, 2);
|
2008-09-02 22:08:20 +02:00
|
|
|
|
|
|
|
/* remove the other windows */
|
2008-09-22 01:35:25 +02:00
|
|
|
abd.hWnd = windows[1].hwnd;
|
2009-06-16 15:07:22 +02:00
|
|
|
windows[1].to_be_deleted = TRUE;
|
2008-09-02 22:08:20 +02:00
|
|
|
ret = SHAppBarMessage(ABM_REMOVE, &abd);
|
|
|
|
ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
|
2008-09-22 01:35:25 +02:00
|
|
|
windows[1].registered = FALSE;
|
|
|
|
DestroyWindow(windows[1].hwnd);
|
2008-09-02 22:08:20 +02:00
|
|
|
|
2008-09-22 01:35:25 +02:00
|
|
|
abd.hWnd = windows[2].hwnd;
|
2009-06-16 15:07:22 +02:00
|
|
|
windows[2].to_be_deleted = TRUE;
|
2008-09-02 22:08:20 +02:00
|
|
|
ret = SHAppBarMessage(ABM_REMOVE, &abd);
|
|
|
|
ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
|
2008-09-22 01:35:25 +02:00
|
|
|
windows[2].registered = FALSE;
|
|
|
|
DestroyWindow(windows[2].hwnd);
|
2008-09-02 22:08:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_appbarget(void)
|
|
|
|
{
|
|
|
|
APPBARDATA abd;
|
2009-01-09 18:09:03 +01:00
|
|
|
HWND hwnd, foregnd, unset_hwnd;
|
2008-09-02 22:08:20 +02:00
|
|
|
UINT_PTR ret;
|
|
|
|
|
|
|
|
memset(&abd, 0xcc, sizeof(abd));
|
2009-01-09 18:09:03 +01:00
|
|
|
memset(&unset_hwnd, 0xcc, sizeof(unset_hwnd));
|
2008-09-02 22:08:20 +02:00
|
|
|
abd.cbSize = sizeof(abd);
|
|
|
|
abd.uEdge = ABE_BOTTOM;
|
|
|
|
|
|
|
|
hwnd = (HWND)SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd);
|
|
|
|
ok(hwnd == NULL || IsWindow(hwnd), "ret %p which is not a window\n", hwnd);
|
2009-01-09 18:09:03 +01:00
|
|
|
ok(abd.hWnd == unset_hwnd, "hWnd overwritten %p\n",abd.hWnd);
|
2008-09-02 22:08:20 +02:00
|
|
|
|
|
|
|
if (!pMonitorFromWindow)
|
|
|
|
{
|
2009-02-25 10:28:30 +01:00
|
|
|
win_skip("MonitorFromWindow is not available\n");
|
2008-09-02 22:08:20 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Presumably one can pass a hwnd with ABM_GETAUTOHIDEBAR to specify a monitor.
|
|
|
|
Pass the foreground window and check */
|
|
|
|
foregnd = GetForegroundWindow();
|
|
|
|
if(foregnd)
|
|
|
|
{
|
|
|
|
abd.hWnd = foregnd;
|
|
|
|
hwnd = (HWND)SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd);
|
|
|
|
ok(hwnd == NULL || IsWindow(hwnd), "ret %p which is not a window\n", hwnd);
|
|
|
|
ok(abd.hWnd == foregnd, "hWnd overwritten\n");
|
|
|
|
if(hwnd)
|
|
|
|
{
|
|
|
|
HMONITOR appbar_mon, foregnd_mon;
|
|
|
|
appbar_mon = pMonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
|
|
|
|
foregnd_mon = pMonitorFromWindow(foregnd, MONITOR_DEFAULTTONEAREST);
|
|
|
|
ok(appbar_mon == foregnd_mon, "Windows on different monitors\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(&abd, 0xcc, sizeof(abd));
|
|
|
|
abd.cbSize = sizeof(abd);
|
|
|
|
ret = SHAppBarMessage(ABM_GETTASKBARPOS, &abd);
|
|
|
|
if(ret)
|
|
|
|
{
|
|
|
|
ok(abd.hWnd == (HWND)0xcccccccc, "hWnd overwritten\n");
|
2009-06-13 16:29:02 +02:00
|
|
|
ok(abd.uEdge <= ABE_BOTTOM ||
|
|
|
|
broken(abd.uEdge == 0xcccccccc), /* Some Win95 and NT4 */
|
|
|
|
"uEdge not returned\n");
|
2008-09-02 22:08:20 +02:00
|
|
|
ok(abd.rc.left != 0xcccccccc, "rc not updated\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-07-22 11:51:29 +02:00
|
|
|
static void test_GetCurrentProcessExplicitAppUserModelID(void)
|
|
|
|
{
|
|
|
|
WCHAR *appid;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (!pGetCurrentProcessExplicitAppUserModelID)
|
|
|
|
{
|
|
|
|
win_skip("GetCurrentProcessExplicitAppUserModelID() is not supported.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (0) /* crashes on native */
|
|
|
|
hr = pGetCurrentProcessExplicitAppUserModelID(NULL);
|
|
|
|
|
|
|
|
appid = (void*)0xdeadbeef;
|
|
|
|
hr = pGetCurrentProcessExplicitAppUserModelID(&appid);
|
|
|
|
todo_wine
|
|
|
|
ok(hr == E_FAIL, "got 0x%08x\n", hr);
|
|
|
|
ok(appid == NULL, "got %p\n", appid);
|
|
|
|
}
|
|
|
|
|
2008-09-02 22:08:20 +02:00
|
|
|
START_TEST(appbar)
|
|
|
|
{
|
2015-07-22 11:51:29 +02:00
|
|
|
HMODULE huser32, hshell32;
|
2008-09-02 22:08:20 +02:00
|
|
|
|
|
|
|
huser32 = GetModuleHandleA("user32.dll");
|
2015-07-22 11:51:29 +02:00
|
|
|
hshell32 = GetModuleHandleA("shell32.dll");
|
2008-09-02 22:08:20 +02:00
|
|
|
pMonitorFromWindow = (void*)GetProcAddress(huser32, "MonitorFromWindow");
|
2015-07-22 11:51:29 +02:00
|
|
|
pGetCurrentProcessExplicitAppUserModelID = (void*)GetProcAddress(hshell32, "GetCurrentProcessExplicitAppUserModelID");
|
2008-09-02 22:08:20 +02:00
|
|
|
|
|
|
|
register_testwindow_class();
|
|
|
|
|
|
|
|
test_setpos();
|
|
|
|
test_appbarget();
|
2015-07-22 11:51:29 +02:00
|
|
|
test_GetCurrentProcessExplicitAppUserModelID();
|
2008-09-02 22:08:20 +02:00
|
|
|
}
|