From e1e4c6378147dfc6418987b471ec693cf5f82348 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Thu, 17 Nov 2016 22:59:30 +0000 Subject: [PATCH] [OLEAUT32_WINETEST] Sync with Wine Staging 1.9.23. CORE-12409 svn path=/trunk/; revision=73286 --- rostests/winetests/oleaut32/olefont.c | 15 +++++++++ rostests/winetests/oleaut32/olepicture.c | 40 ++++++++++++++++-------- rostests/winetests/oleaut32/safearray.c | 6 ++-- rostests/winetests/oleaut32/typelib.c | 26 ++++++++++++--- rostests/winetests/oleaut32/vartest.c | 5 +-- 5 files changed, 68 insertions(+), 24 deletions(-) diff --git a/rostests/winetests/oleaut32/olefont.c b/rostests/winetests/oleaut32/olefont.c index 31bab2cdc90..5cf49871738 100644 --- a/rostests/winetests/oleaut32/olefont.c +++ b/rostests/winetests/oleaut32/olefont.c @@ -1235,6 +1235,7 @@ static void test_realization(void) static void test_OleCreateFontIndirect(void) { FONTDESC fontdesc; + IUnknown *unk, *unk2; IFont *font; HRESULT hr; @@ -1266,6 +1267,20 @@ static void test_OleCreateFontIndirect(void) hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void**)&font); EXPECT_HR(hr, S_OK); IFont_Release(font); + + hr = OleInitialize(NULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = CoGetClassObject(&CLSID_StdFont, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&unk); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void**)&unk2); + ok(hr == S_OK, "got 0x%08x\n", hr); + + IUnknown_Release(unk); + IUnknown_Release(unk2); + + OleUninitialize(); } START_TEST(olefont) diff --git a/rostests/winetests/oleaut32/olepicture.c b/rostests/winetests/oleaut32/olepicture.c index f24ed4e7943..b934fd7071b 100644 --- a/rostests/winetests/oleaut32/olepicture.c +++ b/rostests/winetests/oleaut32/olepicture.c @@ -173,6 +173,25 @@ static const unsigned char enhmetafile[] = { 0x14, 0x00, 0x00, 0x00 }; +static HBITMAP stock_bm; + +static HDC create_render_dc( void ) +{ + HDC dc = CreateCompatibleDC( NULL ); + BITMAPINFO info = {{sizeof(info.bmiHeader), 100, 100, 1, 32, BI_RGB }}; + void *bits; + HBITMAP dib = CreateDIBSection( NULL, &info, DIB_RGB_COLORS, &bits, NULL, 0 ); + + stock_bm = SelectObject( dc, dib ); + return dc; +} + +static void delete_render_dc( HDC dc ) +{ + HBITMAP dib = SelectObject( dc, stock_bm ); + DeleteObject( dib ); + DeleteDC( dc ); +} typedef struct NoStatStreamImpl { @@ -484,7 +503,7 @@ static void test_Invoke(void) ok(hr == DISP_E_BADPARAMCOUNT, "IPictureDisp_Invoke should have returned DISP_E_BADPARAMCOUNT instead of 0x%08x\n", hr); /* DISPID_PICT_RENDER */ - hdc = GetDC(0); + hdc = create_render_dc(); for (i = 0; i < sizeof(args)/sizeof(args[0]); i++) V_VT(&args[i]) = VT_I4; @@ -520,7 +539,7 @@ static void test_Invoke(void) hr = IPictureDisp_Invoke(picdisp, DISPID_PICT_RENDER, &GUID_NULL, 0, DISPATCH_METHOD, &dispparams, &varresult, NULL, NULL); ok(hr == DISP_E_BADPARAMCOUNT, "got 0x%08x\n", hr); - ReleaseDC(NULL, hdc); + delete_render_dc(hdc); IPictureDisp_Release(picdisp); } @@ -704,7 +723,7 @@ static void test_Render(void) OLE_XSIZE_HIMETRIC pWidth; OLE_YSIZE_HIMETRIC pHeight; COLORREF result, expected; - HDC hdc = GetDC(0); + HDC hdc = create_render_dc(); /* test IPicture::Render return code on uninitialized picture */ OleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, (VOID**)&pic); @@ -736,7 +755,7 @@ static void test_Render(void) desc.u.icon.hicon = LoadIconA(NULL, (LPCSTR)IDI_APPLICATION); if(!desc.u.icon.hicon){ win_skip("LoadIcon failed. Skipping...\n"); - ReleaseDC(NULL, hdc); + delete_render_dc(hdc); return; } @@ -769,27 +788,22 @@ static void test_Render(void) hres = picture_render(pic, hdc, 1, 1, 9, 9, 0, 0, pWidth, -pHeight, NULL); ole_expect(hres, S_OK); - if(hres != S_OK) { - IPicture_Release(pic); - ReleaseDC(NULL, hdc); - return; - } + if(hres != S_OK) goto done; /* Evaluate the rendered Icon */ result = GetPixel(hdc, 0, 0); ok(result == expected, "Color at 0,0 should be unchanged 0x%06X, but was 0x%06X\n", expected, result); result = GetPixel(hdc, 5, 5); - ok(result != expected || - broken(result == expected), /* WinNT 4.0 and older may claim they drew */ - /* the icon, even if they didn't. */ + ok(result != expected, "Color at 5,5 should have changed, but still was 0x%06X\n", expected); result = GetPixel(hdc, 10, 10); ok(result == expected, "Color at 10,10 should be unchanged 0x%06X, but was 0x%06X\n", expected, result); +done: IPicture_Release(pic); - ReleaseDC(NULL, hdc); + delete_render_dc(hdc); } static void test_get_Attributes(void) diff --git a/rostests/winetests/oleaut32/safearray.c b/rostests/winetests/oleaut32/safearray.c index e2cd8c0ef0d..a73829dead3 100644 --- a/rostests/winetests/oleaut32/safearray.c +++ b/rostests/winetests/oleaut32/safearray.c @@ -710,11 +710,9 @@ static void test_safearray(void) } if (!pSafeArrayAllocDescriptorEx) - { return; - } - for (i=0;i