mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 14:10:32 +00:00
msscript: Implement GetExtent().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
859d880b66
commit
03b06fb76b
@ -1,7 +1,7 @@
|
||||
MODULE = msscript.ocx
|
||||
RC_SRCS = msscript.rc
|
||||
IDL_SRCS = msscript.idl
|
||||
IMPORTS = ole32 oleaut32
|
||||
IMPORTS = gdi32 user32 ole32 oleaut32
|
||||
|
||||
C_SRCS = \
|
||||
msscript.c
|
||||
|
@ -35,6 +35,7 @@ struct ScriptControl {
|
||||
IOleObject IOleObject_iface;
|
||||
LONG ref;
|
||||
IOleClientSite *site;
|
||||
SIZEL extent;
|
||||
};
|
||||
|
||||
static HINSTANCE msscript_instance;
|
||||
@ -611,9 +612,13 @@ static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD aspect, SIZEL
|
||||
{
|
||||
ScriptControl *This = impl_from_IOleObject(iface);
|
||||
|
||||
FIXME("(%p)->(%d %p)\n", This, aspect, size);
|
||||
TRACE("(%p)->(%d %p)\n", This, aspect, size);
|
||||
|
||||
return E_NOTIMPL;
|
||||
if (aspect != DVASPECT_CONTENT)
|
||||
return DV_E_DVASPECT;
|
||||
|
||||
*size = This->extent;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *sink, DWORD *connection)
|
||||
@ -775,7 +780,9 @@ static const IPersistStreamInitVtbl PersistStreamInitVtbl = {
|
||||
static HRESULT WINAPI ScriptControl_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
|
||||
{
|
||||
ScriptControl *script_control;
|
||||
DWORD dpi_x, dpi_y;
|
||||
HRESULT hres;
|
||||
HDC hdc;
|
||||
|
||||
TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
|
||||
|
||||
@ -789,6 +796,14 @@ static HRESULT WINAPI ScriptControl_CreateInstance(IClassFactory *iface, IUnknow
|
||||
script_control->ref = 1;
|
||||
script_control->site = NULL;
|
||||
|
||||
hdc = GetDC(0);
|
||||
dpi_x = GetDeviceCaps(hdc, LOGPIXELSX);
|
||||
dpi_y = GetDeviceCaps(hdc, LOGPIXELSY);
|
||||
ReleaseDC(0, hdc);
|
||||
|
||||
script_control->extent.cx = MulDiv(38, 2540, dpi_x);
|
||||
script_control->extent.cy = MulDiv(38, 2540, dpi_y);
|
||||
|
||||
hres = IScriptControl_QueryInterface(&script_control->IScriptControl_iface, riid, ppv);
|
||||
IScriptControl_Release(&script_control->IScriptControl_iface);
|
||||
return hres;
|
||||
|
@ -1,5 +1,5 @@
|
||||
TESTDLL = msscript.ocx
|
||||
IMPORTS = ole32
|
||||
IMPORTS = user32 gdi32 ole32
|
||||
|
||||
C_SRCS = \
|
||||
msscript.c
|
||||
|
@ -96,10 +96,12 @@ static IOleClientSite testclientsite = { &OleClientSiteVtbl };
|
||||
|
||||
static void test_oleobject(void)
|
||||
{
|
||||
DWORD status, dpi_x, dpi_y;
|
||||
IOleClientSite *site;
|
||||
IOleObject *obj;
|
||||
DWORD status;
|
||||
SIZEL extent;
|
||||
HRESULT hr;
|
||||
HDC hdc;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_ScriptControl, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||
&IID_IOleObject, (void**)&obj);
|
||||
@ -131,6 +133,36 @@ static void test_oleobject(void)
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(site == NULL, "got %p\n", site);
|
||||
|
||||
/* extents */
|
||||
hdc = GetDC(0);
|
||||
dpi_x = GetDeviceCaps(hdc, LOGPIXELSX);
|
||||
dpi_y = GetDeviceCaps(hdc, LOGPIXELSY);
|
||||
ReleaseDC(0, hdc);
|
||||
|
||||
memset(&extent, 0, sizeof(extent));
|
||||
hr = IOleObject_GetExtent(obj, DVASPECT_CONTENT, &extent);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(extent.cx == MulDiv(38, 2540, dpi_x), "got %d\n", extent.cx);
|
||||
ok(extent.cy == MulDiv(38, 2540, dpi_y), "got %d\n", extent.cy);
|
||||
|
||||
extent.cx = extent.cy = 0xdeadbeef;
|
||||
hr = IOleObject_GetExtent(obj, DVASPECT_THUMBNAIL, &extent);
|
||||
ok(hr == DV_E_DVASPECT, "got 0x%08x\n", hr);
|
||||
ok(extent.cx == 0xdeadbeef, "got %d\n", extent.cx);
|
||||
ok(extent.cy == 0xdeadbeef, "got %d\n", extent.cy);
|
||||
|
||||
extent.cx = extent.cy = 0xdeadbeef;
|
||||
hr = IOleObject_GetExtent(obj, DVASPECT_ICON, &extent);
|
||||
ok(hr == DV_E_DVASPECT, "got 0x%08x\n", hr);
|
||||
ok(extent.cx == 0xdeadbeef, "got %d\n", extent.cx);
|
||||
ok(extent.cy == 0xdeadbeef, "got %d\n", extent.cy);
|
||||
|
||||
extent.cx = extent.cy = 0xdeadbeef;
|
||||
hr = IOleObject_GetExtent(obj, DVASPECT_DOCPRINT, &extent);
|
||||
ok(hr == DV_E_DVASPECT, "got 0x%08x\n", hr);
|
||||
ok(extent.cx == 0xdeadbeef, "got %d\n", extent.cx);
|
||||
ok(extent.cy == 0xdeadbeef, "got %d\n", extent.cy);
|
||||
|
||||
IOleObject_Release(obj);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user