wmp: Added more tests.
This commit is contained in:
parent
bea155e491
commit
a818e9a6c9
|
@ -1,4 +1,4 @@
|
|||
TESTDLL = wmp.dll
|
||||
IMPORTS = ole32
|
||||
IMPORTS = ole32 user32
|
||||
|
||||
C_SRCS = oleobj.c
|
||||
|
|
|
@ -53,6 +53,14 @@ DEFINE_EXPECT(GetContainer);
|
|||
DEFINE_EXPECT(GetExtendedControl);
|
||||
DEFINE_EXPECT(GetWindow);
|
||||
DEFINE_EXPECT(Invoke_USERMODE);
|
||||
DEFINE_EXPECT(CanWindowlessActivate);
|
||||
DEFINE_EXPECT(OnInPlaceActivateEx);
|
||||
DEFINE_EXPECT(OnInPlaceDeactivate);
|
||||
DEFINE_EXPECT(GetWindowContext);
|
||||
DEFINE_EXPECT(ShowObject);
|
||||
DEFINE_EXPECT(OnShowWindow_FALSE);
|
||||
|
||||
static HWND container_hwnd;
|
||||
|
||||
static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
|
@ -110,6 +118,141 @@ static const IOleContainerVtbl OleContainerVtbl = {
|
|||
|
||||
static IOleContainer OleContainer = { &OleContainerVtbl };
|
||||
|
||||
static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
ok(0, "Unexpected QI(%s)\n", wine_dbgstr_guid(riid));
|
||||
*ppv = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
|
||||
LPCBORDERWIDTHS pborderwidths)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
|
||||
LPCBORDERWIDTHS pborderwidths)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
|
||||
IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
|
||||
IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
|
||||
LPOLEMENUGROUPWIDTHS lpMenuWidths)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
|
||||
HOLEMENU holemenu, HWND hwndActiveObject)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
|
||||
InPlaceFrame_QueryInterface,
|
||||
InPlaceFrame_AddRef,
|
||||
InPlaceFrame_Release,
|
||||
InPlaceFrame_GetWindow,
|
||||
InPlaceFrame_ContextSensitiveHelp,
|
||||
InPlaceFrame_GetBorder,
|
||||
InPlaceFrame_RequestBorderSpace,
|
||||
InPlaceFrame_SetBorderSpace,
|
||||
InPlaceFrame_SetActiveObject,
|
||||
InPlaceFrame_InsertMenus,
|
||||
InPlaceFrame_SetMenu,
|
||||
InPlaceFrame_RemoveMenus,
|
||||
InPlaceFrame_SetStatusText,
|
||||
InPlaceFrame_EnableModeless,
|
||||
InPlaceFrame_TranslateAccelerator
|
||||
};
|
||||
|
||||
static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
|
||||
|
||||
static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
|
||||
InPlaceFrame_QueryInterface,
|
||||
InPlaceFrame_AddRef,
|
||||
InPlaceFrame_Release,
|
||||
InPlaceFrame_GetWindow,
|
||||
InPlaceFrame_ContextSensitiveHelp,
|
||||
InPlaceFrame_GetBorder,
|
||||
InPlaceFrame_RequestBorderSpace,
|
||||
InPlaceFrame_SetBorderSpace,
|
||||
InPlaceUIWindow_SetActiveObject,
|
||||
};
|
||||
|
||||
static IOleInPlaceFrame InPlaceUIWindow = { &InPlaceUIWindowVtbl };
|
||||
|
||||
static HRESULT cs_qi(REFIID,void**);
|
||||
|
||||
static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
|
||||
|
@ -150,14 +293,17 @@ static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContain
|
|||
|
||||
static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
CHECK_EXPECT(ShowObject);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
if(fShow)
|
||||
ok(0, "unexpected call\n");
|
||||
else
|
||||
CHECK_EXPECT(OnShowWindow_FALSE);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
|
||||
|
@ -367,7 +513,8 @@ static ULONG WINAPI InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless *ifa
|
|||
static HRESULT WINAPI InPlaceSiteWindowless_GetWindow(IOleInPlaceSiteWindowless *iface, HWND *phwnd)
|
||||
{
|
||||
CHECK_EXPECT2(GetWindow);
|
||||
return E_NOTIMPL;
|
||||
*phwnd = container_hwnd;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceSiteWindowless_ContextSensitiveHelp(IOleInPlaceSiteWindowless *iface, BOOL fEnterMode)
|
||||
|
@ -397,8 +544,32 @@ static HRESULT WINAPI InPlaceSiteWindowless_OnUIActivate(IOleInPlaceSiteWindowle
|
|||
static HRESULT WINAPI InPlaceSiteWindowless_GetWindowContext(IOleInPlaceSiteWindowless *iface, IOleInPlaceFrame **ppFrame,
|
||||
IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
static const RECT rect = {0,0,400,410};
|
||||
|
||||
CHECK_EXPECT(GetWindowContext);
|
||||
|
||||
ok(ppFrame != NULL, "ppFrame = NULL\n");
|
||||
if(ppFrame)
|
||||
*ppFrame = &InPlaceFrame;
|
||||
ok(ppDoc != NULL, "ppDoc = NULL\n");
|
||||
if(ppDoc)
|
||||
*ppDoc = (IOleInPlaceUIWindow*)&InPlaceUIWindow;
|
||||
ok(lprcPosRect != NULL, "lprcPosRect = NULL\n");
|
||||
if(lprcPosRect)
|
||||
memcpy(lprcPosRect, &rect, sizeof(RECT));
|
||||
ok(lprcClipRect != NULL, "lprcClipRect = NULL\n");
|
||||
if(lprcClipRect)
|
||||
memcpy(lprcClipRect, &rect, sizeof(RECT));
|
||||
ok(lpFrameInfo != NULL, "lpFrameInfo = NULL\n");
|
||||
if(lpFrameInfo) {
|
||||
ok(lpFrameInfo->cb == sizeof(*lpFrameInfo), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo->cb, (unsigned)sizeof(*lpFrameInfo));
|
||||
lpFrameInfo->fMDIApp = FALSE;
|
||||
lpFrameInfo->hwndFrame = container_hwnd;
|
||||
lpFrameInfo->haccel = NULL;
|
||||
lpFrameInfo->cAccelEntries = 0;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceSiteWindowless_Scroll(
|
||||
|
@ -418,8 +589,8 @@ static HRESULT WINAPI InPlaceSiteWindowless_OnUIDeactivate(
|
|||
static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivate(
|
||||
IOleInPlaceSiteWindowless *iface)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
CHECK_EXPECT(OnInPlaceDeactivate);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceSiteWindowless_DiscardUndoState(
|
||||
|
@ -446,8 +617,10 @@ static HRESULT WINAPI InPlaceSiteWindowless_OnPosRectChange(
|
|||
static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivateEx(
|
||||
IOleInPlaceSiteWindowless *iface, BOOL *pfNoRedraw, DWORD dwFlags)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
CHECK_EXPECT(OnInPlaceActivateEx);
|
||||
ok(!dwFlags, "dwFlags = %x\n", dwFlags);
|
||||
ok(pfNoRedraw != NULL, "pfNoRedraw = NULL\n");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivateEx(
|
||||
|
@ -467,8 +640,8 @@ static HRESULT WINAPI InPlaceSiteWindowless_RequestUIActivate(
|
|||
static HRESULT WINAPI InPlaceSiteWindowless_CanWindowlessActivate(
|
||||
IOleInPlaceSiteWindowless *iface)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
CHECK_EXPECT(CanWindowlessActivate);
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InPlaceSiteWindowless_GetCapture(
|
||||
|
@ -615,6 +788,35 @@ static HRESULT cs_qi(REFIID riid, void **ppv)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
#define test_rect_size(a,b,c) _test_rect_size(__LINE__,a,b,c)
|
||||
static void _test_rect_size(unsigned line, const RECT *r, int width, int height)
|
||||
{
|
||||
ok_(__FILE__,line)(r->right-r->left == width, "width = %d, expected %d\n", r->right-r->left, width);
|
||||
ok_(__FILE__,line)(r->bottom-r->top == height, "height = %d, expected %d\n", r->bottom-r->top, height);
|
||||
}
|
||||
|
||||
static void test_window(HWND hwnd)
|
||||
{
|
||||
WINDOWINFO wi = {sizeof(wi)};
|
||||
char class_name[100];
|
||||
int i;
|
||||
BOOL res;
|
||||
|
||||
i = RealGetWindowClassA(hwnd, class_name, sizeof(class_name));
|
||||
ok(!strncmp(class_name, "ATL:", 4), "class_name = %s %d\n", class_name, i);
|
||||
|
||||
res = GetWindowInfo(hwnd, &wi);
|
||||
ok(res, "GetWindowInfo failed: %u\n", GetLastError());
|
||||
|
||||
test_rect_size(&wi.rcWindow, 400, 410);
|
||||
test_rect_size(&wi.rcClient, 400, 410);
|
||||
|
||||
ok(wi.dwStyle == (WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_VISIBLE|WS_CHILD), "dwStyle = %x\n", wi.dwStyle);
|
||||
ok(!(wi.dwExStyle & ~0x800 /* undocumented, set by some versions */), "dwExStyle = %x\n", wi.dwExStyle);
|
||||
|
||||
ok(IsWindowVisible(hwnd), "Window is not visible\n");
|
||||
}
|
||||
|
||||
static void test_QI(IUnknown *unk)
|
||||
{
|
||||
IUnknown *tmp;
|
||||
|
@ -636,9 +838,12 @@ static void test_wmp(void)
|
|||
{
|
||||
IProvideClassInfo2 *class_info;
|
||||
IOleClientSite *client_site;
|
||||
IOleInPlaceObject *ipobj;
|
||||
IPersistStreamInit *psi;
|
||||
IOleObject *oleobj;
|
||||
DWORD misc_status;
|
||||
RECT pos = {0,0,100,100};
|
||||
HWND hwnd;
|
||||
GUID guid;
|
||||
LONG ref;
|
||||
HRESULT hres;
|
||||
|
@ -669,7 +874,8 @@ static void test_wmp(void)
|
|||
hres = IOleObject_QueryInterface(oleobj, &IID_IPersistStreamInit, (void**)&psi);
|
||||
ok(hres == S_OK, "Could not get IPersistStreamInit iface: %08x\n", hres);
|
||||
|
||||
IPersistStreamInit_Release(psi);
|
||||
hres = IOleObject_QueryInterface(oleobj, &IID_IOleInPlaceObject, (void**)&ipobj);
|
||||
ok(hres == S_OK, "Could not get IOleInPlaceObject iface: %08x\n", hres);
|
||||
|
||||
SET_EXPECT(GetContainer);
|
||||
SET_EXPECT(GetExtendedControl);
|
||||
|
@ -687,6 +893,46 @@ static void test_wmp(void)
|
|||
ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
|
||||
ok(client_site == &ClientSite, "client_site != ClientSite\n");
|
||||
|
||||
hwnd = (HWND)0xdeadbeef;
|
||||
hres = IOleInPlaceObject_GetWindow(ipobj, &hwnd);
|
||||
ok(hres == E_UNEXPECTED, "GetWindow failed: %08x\n", hres);
|
||||
ok(!hwnd, "hwnd = %p\n", hwnd);
|
||||
|
||||
SET_EXPECT(GetWindow);
|
||||
SET_EXPECT(CanWindowlessActivate);
|
||||
SET_EXPECT(OnInPlaceActivateEx);
|
||||
SET_EXPECT(GetWindowContext);
|
||||
SET_EXPECT(ShowObject);
|
||||
hres = IOleObject_DoVerb(oleobj, OLEIVERB_INPLACEACTIVATE, NULL, &ClientSite, 0, container_hwnd, &pos);
|
||||
ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
|
||||
CHECK_CALLED(GetWindow);
|
||||
CHECK_CALLED(CanWindowlessActivate);
|
||||
CHECK_CALLED(OnInPlaceActivateEx);
|
||||
CHECK_CALLED(GetWindowContext);
|
||||
CHECK_CALLED(ShowObject);
|
||||
|
||||
hwnd = NULL;
|
||||
hres = IOleInPlaceObject_GetWindow(ipobj, &hwnd);
|
||||
ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
|
||||
ok(hwnd != NULL, "hwnd = NULL\n");
|
||||
|
||||
test_window(hwnd);
|
||||
|
||||
SET_EXPECT(OnShowWindow_FALSE);
|
||||
SET_EXPECT(OnInPlaceDeactivate);
|
||||
hres = IOleObject_Close(oleobj, 0);
|
||||
ok(hres == S_OK, "Close failed: %08x\n", hres);
|
||||
todo_wine CHECK_CALLED(OnShowWindow_FALSE);
|
||||
CHECK_CALLED(OnInPlaceDeactivate);
|
||||
|
||||
hwnd = (HWND)0xdeadbeef;
|
||||
hres = IOleInPlaceObject_GetWindow(ipobj, &hwnd);
|
||||
ok(hres == E_UNEXPECTED, "GetWindow failed: %08x\n", hres);
|
||||
ok(!hwnd, "hwnd = %p\n", hwnd);
|
||||
|
||||
hres = IOleObject_Close(oleobj, 0);
|
||||
ok(hres == S_OK, "Close failed: %08x\n", hres);
|
||||
|
||||
hres = IOleObject_SetClientSite(oleobj, NULL);
|
||||
ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
|
||||
|
||||
|
@ -695,15 +941,45 @@ static void test_wmp(void)
|
|||
ok(hres == E_FAIL || broken(hres == S_OK), "GetClientSite failed: %08x\n", hres);
|
||||
ok(!client_site, "client_site = %p\n", client_site);
|
||||
|
||||
IPersistStreamInit_Release(psi);
|
||||
IOleInPlaceObject_Release(ipobj);
|
||||
|
||||
ref = IOleObject_Release(oleobj);
|
||||
ok(!ref, "ref = %d\n", ref);
|
||||
}
|
||||
|
||||
static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return DefWindowProcW(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
static void create_container_window(void)
|
||||
{
|
||||
static const WCHAR wmp_testW[] =
|
||||
{'W','M','P','T','e','s','t',0};
|
||||
static WNDCLASSEXW wndclass = {
|
||||
sizeof(WNDCLASSEXW),
|
||||
0,
|
||||
wnd_proc,
|
||||
0, 0, NULL, NULL, NULL, NULL, NULL,
|
||||
wmp_testW,
|
||||
NULL
|
||||
};
|
||||
|
||||
RegisterClassExW(&wndclass);
|
||||
container_hwnd = CreateWindowW(wmp_testW, wmp_testW,
|
||||
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
515, 530, NULL, NULL, NULL, NULL);
|
||||
ShowWindow(container_hwnd, SW_SHOW);
|
||||
}
|
||||
|
||||
START_TEST(oleobj)
|
||||
{
|
||||
create_container_window();
|
||||
CoInitialize(NULL);
|
||||
|
||||
test_wmp();
|
||||
|
||||
CoUninitialize();
|
||||
DestroyWindow(container_hwnd);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue