From a815677d93372d72ce39783e4949aef99f208678 Mon Sep 17 00:00:00 2001 From: Detlef Riekenberg Date: Wed, 19 Nov 2008 05:33:38 +0100 Subject: [PATCH] shdocvw/tests: Make the webbrowser test dpi aware, make it pass in wine. --- dlls/shdocvw/Makefile.in | 2 +- dlls/shdocvw/oleobject.c | 15 +++++++++++++-- dlls/shdocvw/tests/Makefile.in | 2 +- dlls/shdocvw/tests/webbrowser.c | 16 +++++++++++++++- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/dlls/shdocvw/Makefile.in b/dlls/shdocvw/Makefile.in index 764b4c6a4a1..0fd59c5851f 100644 --- a/dlls/shdocvw/Makefile.in +++ b/dlls/shdocvw/Makefile.in @@ -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 = \ diff --git a/dlls/shdocvw/oleobject.c b/dlls/shdocvw/oleobject.c index 70a163da72b..9a38cf0466f 100644 --- a/dlls/shdocvw/oleobject.c +++ b/dlls/shdocvw/oleobject.c @@ -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) diff --git a/dlls/shdocvw/tests/Makefile.in b/dlls/shdocvw/tests/Makefile.in index e20f8edbe1b..5ab9b5a12df 100644 --- a/dlls/shdocvw/tests/Makefile.in +++ b/dlls/shdocvw/tests/Makefile.in @@ -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 \ diff --git a/dlls/shdocvw/tests/webbrowser.c b/dlls/shdocvw/tests/webbrowser.c index dad9527430b..ec036c54da6 100644 --- a/dlls/shdocvw/tests/webbrowser.c +++ b/dlls/shdocvw/tests/webbrowser.c @@ -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; -- 2.11.4.GIT