shdocvw/tests: Make the webbrowser test dpi aware, make it pass in wine.

This commit is contained in:
Detlef Riekenberg 2008-11-19 05:33:38 +01:00 committed by Alexandre Julliard
parent 0a66633ce3
commit a815677d93
4 changed files with 30 additions and 5 deletions

View File

@ -5,7 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = shdocvw.dll
IMPORTLIB = shdocvw
IMPORTS = uuid shell32 shlwapi user32 advapi32 kernel32
IMPORTS = uuid shell32 shlwapi user32 gdi32 advapi32 kernel32
DELAYIMPORTS = version urlmon ole32 oleaut32
C_SRCS = \

View File

@ -890,6 +890,16 @@ static const IOleCommandTargetVtbl OleCommandTargetVtbl = {
void WebBrowser_OleObject_Init(WebBrowser *This)
{
DWORD dpi_x;
DWORD dpi_y;
HDC hdc;
/* default aspect ratio is 96dpi / 96dpi */
hdc = GetDC(0);
dpi_x = GetDeviceCaps(hdc, LOGPIXELSX);
dpi_y = GetDeviceCaps(hdc, LOGPIXELSY);
ReleaseDC(0, hdc);
This->lpOleObjectVtbl = &OleObjectVtbl;
This->lpOleInPlaceObjectVtbl = &OleInPlaceObjectVtbl;
This->lpOleControlVtbl = &OleControlVtbl;
@ -907,8 +917,9 @@ void WebBrowser_OleObject_Init(WebBrowser *This)
memset(&This->clip_rect, 0, sizeof(RECT));
memset(&This->frameinfo, 0, sizeof(OLEINPLACEFRAMEINFO));
This->extent.cx = 1323;
This->extent.cy = 529;
/* The size is dpi dependent */
This->extent.cx = 127000 / dpi_x;
This->extent.cy = 50800 / dpi_y;
}
void WebBrowser_OleObject_Destroy(WebBrowser *This)

View File

@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = shdocvw.dll
IMPORTS = shell32 ole32 oleaut32 user32 advapi32 kernel32
IMPORTS = shell32 ole32 oleaut32 user32 gdi32 advapi32 kernel32
CTESTS = \
intshcut.c \

View File

@ -1816,6 +1816,17 @@ static void test_Extent(IUnknown *unk)
IOleObject *oleobj;
SIZE size;
HRESULT hres;
DWORD dpi_x;
DWORD dpi_y;
HDC hdc;
/* default aspect ratio is 96dpi / 96dpi */
hdc = GetDC(0);
dpi_x = GetDeviceCaps(hdc, LOGPIXELSX);
dpi_y = GetDeviceCaps(hdc, LOGPIXELSY);
ReleaseDC(0, hdc);
if (dpi_x != 96 || dpi_y != 96)
trace("dpi: %d / %d\n", dpi_y, dpi_y);
hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
ok(hres == S_OK, "Could not get IOleObkect: %08x\n", hres);
@ -1825,7 +1836,10 @@ static void test_Extent(IUnknown *unk)
size.cx = size.cy = 0xdeadbeef;
hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &size);
ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
ok(size.cx == 1323 && size.cy == 529, "size = {%d %d}\n", size.cx, size.cy);
/* The default size is dpi dependent (96:1323x529 / 120:1058x423) */
ok(size.cx == (127000 / dpi_x) &&
size.cy == (50800 / dpi_y), "size = {%d %d} (expected %d %d)\n",
size.cx, size.cy, 127000 / dpi_x, 50800 / dpi_y);
size.cx = 800;
size.cy = 700;