ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
December 2012
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
12 participants
287 discussions
Start a n
N
ew thread
[akhaldi] 57892: [OLEAUT32_WINETEST] * Sync with Wine 1.5.19.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Dec 12 15:05:13 2012 New Revision: 57892 URL:
http://svn.reactos.org/svn/reactos?rev=57892&view=rev
Log: [OLEAUT32_WINETEST] * Sync with Wine 1.5.19. Modified: trunk/rostests/winetests/oleaut32/CMakeLists.txt trunk/rostests/winetests/oleaut32/olefont.c trunk/rostests/winetests/oleaut32/olepicture.c trunk/rostests/winetests/oleaut32/safearray.c trunk/rostests/winetests/oleaut32/tmarshal.c trunk/rostests/winetests/oleaut32/tmarshal.idl trunk/rostests/winetests/oleaut32/tmarshal_dispids.h trunk/rostests/winetests/oleaut32/typelib.c trunk/rostests/winetests/oleaut32/usrmarshal.c trunk/rostests/winetests/oleaut32/varformat.c trunk/rostests/winetests/oleaut32/vartest.c trunk/rostests/winetests/oleaut32/vartype.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/rostests/winetests/oleaut32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/oleaut32/CMakeL…
Modified: trunk/rostests/winetests/oleaut32/olefont.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/oleaut32/olefon…
Modified: trunk/rostests/winetests/oleaut32/olepicture.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/oleaut32/olepic…
Modified: trunk/rostests/winetests/oleaut32/safearray.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/oleaut32/safear…
Modified: trunk/rostests/winetests/oleaut32/tmarshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/oleaut32/tmarsh…
Modified: trunk/rostests/winetests/oleaut32/tmarshal.idl URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/oleaut32/tmarsh…
Modified: trunk/rostests/winetests/oleaut32/tmarshal_dispids.h URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/oleaut32/tmarsh…
Modified: trunk/rostests/winetests/oleaut32/typelib.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/oleaut32/typeli…
Modified: trunk/rostests/winetests/oleaut32/usrmarshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/oleaut32/usrmar…
Modified: trunk/rostests/winetests/oleaut32/varformat.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/oleaut32/varfor…
Modified: trunk/rostests/winetests/oleaut32/vartest.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/oleaut32/vartes…
Modified: trunk/rostests/winetests/oleaut32/vartype.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/oleaut32/vartyp…
12 years
1
0
0
0
[akhaldi] 57891: * Back out r57890 in favor of a complete upcoming sync.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Dec 12 13:55:29 2012 New Revision: 57891 URL:
http://svn.reactos.org/svn/reactos?rev=57891&view=rev
Log: * Back out r57890 in favor of a complete upcoming sync. Modified: trunk/rostests/winetests/oleaut32/olefont.c trunk/rostests/winetests/oleaut32/olepicture.c Modified: trunk/rostests/winetests/oleaut32/olefont.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/oleaut32/olefon…
============================================================================== --- trunk/rostests/winetests/oleaut32/olefont.c [iso-8859-1] (original) +++ trunk/rostests/winetests/oleaut32/olefont.c [iso-8859-1] Wed Dec 12 13:55:29 2012 @@ -51,14 +51,14 @@ static HRESULT (WINAPI *pOleCreateFontIndirect)(LPFONTDESC,REFIID,LPVOID*); -#define EXPECT_HR(hr,hr_exp) \ - ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp) +#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr) /* Create a font with cySize given by lo_size, hi_size, */ /* SetRatio to ratio_logical, ratio_himetric, */ /* check that resulting hfont has height hfont_height. */ /* Various checks along the way. */ -static void test_ifont_size(LONG lo_size, LONG hi_size, + +static void test_ifont_sizes(LONG lo_size, LONG hi_size, LONG ratio_logical, LONG ratio_himetric, LONG hfont_height, const char * test_name) { @@ -69,10 +69,9 @@ LOGFONT lf; CY psize; HRESULT hres; - DWORD rtnval; fd.cbSizeofstruct = sizeof(FONTDESC); - fd.lpstrName = arial_font; /* using scalable instead of bitmap font reduces errors due to font realization */ + fd.lpstrName = system_font; S(fd.cySize).Lo = lo_size; S(fd.cySize).Hi = hi_size; fd.sWeight = 0; @@ -88,33 +87,32 @@ test_name, hres); ok(pvObj != NULL,"%s: OCFI returns NULL.\n", test_name); - /* If scaling ration specified, change ratio. */ - if(ratio_logical && ratio_himetric) - { - hres = IFont_SetRatio(ifnt, ratio_logical, ratio_himetric); - ok(hres == S_OK,"%s: IFont_SetRatio returns 0x%08x instead of S_OK.\n", - test_name, hres); - } - - /* Read back size. */ + /* Read back size. Hi part was ignored. */ hres = IFont_get_Size(ifnt, &psize); ok(hres == S_OK,"%s: IFont_get_size returns 0x%08x instead of S_OK.\n", test_name, hres); - - /* Check returned size - allow for errors due to rounding & font realization. */ - ok((abs(S(psize).Lo - lo_size) < 10000) && S(psize).Hi == hi_size, - "%s: IFont_get_Size: Lo=%d, Hi=%d; expected Lo=%d, Hi=%d.\n", - test_name, S(psize).Lo, S(psize).Hi, lo_size, hi_size); - - /* Check hFont size. */ + ok(S(psize).Lo == lo_size && S(psize).Hi == 0, + "%s: get_Size: Lo=%d, Hi=%d; expected Lo=%d, Hi=0.\n", + test_name, S(psize).Lo, S(psize).Hi, lo_size); + + /* Change ratio, check size unchanged. Standard is 72, 2540. */ + hres = IFont_SetRatio(ifnt, ratio_logical, ratio_himetric); + ok(hres == S_OK,"%s: IFont_SR returns 0x%08x instead of S_OK.\n", + test_name, hres); + hres = IFont_get_Size(ifnt, &psize); + ok(hres == S_OK,"%s: IFont_get_size returns 0x%08x instead of S_OK.\n", + test_name, hres); + ok(S(psize).Lo == lo_size && S(psize).Hi == 0, + "%s: gS after SR: Lo=%d, Hi=%d; expected Lo=%d, Hi=0.\n", + test_name, S(psize).Lo, S(psize).Hi, lo_size); + + /* Check hFont size with this ratio. This tests an important */ + /* conversion for which MSDN is very wrong. */ hres = IFont_get_hFont (ifnt, &hfont); ok(hres == S_OK, "%s: IFont_get_hFont returns 0x%08x instead of S_OK.\n", test_name, hres); - rtnval = GetObject (hfont, sizeof(LOGFONT), &lf); - ok(rtnval > 0, "GetObject(hfont) failed\n"); - - /* Since font scaling may encounter rounding errors, allow 1 pixel deviation. */ - ok(abs(lf.lfHeight - hfont_height) <= 1, + hres = GetObject (hfont, sizeof(LOGFONT), &lf); + ok(lf.lfHeight == hfont_height, "%s: hFont has lf.lfHeight=%d, expected %d.\n", test_name, lf.lfHeight, hfont_height); @@ -122,68 +120,35 @@ IFont_Release(ifnt); } -static void test_ifont_sizes(void) -{ - /* Test various size operations and conversions. */ - /* Add more as needed. */ - - /* Results of first 2 tests depend on display resolution. */ - HDC hdc = GetDC(0); - LONG dpi = GetDeviceCaps(hdc, LOGPIXELSY); /* expected results depend on display DPI */ - ReleaseDC(0, hdc); - if(dpi == 96) /* normal resolution display */ - { - test_ifont_size(180000, 0, 0, 0, -24, "default"); /* normal font */ - test_ifont_size(186000, 0, 0, 0, -25, "rounding"); /* test rounding */ - } else if(dpi == 72) /* low resolution display */ - { - test_ifont_size(180000, 0, 0, 0, -18, "default"); /* normal font */ - test_ifont_size(186000, 0, 0, 0, -19, "rounding"); /* test rounding */ - } else if(dpi == 120) /* high resolution display */ - { - test_ifont_size(180000, 0, 0, 0, -30, "default"); /* normal font */ - test_ifont_size(186000, 0, 0, 0, -31, "rounding"); /* test rounding */ - } else - skip("Skipping resolution dependent font size tests - display resolution is %d\n", dpi); - - /* Next 4 tests specify a scaling ratio, so display resolution is not a factor. */ - test_ifont_size(180000, 0, 72, 2540, -18, "ratio1"); /* change ratio */ - test_ifont_size(180000, 0, 144, 2540, -36, "ratio2"); /* another ratio */ - test_ifont_size(180000, 0, 72, 1270, -36, "ratio3"); /* yet another ratio */ - test_ifont_size(186000, 0, 72, 2540, -19, "rounding+ratio"); /* test rounding with ratio */ -} - static void test_QueryInterface(void) { - LPVOID pvObj = NULL; - HRESULT hr; - IFont* font = NULL; - LONG ref; - - hr = pOleCreateFontIndirect(NULL, &IID_IFont, NULL); - EXPECT_HR(hr, E_POINTER); - - hr = pOleCreateFontIndirect(NULL, &IID_IFont, &pvObj); - font = pvObj; - - EXPECT_HR(hr, S_OK); - ok(font != NULL,"OCFI (NULL,..) returns NULL, instead of !NULL\n"); - - pvObj = NULL; - hr = IFont_QueryInterface( font, &IID_IFont, &pvObj); - EXPECT_HR(hr, S_OK); - - /* Test if QueryInterface increments ref counter for IFONTs */ - ref = IFont_AddRef(font); - ok(ref == 3 || - broken(ref == 1), /* win95 */ - "IFont_QI expected ref value 3 but instead got %d\n", ref); - IFont_Release(font); - - ok(pvObj != NULL,"IFont_QI does return NULL, instead of a ptr\n"); - - IFont_Release(font); - IFont_Release(font); + LPVOID pvObj = NULL; + HRESULT hres; + IFont* font = NULL; + LONG ret; + + hres = pOleCreateFontIndirect(NULL, &IID_IFont, &pvObj); + font = pvObj; + + ok(hres == S_OK,"OCFI (NULL,..) does not return 0, but 0x%08x\n",hres); + ok(font != NULL,"OCFI (NULL,..) returns NULL, instead of !NULL\n"); + + pvObj = NULL; + hres = IFont_QueryInterface( font, &IID_IFont, &pvObj); + + /* Test if QueryInterface increments ref counter for IFONTs */ + ret = IFont_AddRef(font); + ok(ret == 3 || + broken(ret == 1), /* win95 */ + "IFont_QI expected ref value 3 but instead got %d\n",ret); + IFont_Release(font); + + ok(hres == S_OK,"IFont_QI does not return S_OK, but 0x%08x\n", hres); + ok(pvObj != NULL,"IFont_QI does return NULL, instead of a ptr\n"); + + /* Original ref and QueryInterface ref both have to be released */ + IFont_Release(font); + IFont_Release(font); } static void test_type_info(void) @@ -236,7 +201,7 @@ { if (IsEqualIID(riid, &IID_IFontEventsDisp) || IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDispatch)) { - IFontEventsDisp_AddRef(iface); + IUnknown_AddRef(iface); *ppvObject = iface; return S_OK; } @@ -319,26 +284,26 @@ fontdesc.fStrikethrough = FALSE; hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&pFont); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "OleCreateFontIndirect"); hr = IFont_QueryInterface(pFont, &IID_IConnectionPointContainer, (void **)&pCPC); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "IFont_QueryInterface"); hr = IConnectionPointContainer_FindConnectionPoint(pCPC, &IID_IFontEventsDisp, &pCP); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "IConnectionPointContainer_FindConnectionPoint"); IConnectionPointContainer_Release(pCPC); hr = IConnectionPoint_Advise(pCP, (IUnknown *)&FontEventsDisp, &dwCookie); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "IConnectionPoint_Advise"); IConnectionPoint_Release(pCP); hr = IFont_put_Bold(pFont, TRUE); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "IFont_put_Bold"); ok(fonteventsdisp_invoke_called == 1, "IFontEventDisp::Invoke wasn't called once\n"); hr = IFont_QueryInterface(pFont, &IID_IFontDisp, (void **)&pFontDisp); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "IFont_QueryInterface"); V_VT(&vararg) = VT_BOOL; V_BOOL(&vararg) = VARIANT_FALSE; @@ -347,7 +312,6 @@ dispparams.cArgs = 1; dispparams.rgvarg = &vararg; hr = IFontDisp_Invoke(pFontDisp, DISPID_FONT_BOLD, &IID_NULL, 0, DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL); - EXPECT_HR(hr, S_OK); IFontDisp_Release(pFontDisp); @@ -355,11 +319,11 @@ fonteventsdisp_invoke_called); hr = IFont_Clone(pFont, &pFont2); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "IFont_Clone"); IFont_Release(pFont); hr = IFont_put_Bold(pFont2, FALSE); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "IFont_put_Bold"); /* this test shows that the notification routine isn't called again */ ok(fonteventsdisp_invoke_called == 2, "IFontEventDisp::Invoke was called %d times instead of twice\n", @@ -486,7 +450,7 @@ VARIANT varresult; hr = pOleCreateFontIndirect(NULL, &IID_IFontDisp, (void **)&fontdisp); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "OleCreateFontIndirect"); V_VT(&vararg) = VT_BOOL; V_BOOL(&vararg) = VARIANT_FALSE; @@ -495,32 +459,32 @@ dispparams.cArgs = 1; dispparams.rgvarg = &vararg; hr = IFontDisp_Invoke(fontdisp, DISPID_FONT_BOLD, &IID_IFontDisp, 0, DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL); - EXPECT_HR(hr, DISP_E_UNKNOWNINTERFACE); + ok(hr == DISP_E_UNKNOWNINTERFACE, "IFontDisp_Invoke should have returned DISP_E_UNKNOWNINTERFACE instead of 0x%08x\n", hr); dispparams.cArgs = 0; dispparams.rgvarg = NULL; hr = IFontDisp_Invoke(fontdisp, DISPID_FONT_BOLD, &IID_NULL, 0, DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL); - EXPECT_HR(hr, DISP_E_BADPARAMCOUNT); + ok(hr == DISP_E_BADPARAMCOUNT, "IFontDisp_Invoke should have returned DISP_E_BADPARAMCOUNT instead of 0x%08x\n", hr); hr = IFontDisp_Invoke(fontdisp, DISPID_FONT_BOLD, &IID_NULL, 0, DISPATCH_PROPERTYPUT, NULL, NULL, NULL, NULL); - EXPECT_HR(hr, DISP_E_PARAMNOTOPTIONAL); + ok(hr == DISP_E_PARAMNOTOPTIONAL, "IFontDisp_Invoke should have returned DISP_E_PARAMNOTOPTIONAL instead of 0x%08x\n", hr); hr = IFontDisp_Invoke(fontdisp, DISPID_FONT_BOLD, &IID_NULL, 0, DISPATCH_PROPERTYGET, NULL, NULL, NULL, NULL); - EXPECT_HR(hr, DISP_E_PARAMNOTOPTIONAL); + ok(hr == DISP_E_PARAMNOTOPTIONAL, "IFontDisp_Invoke should have returned DISP_E_PARAMNOTOPTIONAL instead of 0x%08x\n", hr); hr = IFontDisp_Invoke(fontdisp, DISPID_FONT_BOLD, &IID_NULL, 0, DISPATCH_PROPERTYGET, NULL, &varresult, NULL, NULL); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "IFontDisp_Invoke"); hr = IFontDisp_Invoke(fontdisp, DISPID_FONT_BOLD, &IID_NULL, 0, DISPATCH_METHOD, NULL, &varresult, NULL, NULL); - EXPECT_HR(hr, DISP_E_MEMBERNOTFOUND); + ok(hr == DISP_E_MEMBERNOTFOUND, "IFontDisp_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr); hr = IFontDisp_Invoke(fontdisp, 0xdeadbeef, &IID_NULL, 0, DISPATCH_PROPERTYGET, NULL, &varresult, NULL, NULL); - EXPECT_HR(hr, DISP_E_MEMBERNOTFOUND); + ok(hr == DISP_E_MEMBERNOTFOUND, "IFontDisp_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr); dispparams.cArgs = 1; dispparams.rgvarg = &vararg; hr = IFontDisp_Invoke(fontdisp, DISPID_FONT_BOLD, &IID_NULL, 0, DISPATCH_PROPERTYGET, &dispparams, &varresult, NULL, NULL); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "IFontDisp_Invoke"); IFontDisp_Release(fontdisp); } @@ -848,19 +812,27 @@ fontdesc.fStrikethrough = FALSE; hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&pFont); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "OleCreateFontIndirect"); hr = IFont_put_Name(pFont, NULL); - EXPECT_HR(hr, CTL_E_INVALIDPROPERTYVALUE); + ok(hr == CTL_E_INVALIDPROPERTYVALUE, + "IFont::put_Name: Expected CTL_E_INVALIDPROPERTYVALUE got 0x%08x\n", + hr); hr = IFont_get_Name(pFont, NULL); - EXPECT_HR(hr, E_POINTER); + ok(hr == E_POINTER, + "IFont::get_Name: Expected E_POINTER got 0x%08x\n", + hr); hr = IFont_get_Size(pFont, NULL); - EXPECT_HR(hr, E_POINTER); + ok(hr == E_POINTER, + "IFont::get_Size: Expected E_POINTER got 0x%08x\n", + hr); hr = IFont_get_Bold(pFont, NULL); - EXPECT_HR(hr, E_POINTER); + ok(hr == E_POINTER, + "IFont::get_Bold: Expected E_POINTER got 0x%08x\n", + hr); IFont_Release(pFont); } @@ -885,10 +857,10 @@ fontdesc.fStrikethrough = FALSE; hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&font); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "OleCreateFontIndirect"); hr = IFont_get_hFont(font, &hfont); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "get_hFont"); /* show that if the font is updated the old hfont is deleted when the new font is realized */ @@ -902,14 +874,14 @@ ok(obj_type == OBJ_FONT, "got obj type %d\n", obj_type); hr = IFont_put_Size(font, size); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "put_Size"); /* put_Size doesn't cause the new font to be realized */ obj_type = GetObjectType(last_hfont); ok(obj_type == OBJ_FONT, "got obj type %d\n", obj_type); hr = IFont_get_hFont(font, &hfont); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "get_hFont"); obj_type = GetObjectType(last_hfont); ok(obj_type == 0, "%d: got obj type %d\n", i, obj_type); @@ -919,19 +891,20 @@ until the font object is released */ for(i = 0; i < 100; i++) { + size.int64 = (i + 10) * 20000; obj_type = GetObjectType(hfont); ok(obj_type == OBJ_FONT, "got obj type %d\n", obj_type); hr = IFont_put_Size(font, size); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "put_Size"); hr = IFont_get_hFont(font, &hfont); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "get_hFont"); hr = IFont_AddRefHfont(font, hfont); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "AddRefHfont"); if(i == 0) first_hfont = hfont; obj_type = GetObjectType(first_hfont); @@ -947,10 +920,10 @@ through re-realization */ hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&font); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "OleCreateFontIndirect"); hr = IFont_get_hFont(font, &hfont); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "get_hFont"); for(i = 0; i < 100; i++) { @@ -962,20 +935,20 @@ ok(obj_type == OBJ_FONT, "got obj type %d\n", obj_type); hr = IFont_put_Size(font, size); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "put_Size"); /* put_Size doesn't cause the new font to be realized */ obj_type = GetObjectType(last_hfont); ok(obj_type == OBJ_FONT, "got obj type %d\n", obj_type); hr = IFont_get_hFont(font, &hfont); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "get_hFont"); hr = IFont_AddRefHfont(font, hfont); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "AddRefHfont"); hr = IFont_ReleaseHfont(font, hfont); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "ReleaseHfont"); obj_type = GetObjectType(last_hfont); ok(obj_type == 0, "%d: got obj type %d\n", i, obj_type); @@ -992,13 +965,13 @@ ok(obj_type == OBJ_FONT, "got obj type %d\n", obj_type); hr = IFont_put_Size(font, size); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "put_Size"); hr = IFont_get_hFont(font, &hfont); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "get_hFont"); hr = IFont_ReleaseHfont(font, hfont); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "ReleaseHfont"); if(i == 0) first_hfont = hfont; obj_type = GetObjectType(first_hfont); @@ -1015,23 +988,23 @@ that includes internal and external references */ hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&font); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "OleCreateFontIndirect"); hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&font2); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "OleCreateFontIndirect"); hr = IFont_get_hFont(font, &hfont); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "get_hFont"); hr = IFont_get_hFont(font2, &first_hfont); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "get_hFont"); todo_wine ok(hfont == first_hfont, "fonts differ\n"); hr = IFont_ReleaseHfont(font, hfont); - EXPECT_HR(hr, S_OK); + ok(hr == S_OK, "got %08x\n", hr); hr = IFont_ReleaseHfont(font, hfont); todo_wine - EXPECT_HR(hr, S_OK); + ok(hr == S_OK, "got %08x\n", hr); hr = IFont_ReleaseHfont(font, hfont); - EXPECT_HR(hr, S_FALSE); + ok(hr == S_FALSE, "got %08x\n", hr); obj_type = GetObjectType(hfont); ok(obj_type == OBJ_FONT, "got obj type %d\n", obj_type); @@ -1068,10 +1041,10 @@ fontdesc.fStrikethrough = FALSE; hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&font); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "OleCreateFontIndirect"); hr = IFont_get_Charset(font, &cs); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "get_Charset"); ok(cs == ANSI_CHARSET, "got charset %d\n", cs); IFont_Release(font); @@ -1081,86 +1054,62 @@ fontdesc.lpstrName = arial_font; hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&font); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "OleCreateFontIndirect"); hr = IFont_get_Charset(font, &cs); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "get_Charset"); ok(cs == ANSI_CHARSET, "got charset %d\n", cs); name = SysAllocString(marlett_font); hr = IFont_put_Name(font, name); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "put_Name"); SysFreeString(name); hr = IFont_get_Name(font, &name); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "get_Name"); ok(!lstrcmpiW(name, marlett_font), "got name %s\n", wine_dbgstr_w(name)); SysFreeString(name); hr = IFont_get_Charset(font, &cs); - EXPECT_HR(hr, S_OK); + ok_ole_success(hr, "get_Charset"); ok(cs == SYMBOL_CHARSET, "got charset %d\n", cs); IFont_Release(font); } -static void test_OleCreateFontIndirect(void) -{ - FONTDESC fontdesc; - IFont *font; - HRESULT hr; - - fontdesc.cbSizeofstruct = sizeof(fontdesc); - fontdesc.lpstrName = arial_font; - fontdesc.cySize.int64 = 12 * 10000; /* 12 pt */ - fontdesc.sWeight = FW_NORMAL; - fontdesc.sCharset = ANSI_CHARSET; - fontdesc.fItalic = FALSE; - fontdesc.fUnderline = FALSE; - fontdesc.fStrikethrough = FALSE; - - hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void**)&font); - EXPECT_HR(hr, S_OK); - IFont_Release(font); - - /* play with cbSizeofstruct value */ - fontdesc.cbSizeofstruct = sizeof(fontdesc)-1; - hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void**)&font); - EXPECT_HR(hr, S_OK); - IFont_Release(font); - - fontdesc.cbSizeofstruct = sizeof(fontdesc)+1; - hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void**)&font); - EXPECT_HR(hr, S_OK); - IFont_Release(font); - - fontdesc.cbSizeofstruct = 0; - hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void**)&font); - EXPECT_HR(hr, S_OK); - IFont_Release(font); -} - START_TEST(olefont) { - hOleaut32 = GetModuleHandleA("oleaut32.dll"); - pOleCreateFontIndirect = (void*)GetProcAddress(hOleaut32, "OleCreateFontIndirect"); - if (!pOleCreateFontIndirect) - { - win_skip("OleCreateFontIndirect not available\n"); - return; - } - - test_QueryInterface(); - test_type_info(); - test_ifont_sizes(); - test_font_events_disp(); - test_GetIDsOfNames(); - test_Invoke(); - test_IsEqual(); - test_ReleaseHfont(); - test_AddRefHfont(); - test_returns(); - test_hfont_lifetime(); - test_realization(); - test_OleCreateFontIndirect(); -} + hOleaut32 = GetModuleHandleA("oleaut32.dll"); + pOleCreateFontIndirect = (void*)GetProcAddress(hOleaut32, "OleCreateFontIndirect"); + if (!pOleCreateFontIndirect) + { + win_skip("OleCreateFontIndirect not available\n"); + return; + } + + test_QueryInterface(); + test_type_info(); + + /* Test various size operations and conversions. */ + /* Add more as needed. */ + if (0) /* FIXME: failing tests */ + { + test_ifont_sizes(180000, 0, 72, 2540, -18, "default"); + test_ifont_sizes(180000, 0, 144, 2540, -36, "ratio1"); /* change ratio */ + test_ifont_sizes(180000, 0, 72, 1270, -36, "ratio2"); /* 2nd part of ratio */ + + /* These depend on details of how IFont rounds sizes internally. */ + test_ifont_sizes(0, 0, 72, 2540, 0, "zero size"); /* zero size */ + test_ifont_sizes(186000, 0, 72, 2540, -19, "rounding"); /* test rounding */ + } + + test_font_events_disp(); + test_GetIDsOfNames(); + test_Invoke(); + test_IsEqual(); + test_ReleaseHfont(); + test_AddRefHfont(); + test_returns(); + test_hfont_lifetime(); + test_realization(); +} Modified: trunk/rostests/winetests/oleaut32/olepicture.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/oleaut32/olepic…
============================================================================== --- trunk/rostests/winetests/oleaut32/olepicture.c [iso-8859-1] (original) +++ trunk/rostests/winetests/oleaut32/olepicture.c [iso-8859-1] Wed Dec 12 13:55:29 2012 @@ -2,7 +2,7 @@ * OLEPICTURE test program * * Copyright 2005 Marcus Meissner - * Copyright 2012 Dmitry Timoshkov + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,7 +25,6 @@ #include <float.h> #define COBJMACROS -#define CONST_VTABLE #define NONAMELESSUNION #include "wine/test.h" @@ -54,7 +53,7 @@ static HMODULE hOleaut32; static HRESULT (WINAPI *pOleLoadPicture)(LPSTREAM,LONG,BOOL,REFIID,LPVOID*); -static HRESULT (WINAPI *pOleLoadPictureEx)(LPSTREAM,LONG,BOOL,REFIID,DWORD,DWORD,DWORD,LPVOID*); +static HRESULT (WINAPI *pOleCreatePictureIndirect)(PICTDESC*,REFIID,BOOL,LPVOID*); #define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr) @@ -170,17 +169,17 @@ }; -typedef struct NoStatStreamImpl -{ - IStream IStream_iface; +struct NoStatStreamImpl +{ + const IStreamVtbl *lpVtbl; LONG ref; HGLOBAL supportHandle; ULARGE_INTEGER streamSize; ULARGE_INTEGER currentPosition; -} NoStatStreamImpl; - -static IStream* NoStatStream_Construct(HGLOBAL hGlobal); +}; +typedef struct NoStatStreamImpl NoStatStreamImpl; +static NoStatStreamImpl* NoStatStreamImpl_Construct(HGLOBAL hGlobal); static void test_pic_with_stream(LPSTREAM stream, unsigned int imgsize) @@ -220,7 +219,7 @@ if (handle) { BITMAP bmp; - GetObject(UlongToHandle(handle), sizeof(BITMAP), &bmp); + GetObject((HGDIOBJ)handle, sizeof(BITMAP), &bmp); todo_wine ok(bmp.bmBits != 0, "not a dib\n"); } @@ -283,7 +282,7 @@ IStream_Release(stream); /* again with Non Statable and Non Seekable stream */ - stream = NoStatStream_Construct(hglob); + stream = (LPSTREAM)NoStatStreamImpl_Construct(hglob); hglob = 0; /* Non-statable impl always deletes on release */ test_pic_with_stream(stream, 0); @@ -314,7 +313,7 @@ IStream_Release(stream); /* again with Non Statable and Non Seekable stream */ - stream = NoStatStream_Construct(hglob); + stream = (LPSTREAM)NoStatStreamImpl_Construct(hglob); hglob = 0; /* Non-statable impl always deletes on release */ test_pic_with_stream(stream, 0); @@ -482,26 +481,24 @@ static void test_OleCreatePictureIndirect(void) { - OLE_HANDLE handle; IPicture *pict; HRESULT hr; short type; - -if (0) -{ - /* crashes on native */ - OleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, NULL); -} - - hr = OleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, (void**)&pict); + OLE_HANDLE handle; + + if(!pOleCreatePictureIndirect) + { + win_skip("Skipping OleCreatePictureIndirect tests\n"); + return; + } + + hr = pOleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, (void**)&pict); ok(hr == S_OK, "hr %08x\n", hr); - type = PICTYPE_NONE; hr = IPicture_get_Type(pict, &type); ok(hr == S_OK, "hr %08x\n", hr); ok(type == PICTYPE_UNINITIALIZED, "type %d\n", type); - handle = 0xdeadbeef; hr = IPicture_get_Handle(pict, &handle); ok(hr == S_OK, "hr %08x\n", hr); ok(handle == 0, "handle %08x\n", handle); @@ -521,7 +518,7 @@ short type; if(!winetest_interactive) { - skip("ROSTESTS-2: oleaut_winetest:olepicture crashes with Page Fault.\n"); + skip("Bug 5000: oleaut_winetest:olepicture crashes with Page Fault.\n"); return; } @@ -530,7 +527,7 @@ memcpy(data, apmdata, sizeof(apmdata)); ole_check(CreateStreamOnHGlobal(hglob, TRUE, &stream)); - ole_check(pOleLoadPictureEx(stream, sizeof(apmdata), TRUE, &IID_IPicture, 100, 100, 0, (LPVOID *)&pict)); + ole_check(OleLoadPictureEx(stream, sizeof(apmdata), TRUE, &IID_IPicture, 100, 100, 0, (LPVOID *)&pict)); ole_check(IPicture_get_Handle(pict, &handle)); ok(handle != 0, "handle is null\n"); @@ -565,7 +562,7 @@ ole_check(CreateStreamOnHGlobal(hglob, TRUE, &stream)); /* Windows does not load simple metafiles */ - ole_expect(pOleLoadPictureEx(stream, sizeof(metafile), TRUE, &IID_IPicture, 100, 100, 0, (LPVOID *)&pict), E_FAIL); + ole_expect(OleLoadPictureEx(stream, sizeof(metafile), TRUE, &IID_IPicture, 100, 100, 0, (LPVOID *)&pict), E_FAIL); IStream_Release(stream); } @@ -582,7 +579,7 @@ short type; if(!winetest_interactive) { - skip("ROSTESTS-2: oleaut_winetest:olepicture crashes with Page Fault.\n"); + skip("Bug 5000: oleaut_winetest:olepicture crashes with Page Fault.\n"); return; } @@ -591,7 +588,7 @@ memcpy(data, enhmetafile, sizeof(enhmetafile)); ole_check(CreateStreamOnHGlobal(hglob, TRUE, &stream)); - ole_check(pOleLoadPictureEx(stream, sizeof(enhmetafile), TRUE, &IID_IPicture, 10, 10, 0, (LPVOID *)&pict)); + ole_check(OleLoadPictureEx(stream, sizeof(enhmetafile), TRUE, &IID_IPicture, 10, 10, 0, (LPVOID *)&pict)); ole_check(IPicture_get_Handle(pict, &handle)); ok(handle != 0, "handle is null\n"); @@ -678,9 +675,9 @@ IPicture_get_Width(pic, &pWidth); IPicture_get_Height(pic, &pHeight); - SetPixelV(hdc, 0, 0, 0x00223344); - SetPixelV(hdc, 5, 5, 0x00223344); - SetPixelV(hdc, 10, 10, 0x00223344); + SetPixelV(hdc, 0, 0, 0x00F0F0F0); + SetPixelV(hdc, 5, 5, 0x00F0F0F0); + SetPixelV(hdc, 10, 10, 0x00F0F0F0); expected = GetPixel(hdc, 0, 0); hres = IPicture_Render(pic, hdc, 1, 1, 9, 9, 0, 0, pWidth, -pHeight, NULL); @@ -803,8 +800,9 @@ hres = OleLoadPicturePath(emptyW, NULL, 0, 0, NULL, (void **)&pic); todo_wine ok(hres == INET_E_UNKNOWN_PROTOCOL || /* XP/Vista+ */ - broken(hres == E_UNEXPECTED) || /* NT4 */ - broken(hres == E_OUTOFMEMORY), /* Win2k/Win2k3 */ + hres == E_UNEXPECTED || /* NT4/Win95 */ + hres == E_FAIL || /* Win95 OSR2 */ + hres == E_OUTOFMEMORY, /* Win98/Win2k/Win2k3 */ "Expected OleLoadPicturePath to return INET_E_UNKNOWN_PROTOCOL, got 0x%08x\n", hres); ok(pic == NULL, "Expected the output interface pointer to be NULL, got %p\n", pic); @@ -813,8 +811,9 @@ hres = OleLoadPicturePath(emptyW, NULL, 0, 0, &IID_IPicture, (void **)&pic); todo_wine ok(hres == INET_E_UNKNOWN_PROTOCOL || /* XP/Vista+ */ - broken(hres == E_UNEXPECTED) || /* NT4 */ - broken(hres == E_OUTOFMEMORY), /* Win2k/Win2k3 */ + hres == E_UNEXPECTED || /* NT4/Win95 */ + hres == E_FAIL || /* Win95 OSR2 */ + hres == E_OUTOFMEMORY, /* Win98/Win2k/Win2k3 */ "Expected OleLoadPicturePath to return INET_E_UNKNOWN_PROTOCOL, got 0x%08x\n", hres); ok(pic == NULL, "Expected the output interface pointer to be NULL, got %p\n", pic); @@ -832,7 +831,7 @@ /* Try a normal DOS path. */ hres = OleLoadPicturePath(temp_fileW + 8, NULL, 0, 0, &IID_IPicture, (void **)&pic); ok(hres == S_OK || - broken(hres == E_UNEXPECTED), /* NT4 */ + broken(hres == E_UNEXPECTED), /* NT4/Win95 */ "Expected OleLoadPicturePath to return S_OK, got 0x%08x\n", hres); if (pic) IPicture_Release(pic); @@ -840,7 +839,7 @@ /* Try a DOS path with tacked on "file:". */ hres = OleLoadPicturePath(temp_fileW, NULL, 0, 0, &IID_IPicture, (void **)&pic); ok(hres == S_OK || - broken(hres == E_UNEXPECTED), /* NT4 */ + broken(hres == E_UNEXPECTED), /* NT4/Win95 */ "Expected OleLoadPicturePath to return S_OK, got 0x%08x\n", hres); if (pic) IPicture_Release(pic); @@ -850,14 +849,14 @@ /* Try with a nonexistent file. */ hres = OleLoadPicturePath(temp_fileW + 8, NULL, 0, 0, &IID_IPicture, (void **)&pic); ok(hres == INET_E_RESOURCE_NOT_FOUND || /* XP+ */ - broken(hres == E_UNEXPECTED) || /* NT4 */ - broken(hres == E_FAIL), /*Win2k */ + hres == E_UNEXPECTED || /* NT4/Win95 */ + hres == E_FAIL, /* Win9x/Win2k */ "Expected OleLoadPicturePath to return INET_E_RESOURCE_NOT_FOUND, got 0x%08x\n", hres); hres = OleLoadPicturePath(temp_fileW, NULL, 0, 0, &IID_IPicture, (void **)&pic); ok(hres == INET_E_RESOURCE_NOT_FOUND || /* XP+ */ - broken(hres == E_UNEXPECTED) || /* NT4 */ - broken(hres == E_FAIL), /* Win2k */ + hres == E_UNEXPECTED || /* NT4/Win95 */ + hres == E_FAIL, /* Win9x/Win2k */ "Expected OleLoadPicturePath to return INET_E_RESOURCE_NOT_FOUND, got 0x%08x\n", hres); file = CreateFileA(temp_file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, @@ -876,7 +875,7 @@ hres = OleLoadPicturePath(temp_fileW, NULL, 0, 0, &IID_IPicture, (void **)&pic); ok(hres == S_OK || - broken(hres == E_UNEXPECTED), /* NT4 */ + broken(hres == E_UNEXPECTED), /* NT4/Win95 */ "Expected OleLoadPicturePath to return S_OK, got 0x%08x\n", hres); if (pic) IPicture_Release(pic); @@ -886,267 +885,35 @@ /* Try with a nonexistent file. */ hres = OleLoadPicturePath(temp_fileW, NULL, 0, 0, &IID_IPicture, (void **)&pic); ok(hres == INET_E_RESOURCE_NOT_FOUND || /* XP+ */ - broken(hres == E_UNEXPECTED) || /* NT4 */ - broken(hres == E_FAIL), /* Win2k */ + hres == E_UNEXPECTED || /* NT4/Win95 */ + hres == E_FAIL, /* Win9x/Win2k */ "Expected OleLoadPicturePath to return INET_E_RESOURCE_NOT_FOUND, got 0x%08x\n", hres); } -static void test_himetric(void) -{ - static const BYTE bmp_bits[1024]; - OLE_XSIZE_HIMETRIC cx; - OLE_YSIZE_HIMETRIC cy; - IPicture *pic; - PICTDESC desc; - HBITMAP bmp; - HRESULT hr; - HICON icon; - HDC hdc; - INT d; - - desc.cbSizeofstruct = sizeof(desc); - desc.picType = PICTYPE_BITMAP; - desc.u.bmp.hpal = NULL; - - hdc = CreateCompatibleDC(0); - - bmp = CreateBitmap(1.9 * GetDeviceCaps(hdc, LOGPIXELSX), - 1.9 * GetDeviceCaps(hdc, LOGPIXELSY), 1, 1, NULL); - - desc.u.bmp.hbitmap = bmp; - - /* size in himetric units reported rounded up to next integer value */ - hr = OleCreatePictureIndirect(&desc, &IID_IPicture, FALSE, (void**)&pic); - ok(hr == S_OK, "got 0x%08x\n", hr); - - cx = 0; - d = MulDiv((INT)(1.9 * GetDeviceCaps(hdc, LOGPIXELSX)), 2540, GetDeviceCaps(hdc, LOGPIXELSX)); - hr = IPicture_get_Width(pic, &cx); - ok(hr == S_OK, "got 0x%08x\n", hr); - ok(cx == d, "got %d, expected %d\n", cx, d); - - cy = 0; - d = MulDiv((INT)(1.9 * GetDeviceCaps(hdc, LOGPIXELSY)), 2540, GetDeviceCaps(hdc, LOGPIXELSY)); - hr = IPicture_get_Height(pic, &cy); - ok(hr == S_OK, "got 0x%08x\n", hr); - ok(cy == d, "got %d, expected %d\n", cy, d); - - DeleteObject(bmp); - IPicture_Release(pic); - - /* same thing with icon */ - icon = CreateIcon(NULL, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), - 1, 1, bmp_bits, bmp_bits); - ok(icon != NULL, "failed to create icon\n"); - - desc.picType = PICTYPE_ICON; - desc.u.icon.hicon = icon; - - hr = OleCreatePictureIndirect(&desc, &IID_IPicture, FALSE, (void**)&pic); - ok(hr == S_OK, "got 0x%08x\n", hr); - - cx = 0; - d = MulDiv(GetSystemMetrics(SM_CXICON), 2540, GetDeviceCaps(hdc, LOGPIXELSX)); - hr = IPicture_get_Width(pic, &cx); - ok(hr == S_OK, "got 0x%08x\n", hr); - ok(cx == d, "got %d, expected %d\n", cx, d); - - cy = 0; - d = MulDiv(GetSystemMetrics(SM_CYICON), 2540, GetDeviceCaps(hdc, LOGPIXELSY)); - hr = IPicture_get_Height(pic, &cy); - ok(hr == S_OK, "got 0x%08x\n", hr); - ok(cy == d, "got %d, expected %d\n", cy, d); - - IPicture_Release(pic); - DestroyIcon(icon); - - DeleteDC(hdc); -} - -static void test_load_save_bmp(void) -{ - IPicture *pic; - PICTDESC desc; - short type; - OLE_HANDLE handle; - HGLOBAL hmem; - DWORD *mem; - IPersistStream *src_stream; - IStream *dst_stream; - HRESULT hr; - - desc.cbSizeofstruct = sizeof(desc); - desc.picType = PICTYPE_BITMAP; - desc.u.bmp.hpal = 0; - desc.u.bmp.hbitmap = CreateBitmap(1, 1, 1, 1, NULL); - hr = OleCreatePictureIndirect(&desc, &IID_IPicture, FALSE, (void**)&pic); - ok(hr == S_OK, "OleCreatePictureIndirect error %#x\n", hr); - - type = -1; - hr = IPicture_get_Type(pic, &type); - ok(hr == S_OK,"get_Type error %#8x\n", hr); - ok(type == PICTYPE_BITMAP,"expected picture type PICTYPE_BITMAP, got %d\n", type); - - hr = IPicture_get_Handle(pic, &handle); - ok(hr == S_OK,"get_Handle error %#8x\n", hr); - ok(IntToPtr(handle) == desc.u.bmp.hbitmap, "get_Handle returned wrong handle %#x\n", handle); - - hmem = GlobalAlloc(GMEM_ZEROINIT, 4096); - hr = CreateStreamOnHGlobal(hmem, FALSE, &dst_stream); - ok(hr == S_OK, "createstreamonhglobal error %#x\n", hr); - - hr = IPicture_QueryInterface(pic, &IID_IPersistStream, (void **)&src_stream); - ok(hr == S_OK, "QueryInterface error %#x\n", hr); - - hr = IPersistStream_Save(src_stream, dst_stream, TRUE); - ok(hr == S_OK, "Save error %#x\n", hr); - - IPersistStream_Release(src_stream); - IStream_Release(dst_stream); - - mem = GlobalLock(hmem); - ok(!memcmp(mem, "lt\0\0", 4), "got wrong stream header %04x\n", mem[0]); - ok(mem[1] == 66, "expected stream size 66, got %u\n", mem[1]); - ok(!memcmp(&mem[2], "BM", 2), "got wrong bmp header %04x\n", mem[2]); - - GlobalUnlock(hmem); - GlobalFree(hmem); - - DeleteObject(desc.u.bmp.hbitmap); - IPicture_Release(pic); -} - -static void test_load_save_icon(void) -{ - IPicture *pic; - PICTDESC desc; - short type; - OLE_HANDLE handle; - HGLOBAL hmem; - DWORD *mem; - IPersistStream *src_stream; - IStream *dst_stream; - HRESULT hr; - - desc.cbSizeofstruct = sizeof(desc); - desc.picType = PICTYPE_ICON; - desc.u.icon.hicon = LoadIcon(0, IDI_APPLICATION); - hr = OleCreatePictureIndirect(&desc, &IID_IPicture, FALSE, (void**)&pic); - ok(hr == S_OK, "OleCreatePictureIndirect error %#x\n", hr); - - type = -1; - hr = IPicture_get_Type(pic, &type); - ok(hr == S_OK,"get_Type error %#8x\n", hr); - ok(type == PICTYPE_ICON,"expected picture type PICTYPE_ICON, got %d\n", type); - - hr = IPicture_get_Handle(pic, &handle); - ok(hr == S_OK,"get_Handle error %#8x\n", hr); - ok(IntToPtr(handle) == desc.u.icon.hicon, "get_Handle returned wrong handle %#x\n", handle); - - hmem = GlobalAlloc(GMEM_ZEROINIT, 8192); - hr = CreateStreamOnHGlobal(hmem, FALSE, &dst_stream); - ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr); - - hr = IPicture_QueryInterface(pic, &IID_IPersistStream, (void **)&src_stream); - ok(hr == S_OK, "QueryInterface error %#x\n", hr); - - hr = IPersistStream_Save(src_stream, dst_stream, TRUE); - ok(hr == S_OK, "Saveerror %#x\n", hr); - - IPersistStream_Release(src_stream); - IStream_Release(dst_stream); - - mem = GlobalLock(hmem); - ok(!memcmp(mem, "lt\0\0", 4), "got wrong stream header %04x\n", mem[0]); -todo_wine - ok(mem[1] == 766, "expected stream size 766, got %u\n", mem[1]); - ok(mem[2] == 0x00010000, "got wrong icon header %04x\n", mem[2]); - - GlobalUnlock(hmem); - GlobalFree(hmem); - - DestroyIcon(desc.u.icon.hicon); - IPicture_Release(pic); -} - -static void test_load_save_empty_picture(void) -{ - IPicture *pic; - PICTDESC desc; - short type; - OLE_HANDLE handle; - HGLOBAL hmem; - DWORD *mem; - IPersistStream *src_stream; - IStream *dst_stream; - HRESULT hr; - - memset(&pic, 0, sizeof(pic)); - desc.cbSizeofstruct = sizeof(desc); - desc.picType = PICTYPE_NONE; - hr = OleCreatePictureIndirect(&desc, &IID_IPicture, FALSE, (void **)&pic); - ok(hr == S_OK, "OleCreatePictureIndirect error %#x\n", hr); - - type = -1; - hr = IPicture_get_Type(pic, &type); - ok(hr == S_OK,"get_Type error %#8x\n", hr); - ok(type == PICTYPE_NONE,"expected picture type PICTYPE_NONE, got %d\n", type); - - handle = (OLE_HANDLE)0xdeadbeef; - hr = IPicture_get_Handle(pic, &handle); - ok(hr == S_OK,"get_Handle error %#8x\n", hr); - ok(!handle, "get_Handle returned wrong handle %#x\n", handle); - - hmem = GlobalAlloc(GMEM_ZEROINIT, 4096); - hr = CreateStreamOnHGlobal(hmem, FALSE, &dst_stream); - ok(hr == S_OK, "createstreamonhglobal error %#x\n", hr); - - hr = IPicture_QueryInterface(pic, &IID_IPersistStream, (void **)&src_stream); - ok(hr == S_OK, "QueryInterface error %#x\n", hr); - - hr = IPersistStream_Save(src_stream, dst_stream, TRUE); - ok(hr == S_OK, "Save error %#x\n", hr); - - mem = GlobalLock(hmem); - ok(!memcmp(mem, "lt\0\0", 4), "got wrong stream header %04x\n", mem[0]); - ok(mem[1] == 0, "expected stream size 0, got %u\n", mem[1]); - GlobalUnlock(hmem); - - IPersistStream_Release(src_stream); - IStream_Release(dst_stream); - - GlobalFree(hmem); - IPicture_Release(pic); -} - START_TEST(olepicture) { - hOleaut32 = GetModuleHandleA("oleaut32.dll"); - pOleLoadPicture = (void*)GetProcAddress(hOleaut32, "OleLoadPicture"); - pOleLoadPictureEx = (void*)GetProcAddress(hOleaut32, "OleLoadPictureEx"); - if (!pOleLoadPicture) - { - win_skip("OleLoadPicture is not available\n"); - return; - } - - /* Test regular 1x1 pixel images of gif, jpg, bmp type */ - test_pic(gifimage, sizeof(gifimage)); - test_pic(jpgimage, sizeof(jpgimage)); - test_pic(bmpimage, sizeof(bmpimage)); - test_pic(gif4pixel, sizeof(gif4pixel)); - /* FIXME: No PNG support in Windows... */ - if (0) test_pic(pngimage, sizeof(pngimage)); - test_empty_image(); - test_empty_image_2(); - if (pOleLoadPictureEx) - { + hOleaut32 = GetModuleHandleA("oleaut32.dll"); + pOleLoadPicture = (void*)GetProcAddress(hOleaut32, "OleLoadPicture"); + pOleCreatePictureIndirect = (void*)GetProcAddress(hOleaut32, "OleCreatePictureIndirect"); + if (!pOleLoadPicture) + { + win_skip("OleLoadPicture is not available\n"); + return; + } + + /* Test regular 1x1 pixel images of gif, jpg, bmp type */ + test_pic(gifimage, sizeof(gifimage)); + test_pic(jpgimage, sizeof(jpgimage)); + test_pic(bmpimage, sizeof(bmpimage)); + test_pic(gif4pixel, sizeof(gif4pixel)); + /* FIXME: No PNG support in Windows... */ + if (0) test_pic(pngimage, sizeof(pngimage)); + test_empty_image(); + test_empty_image_2(); test_apm(); test_metafile(); test_enhmetafile(); - } - else - win_skip("OleLoadPictureEx is not available\n"); + test_Invoke(); test_OleCreatePictureIndirect(); test_Render(); @@ -1154,20 +921,11 @@ test_get_Handle(); test_get_Type(); test_OleLoadPicturePath(); - test_himetric(); - test_load_save_bmp(); - test_load_save_icon(); - test_load_save_empty_picture(); } /* Helper functions only ... */ - -static inline NoStatStreamImpl *impl_from_IStream(IStream *iface) -{ - return CONTAINING_RECORD(iface, NoStatStreamImpl, IStream_iface); -} static void NoStatStreamImpl_Destroy(NoStatStreamImpl* This) { @@ -1179,7 +937,7 @@ static ULONG WINAPI NoStatStreamImpl_AddRef( IStream* iface) { - NoStatStreamImpl* const This = impl_from_IStream(iface); + NoStatStreamImpl* const This=(NoStatStreamImpl*)iface; return InterlockedIncrement(&This->ref); } @@ -1188,7 +946,7 @@ REFIID riid, /* [in] */ void** ppvObject) /* [iid_is][out] */ { - NoStatStreamImpl* const This = impl_from_IStream(iface); + NoStatStreamImpl* const This=(NoStatStreamImpl*)iface; if (ppvObject==0) return E_INVALIDARG; *ppvObject = 0; if (IsEqualIID(&IID_IUnknown, riid)) @@ -1209,7 +967,7 @@ static ULONG WINAPI NoStatStreamImpl_Release( IStream* iface) { - NoStatStreamImpl* const This = impl_from_IStream(iface); + NoStatStreamImpl* const This=(NoStatStreamImpl*)iface; ULONG newRef = InterlockedDecrement(&This->ref); if (newRef==0) NoStatStreamImpl_Destroy(This); @@ -1222,7 +980,7 @@ ULONG cb, /* [in] */ ULONG* pcbRead) /* [out] */ { - NoStatStreamImpl* const This = impl_from_IStream(iface); + NoStatStreamImpl* const This=(NoStatStreamImpl*)iface; void* supportBuffer; ULONG bytesReadBuffer; ULONG bytesToReadFromBuffer; @@ -1246,7 +1004,7 @@ ULONG cb, /* [in] */ ULONG* pcbWritten) /* [out] */ { - NoStatStreamImpl* const This = impl_from_IStream(iface); + NoStatStreamImpl* const This=(NoStatStreamImpl*)iface; void* supportBuffer; ULARGE_INTEGER newSize; ULONG bytesWritten = 0; @@ -1274,7 +1032,7 @@ DWORD dwOrigin, /* [in] */ ULARGE_INTEGER* plibNewPosition) /* [out] */ { - NoStatStreamImpl* const This = impl_from_IStream(iface); + NoStatStreamImpl* const This=(NoStatStreamImpl*)iface; ULARGE_INTEGER newPosition; switch (dwOrigin) { @@ -1303,7 +1061,7 @@ IStream* iface, ULARGE_INTEGER libNewSize) /* [in] */ { - NoStatStreamImpl* const This = impl_from_IStream(iface); + NoStatStreamImpl* const This=(NoStatStreamImpl*)iface; HGLOBAL supportHandle; if (libNewSize.u.HighPart != 0) return STG_E_INVALIDFUNCTION; @@ -1416,14 +1174,14 @@ In any case the object takes ownership of memory handle and will free it on object release. */ -static IStream* NoStatStream_Construct(HGLOBAL hGlobal) +static NoStatStreamImpl* NoStatStreamImpl_Construct(HGLOBAL hGlobal) { NoStatStreamImpl* newStream; newStream = HeapAlloc(GetProcessHeap(), 0, sizeof(NoStatStreamImpl)); if (newStream!=0) { - newStream->IStream_iface.lpVtbl = &NoStatStreamImpl_Vtbl; + newStream->lpVtbl = &NoStatStreamImpl_Vtbl; newStream->ref = 1; newStream->supportHandle = hGlobal; @@ -1435,7 +1193,7 @@ newStream->streamSize.u.HighPart = 0; newStream->streamSize.u.LowPart = GlobalSize(newStream->supportHandle); } - return &newStream->IStream_iface; + return newStream; }
12 years
1
0
0
0
[akhaldi] 57890: [OLEAUT32_WINETEST] * Sync with Wine 1.5.19.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Dec 12 13:53:12 2012 New Revision: 57890 URL:
http://svn.reactos.org/svn/reactos?rev=57890&view=rev
Log: [OLEAUT32_WINETEST] * Sync with Wine 1.5.19. Modified: trunk/rostests/winetests/oleaut32/olefont.c trunk/rostests/winetests/oleaut32/olepicture.c Modified: trunk/rostests/winetests/oleaut32/olefont.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/oleaut32/olefon…
============================================================================== --- trunk/rostests/winetests/oleaut32/olefont.c [iso-8859-1] (original) +++ trunk/rostests/winetests/oleaut32/olefont.c [iso-8859-1] Wed Dec 12 13:53:12 2012 @@ -51,14 +51,14 @@ static HRESULT (WINAPI *pOleCreateFontIndirect)(LPFONTDESC,REFIID,LPVOID*); -#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr) +#define EXPECT_HR(hr,hr_exp) \ + ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp) /* Create a font with cySize given by lo_size, hi_size, */ /* SetRatio to ratio_logical, ratio_himetric, */ /* check that resulting hfont has height hfont_height. */ /* Various checks along the way. */ - -static void test_ifont_sizes(LONG lo_size, LONG hi_size, +static void test_ifont_size(LONG lo_size, LONG hi_size, LONG ratio_logical, LONG ratio_himetric, LONG hfont_height, const char * test_name) { @@ -69,9 +69,10 @@ LOGFONT lf; CY psize; HRESULT hres; + DWORD rtnval; fd.cbSizeofstruct = sizeof(FONTDESC); - fd.lpstrName = system_font; + fd.lpstrName = arial_font; /* using scalable instead of bitmap font reduces errors due to font realization */ S(fd.cySize).Lo = lo_size; S(fd.cySize).Hi = hi_size; fd.sWeight = 0; @@ -87,32 +88,33 @@ test_name, hres); ok(pvObj != NULL,"%s: OCFI returns NULL.\n", test_name); - /* Read back size. Hi part was ignored. */ + /* If scaling ration specified, change ratio. */ + if(ratio_logical && ratio_himetric) + { + hres = IFont_SetRatio(ifnt, ratio_logical, ratio_himetric); + ok(hres == S_OK,"%s: IFont_SetRatio returns 0x%08x instead of S_OK.\n", + test_name, hres); + } + + /* Read back size. */ hres = IFont_get_Size(ifnt, &psize); ok(hres == S_OK,"%s: IFont_get_size returns 0x%08x instead of S_OK.\n", test_name, hres); - ok(S(psize).Lo == lo_size && S(psize).Hi == 0, - "%s: get_Size: Lo=%d, Hi=%d; expected Lo=%d, Hi=0.\n", - test_name, S(psize).Lo, S(psize).Hi, lo_size); - - /* Change ratio, check size unchanged. Standard is 72, 2540. */ - hres = IFont_SetRatio(ifnt, ratio_logical, ratio_himetric); - ok(hres == S_OK,"%s: IFont_SR returns 0x%08x instead of S_OK.\n", - test_name, hres); - hres = IFont_get_Size(ifnt, &psize); - ok(hres == S_OK,"%s: IFont_get_size returns 0x%08x instead of S_OK.\n", - test_name, hres); - ok(S(psize).Lo == lo_size && S(psize).Hi == 0, - "%s: gS after SR: Lo=%d, Hi=%d; expected Lo=%d, Hi=0.\n", - test_name, S(psize).Lo, S(psize).Hi, lo_size); - - /* Check hFont size with this ratio. This tests an important */ - /* conversion for which MSDN is very wrong. */ + + /* Check returned size - allow for errors due to rounding & font realization. */ + ok((abs(S(psize).Lo - lo_size) < 10000) && S(psize).Hi == hi_size, + "%s: IFont_get_Size: Lo=%d, Hi=%d; expected Lo=%d, Hi=%d.\n", + test_name, S(psize).Lo, S(psize).Hi, lo_size, hi_size); + + /* Check hFont size. */ hres = IFont_get_hFont (ifnt, &hfont); ok(hres == S_OK, "%s: IFont_get_hFont returns 0x%08x instead of S_OK.\n", test_name, hres); - hres = GetObject (hfont, sizeof(LOGFONT), &lf); - ok(lf.lfHeight == hfont_height, + rtnval = GetObject (hfont, sizeof(LOGFONT), &lf); + ok(rtnval > 0, "GetObject(hfont) failed\n"); + + /* Since font scaling may encounter rounding errors, allow 1 pixel deviation. */ + ok(abs(lf.lfHeight - hfont_height) <= 1, "%s: hFont has lf.lfHeight=%d, expected %d.\n", test_name, lf.lfHeight, hfont_height); @@ -120,35 +122,68 @@ IFont_Release(ifnt); } +static void test_ifont_sizes(void) +{ + /* Test various size operations and conversions. */ + /* Add more as needed. */ + + /* Results of first 2 tests depend on display resolution. */ + HDC hdc = GetDC(0); + LONG dpi = GetDeviceCaps(hdc, LOGPIXELSY); /* expected results depend on display DPI */ + ReleaseDC(0, hdc); + if(dpi == 96) /* normal resolution display */ + { + test_ifont_size(180000, 0, 0, 0, -24, "default"); /* normal font */ + test_ifont_size(186000, 0, 0, 0, -25, "rounding"); /* test rounding */ + } else if(dpi == 72) /* low resolution display */ + { + test_ifont_size(180000, 0, 0, 0, -18, "default"); /* normal font */ + test_ifont_size(186000, 0, 0, 0, -19, "rounding"); /* test rounding */ + } else if(dpi == 120) /* high resolution display */ + { + test_ifont_size(180000, 0, 0, 0, -30, "default"); /* normal font */ + test_ifont_size(186000, 0, 0, 0, -31, "rounding"); /* test rounding */ + } else + skip("Skipping resolution dependent font size tests - display resolution is %d\n", dpi); + + /* Next 4 tests specify a scaling ratio, so display resolution is not a factor. */ + test_ifont_size(180000, 0, 72, 2540, -18, "ratio1"); /* change ratio */ + test_ifont_size(180000, 0, 144, 2540, -36, "ratio2"); /* another ratio */ + test_ifont_size(180000, 0, 72, 1270, -36, "ratio3"); /* yet another ratio */ + test_ifont_size(186000, 0, 72, 2540, -19, "rounding+ratio"); /* test rounding with ratio */ +} + static void test_QueryInterface(void) { - LPVOID pvObj = NULL; - HRESULT hres; - IFont* font = NULL; - LONG ret; - - hres = pOleCreateFontIndirect(NULL, &IID_IFont, &pvObj); - font = pvObj; - - ok(hres == S_OK,"OCFI (NULL,..) does not return 0, but 0x%08x\n",hres); - ok(font != NULL,"OCFI (NULL,..) returns NULL, instead of !NULL\n"); - - pvObj = NULL; - hres = IFont_QueryInterface( font, &IID_IFont, &pvObj); - - /* Test if QueryInterface increments ref counter for IFONTs */ - ret = IFont_AddRef(font); - ok(ret == 3 || - broken(ret == 1), /* win95 */ - "IFont_QI expected ref value 3 but instead got %d\n",ret); - IFont_Release(font); - - ok(hres == S_OK,"IFont_QI does not return S_OK, but 0x%08x\n", hres); - ok(pvObj != NULL,"IFont_QI does return NULL, instead of a ptr\n"); - - /* Original ref and QueryInterface ref both have to be released */ - IFont_Release(font); - IFont_Release(font); + LPVOID pvObj = NULL; + HRESULT hr; + IFont* font = NULL; + LONG ref; + + hr = pOleCreateFontIndirect(NULL, &IID_IFont, NULL); + EXPECT_HR(hr, E_POINTER); + + hr = pOleCreateFontIndirect(NULL, &IID_IFont, &pvObj); + font = pvObj; + + EXPECT_HR(hr, S_OK); + ok(font != NULL,"OCFI (NULL,..) returns NULL, instead of !NULL\n"); + + pvObj = NULL; + hr = IFont_QueryInterface( font, &IID_IFont, &pvObj); + EXPECT_HR(hr, S_OK); + + /* Test if QueryInterface increments ref counter for IFONTs */ + ref = IFont_AddRef(font); + ok(ref == 3 || + broken(ref == 1), /* win95 */ + "IFont_QI expected ref value 3 but instead got %d\n", ref); + IFont_Release(font); + + ok(pvObj != NULL,"IFont_QI does return NULL, instead of a ptr\n"); + + IFont_Release(font); + IFont_Release(font); } static void test_type_info(void) @@ -201,7 +236,7 @@ { if (IsEqualIID(riid, &IID_IFontEventsDisp) || IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDispatch)) { - IUnknown_AddRef(iface); + IFontEventsDisp_AddRef(iface); *ppvObject = iface; return S_OK; } @@ -284,26 +319,26 @@ fontdesc.fStrikethrough = FALSE; hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&pFont); - ok_ole_success(hr, "OleCreateFontIndirect"); + EXPECT_HR(hr, S_OK); hr = IFont_QueryInterface(pFont, &IID_IConnectionPointContainer, (void **)&pCPC); - ok_ole_success(hr, "IFont_QueryInterface"); + EXPECT_HR(hr, S_OK); hr = IConnectionPointContainer_FindConnectionPoint(pCPC, &IID_IFontEventsDisp, &pCP); - ok_ole_success(hr, "IConnectionPointContainer_FindConnectionPoint"); + EXPECT_HR(hr, S_OK); IConnectionPointContainer_Release(pCPC); hr = IConnectionPoint_Advise(pCP, (IUnknown *)&FontEventsDisp, &dwCookie); - ok_ole_success(hr, "IConnectionPoint_Advise"); + EXPECT_HR(hr, S_OK); IConnectionPoint_Release(pCP); hr = IFont_put_Bold(pFont, TRUE); - ok_ole_success(hr, "IFont_put_Bold"); + EXPECT_HR(hr, S_OK); ok(fonteventsdisp_invoke_called == 1, "IFontEventDisp::Invoke wasn't called once\n"); hr = IFont_QueryInterface(pFont, &IID_IFontDisp, (void **)&pFontDisp); - ok_ole_success(hr, "IFont_QueryInterface"); + EXPECT_HR(hr, S_OK); V_VT(&vararg) = VT_BOOL; V_BOOL(&vararg) = VARIANT_FALSE; @@ -312,6 +347,7 @@ dispparams.cArgs = 1; dispparams.rgvarg = &vararg; hr = IFontDisp_Invoke(pFontDisp, DISPID_FONT_BOLD, &IID_NULL, 0, DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL); + EXPECT_HR(hr, S_OK); IFontDisp_Release(pFontDisp); @@ -319,11 +355,11 @@ fonteventsdisp_invoke_called); hr = IFont_Clone(pFont, &pFont2); - ok_ole_success(hr, "IFont_Clone"); + EXPECT_HR(hr, S_OK); IFont_Release(pFont); hr = IFont_put_Bold(pFont2, FALSE); - ok_ole_success(hr, "IFont_put_Bold"); + EXPECT_HR(hr, S_OK); /* this test shows that the notification routine isn't called again */ ok(fonteventsdisp_invoke_called == 2, "IFontEventDisp::Invoke was called %d times instead of twice\n", @@ -450,7 +486,7 @@ VARIANT varresult; hr = pOleCreateFontIndirect(NULL, &IID_IFontDisp, (void **)&fontdisp); - ok_ole_success(hr, "OleCreateFontIndirect"); + EXPECT_HR(hr, S_OK); V_VT(&vararg) = VT_BOOL; V_BOOL(&vararg) = VARIANT_FALSE; @@ -459,32 +495,32 @@ dispparams.cArgs = 1; dispparams.rgvarg = &vararg; hr = IFontDisp_Invoke(fontdisp, DISPID_FONT_BOLD, &IID_IFontDisp, 0, DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL); - ok(hr == DISP_E_UNKNOWNINTERFACE, "IFontDisp_Invoke should have returned DISP_E_UNKNOWNINTERFACE instead of 0x%08x\n", hr); + EXPECT_HR(hr, DISP_E_UNKNOWNINTERFACE); dispparams.cArgs = 0; dispparams.rgvarg = NULL; hr = IFontDisp_Invoke(fontdisp, DISPID_FONT_BOLD, &IID_NULL, 0, DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL); - ok(hr == DISP_E_BADPARAMCOUNT, "IFontDisp_Invoke should have returned DISP_E_BADPARAMCOUNT instead of 0x%08x\n", hr); + EXPECT_HR(hr, DISP_E_BADPARAMCOUNT); hr = IFontDisp_Invoke(fontdisp, DISPID_FONT_BOLD, &IID_NULL, 0, DISPATCH_PROPERTYPUT, NULL, NULL, NULL, NULL); - ok(hr == DISP_E_PARAMNOTOPTIONAL, "IFontDisp_Invoke should have returned DISP_E_PARAMNOTOPTIONAL instead of 0x%08x\n", hr); + EXPECT_HR(hr, DISP_E_PARAMNOTOPTIONAL); hr = IFontDisp_Invoke(fontdisp, DISPID_FONT_BOLD, &IID_NULL, 0, DISPATCH_PROPERTYGET, NULL, NULL, NULL, NULL); - ok(hr == DISP_E_PARAMNOTOPTIONAL, "IFontDisp_Invoke should have returned DISP_E_PARAMNOTOPTIONAL instead of 0x%08x\n", hr); + EXPECT_HR(hr, DISP_E_PARAMNOTOPTIONAL); hr = IFontDisp_Invoke(fontdisp, DISPID_FONT_BOLD, &IID_NULL, 0, DISPATCH_PROPERTYGET, NULL, &varresult, NULL, NULL); - ok_ole_success(hr, "IFontDisp_Invoke"); + EXPECT_HR(hr, S_OK); hr = IFontDisp_Invoke(fontdisp, DISPID_FONT_BOLD, &IID_NULL, 0, DISPATCH_METHOD, NULL, &varresult, NULL, NULL); - ok(hr == DISP_E_MEMBERNOTFOUND, "IFontDisp_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr); + EXPECT_HR(hr, DISP_E_MEMBERNOTFOUND); hr = IFontDisp_Invoke(fontdisp, 0xdeadbeef, &IID_NULL, 0, DISPATCH_PROPERTYGET, NULL, &varresult, NULL, NULL); - ok(hr == DISP_E_MEMBERNOTFOUND, "IFontDisp_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr); + EXPECT_HR(hr, DISP_E_MEMBERNOTFOUND); dispparams.cArgs = 1; dispparams.rgvarg = &vararg; hr = IFontDisp_Invoke(fontdisp, DISPID_FONT_BOLD, &IID_NULL, 0, DISPATCH_PROPERTYGET, &dispparams, &varresult, NULL, NULL); - ok_ole_success(hr, "IFontDisp_Invoke"); + EXPECT_HR(hr, S_OK); IFontDisp_Release(fontdisp); } @@ -812,27 +848,19 @@ fontdesc.fStrikethrough = FALSE; hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&pFont); - ok_ole_success(hr, "OleCreateFontIndirect"); + EXPECT_HR(hr, S_OK); hr = IFont_put_Name(pFont, NULL); - ok(hr == CTL_E_INVALIDPROPERTYVALUE, - "IFont::put_Name: Expected CTL_E_INVALIDPROPERTYVALUE got 0x%08x\n", - hr); + EXPECT_HR(hr, CTL_E_INVALIDPROPERTYVALUE); hr = IFont_get_Name(pFont, NULL); - ok(hr == E_POINTER, - "IFont::get_Name: Expected E_POINTER got 0x%08x\n", - hr); + EXPECT_HR(hr, E_POINTER); hr = IFont_get_Size(pFont, NULL); - ok(hr == E_POINTER, - "IFont::get_Size: Expected E_POINTER got 0x%08x\n", - hr); + EXPECT_HR(hr, E_POINTER); hr = IFont_get_Bold(pFont, NULL); - ok(hr == E_POINTER, - "IFont::get_Bold: Expected E_POINTER got 0x%08x\n", - hr); + EXPECT_HR(hr, E_POINTER); IFont_Release(pFont); } @@ -857,10 +885,10 @@ fontdesc.fStrikethrough = FALSE; hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&font); - ok_ole_success(hr, "OleCreateFontIndirect"); + EXPECT_HR(hr, S_OK); hr = IFont_get_hFont(font, &hfont); - ok_ole_success(hr, "get_hFont"); + EXPECT_HR(hr, S_OK); /* show that if the font is updated the old hfont is deleted when the new font is realized */ @@ -874,14 +902,14 @@ ok(obj_type == OBJ_FONT, "got obj type %d\n", obj_type); hr = IFont_put_Size(font, size); - ok_ole_success(hr, "put_Size"); + EXPECT_HR(hr, S_OK); /* put_Size doesn't cause the new font to be realized */ obj_type = GetObjectType(last_hfont); ok(obj_type == OBJ_FONT, "got obj type %d\n", obj_type); hr = IFont_get_hFont(font, &hfont); - ok_ole_success(hr, "get_hFont"); + EXPECT_HR(hr, S_OK); obj_type = GetObjectType(last_hfont); ok(obj_type == 0, "%d: got obj type %d\n", i, obj_type); @@ -891,20 +919,19 @@ until the font object is released */ for(i = 0; i < 100; i++) { - size.int64 = (i + 10) * 20000; obj_type = GetObjectType(hfont); ok(obj_type == OBJ_FONT, "got obj type %d\n", obj_type); hr = IFont_put_Size(font, size); - ok_ole_success(hr, "put_Size"); + EXPECT_HR(hr, S_OK); hr = IFont_get_hFont(font, &hfont); - ok_ole_success(hr, "get_hFont"); + EXPECT_HR(hr, S_OK); hr = IFont_AddRefHfont(font, hfont); - ok_ole_success(hr, "AddRefHfont"); + EXPECT_HR(hr, S_OK); if(i == 0) first_hfont = hfont; obj_type = GetObjectType(first_hfont); @@ -920,10 +947,10 @@ through re-realization */ hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&font); - ok_ole_success(hr, "OleCreateFontIndirect"); + EXPECT_HR(hr, S_OK); hr = IFont_get_hFont(font, &hfont); - ok_ole_success(hr, "get_hFont"); + EXPECT_HR(hr, S_OK); for(i = 0; i < 100; i++) { @@ -935,20 +962,20 @@ ok(obj_type == OBJ_FONT, "got obj type %d\n", obj_type); hr = IFont_put_Size(font, size); - ok_ole_success(hr, "put_Size"); + EXPECT_HR(hr, S_OK); /* put_Size doesn't cause the new font to be realized */ obj_type = GetObjectType(last_hfont); ok(obj_type == OBJ_FONT, "got obj type %d\n", obj_type); hr = IFont_get_hFont(font, &hfont); - ok_ole_success(hr, "get_hFont"); + EXPECT_HR(hr, S_OK); hr = IFont_AddRefHfont(font, hfont); - ok_ole_success(hr, "AddRefHfont"); + EXPECT_HR(hr, S_OK); hr = IFont_ReleaseHfont(font, hfont); - ok_ole_success(hr, "ReleaseHfont"); + EXPECT_HR(hr, S_OK); obj_type = GetObjectType(last_hfont); ok(obj_type == 0, "%d: got obj type %d\n", i, obj_type); @@ -965,13 +992,13 @@ ok(obj_type == OBJ_FONT, "got obj type %d\n", obj_type); hr = IFont_put_Size(font, size); - ok_ole_success(hr, "put_Size"); + EXPECT_HR(hr, S_OK); hr = IFont_get_hFont(font, &hfont); - ok_ole_success(hr, "get_hFont"); + EXPECT_HR(hr, S_OK); hr = IFont_ReleaseHfont(font, hfont); - ok_ole_success(hr, "ReleaseHfont"); + EXPECT_HR(hr, S_OK); if(i == 0) first_hfont = hfont; obj_type = GetObjectType(first_hfont); @@ -988,23 +1015,23 @@ that includes internal and external references */ hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&font); - ok_ole_success(hr, "OleCreateFontIndirect"); + EXPECT_HR(hr, S_OK); hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&font2); - ok_ole_success(hr, "OleCreateFontIndirect"); + EXPECT_HR(hr, S_OK); hr = IFont_get_hFont(font, &hfont); - ok_ole_success(hr, "get_hFont"); + EXPECT_HR(hr, S_OK); hr = IFont_get_hFont(font2, &first_hfont); - ok_ole_success(hr, "get_hFont"); + EXPECT_HR(hr, S_OK); todo_wine ok(hfont == first_hfont, "fonts differ\n"); hr = IFont_ReleaseHfont(font, hfont); - ok(hr == S_OK, "got %08x\n", hr); + EXPECT_HR(hr, S_OK); hr = IFont_ReleaseHfont(font, hfont); todo_wine - ok(hr == S_OK, "got %08x\n", hr); + EXPECT_HR(hr, S_OK); hr = IFont_ReleaseHfont(font, hfont); - ok(hr == S_FALSE, "got %08x\n", hr); + EXPECT_HR(hr, S_FALSE); obj_type = GetObjectType(hfont); ok(obj_type == OBJ_FONT, "got obj type %d\n", obj_type); @@ -1041,10 +1068,10 @@ fontdesc.fStrikethrough = FALSE; hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&font); - ok_ole_success(hr, "OleCreateFontIndirect"); + EXPECT_HR(hr, S_OK); hr = IFont_get_Charset(font, &cs); - ok_ole_success(hr, "get_Charset"); + EXPECT_HR(hr, S_OK); ok(cs == ANSI_CHARSET, "got charset %d\n", cs); IFont_Release(font); @@ -1054,62 +1081,86 @@ fontdesc.lpstrName = arial_font; hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&font); - ok_ole_success(hr, "OleCreateFontIndirect"); + EXPECT_HR(hr, S_OK); hr = IFont_get_Charset(font, &cs); - ok_ole_success(hr, "get_Charset"); + EXPECT_HR(hr, S_OK); ok(cs == ANSI_CHARSET, "got charset %d\n", cs); name = SysAllocString(marlett_font); hr = IFont_put_Name(font, name); - ok_ole_success(hr, "put_Name"); + EXPECT_HR(hr, S_OK); SysFreeString(name); hr = IFont_get_Name(font, &name); - ok_ole_success(hr, "get_Name"); + EXPECT_HR(hr, S_OK); ok(!lstrcmpiW(name, marlett_font), "got name %s\n", wine_dbgstr_w(name)); SysFreeString(name); hr = IFont_get_Charset(font, &cs); - ok_ole_success(hr, "get_Charset"); + EXPECT_HR(hr, S_OK); ok(cs == SYMBOL_CHARSET, "got charset %d\n", cs); IFont_Release(font); } +static void test_OleCreateFontIndirect(void) +{ + FONTDESC fontdesc; + IFont *font; + HRESULT hr; + + fontdesc.cbSizeofstruct = sizeof(fontdesc); + fontdesc.lpstrName = arial_font; + fontdesc.cySize.int64 = 12 * 10000; /* 12 pt */ + fontdesc.sWeight = FW_NORMAL; + fontdesc.sCharset = ANSI_CHARSET; + fontdesc.fItalic = FALSE; + fontdesc.fUnderline = FALSE; + fontdesc.fStrikethrough = FALSE; + + hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void**)&font); + EXPECT_HR(hr, S_OK); + IFont_Release(font); + + /* play with cbSizeofstruct value */ + fontdesc.cbSizeofstruct = sizeof(fontdesc)-1; + hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void**)&font); + EXPECT_HR(hr, S_OK); + IFont_Release(font); + + fontdesc.cbSizeofstruct = sizeof(fontdesc)+1; + hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void**)&font); + EXPECT_HR(hr, S_OK); + IFont_Release(font); + + fontdesc.cbSizeofstruct = 0; + hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void**)&font); + EXPECT_HR(hr, S_OK); + IFont_Release(font); +} + START_TEST(olefont) { - hOleaut32 = GetModuleHandleA("oleaut32.dll"); - pOleCreateFontIndirect = (void*)GetProcAddress(hOleaut32, "OleCreateFontIndirect"); - if (!pOleCreateFontIndirect) - { - win_skip("OleCreateFontIndirect not available\n"); - return; - } - - test_QueryInterface(); - test_type_info(); - - /* Test various size operations and conversions. */ - /* Add more as needed. */ - if (0) /* FIXME: failing tests */ - { - test_ifont_sizes(180000, 0, 72, 2540, -18, "default"); - test_ifont_sizes(180000, 0, 144, 2540, -36, "ratio1"); /* change ratio */ - test_ifont_sizes(180000, 0, 72, 1270, -36, "ratio2"); /* 2nd part of ratio */ - - /* These depend on details of how IFont rounds sizes internally. */ - test_ifont_sizes(0, 0, 72, 2540, 0, "zero size"); /* zero size */ - test_ifont_sizes(186000, 0, 72, 2540, -19, "rounding"); /* test rounding */ - } - - test_font_events_disp(); - test_GetIDsOfNames(); - test_Invoke(); - test_IsEqual(); - test_ReleaseHfont(); - test_AddRefHfont(); - test_returns(); - test_hfont_lifetime(); - test_realization(); -} + hOleaut32 = GetModuleHandleA("oleaut32.dll"); + pOleCreateFontIndirect = (void*)GetProcAddress(hOleaut32, "OleCreateFontIndirect"); + if (!pOleCreateFontIndirect) + { + win_skip("OleCreateFontIndirect not available\n"); + return; + } + + test_QueryInterface(); + test_type_info(); + test_ifont_sizes(); + test_font_events_disp(); + test_GetIDsOfNames(); + test_Invoke(); + test_IsEqual(); + test_ReleaseHfont(); + test_AddRefHfont(); + test_returns(); + test_hfont_lifetime(); + test_realization(); + test_OleCreateFontIndirect(); +} Modified: trunk/rostests/winetests/oleaut32/olepicture.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/oleaut32/olepic…
============================================================================== --- trunk/rostests/winetests/oleaut32/olepicture.c [iso-8859-1] (original) +++ trunk/rostests/winetests/oleaut32/olepicture.c [iso-8859-1] Wed Dec 12 13:53:12 2012 @@ -2,7 +2,7 @@ * OLEPICTURE test program * * Copyright 2005 Marcus Meissner - * + * Copyright 2012 Dmitry Timoshkov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,6 +25,7 @@ #include <float.h> #define COBJMACROS +#define CONST_VTABLE #define NONAMELESSUNION #include "wine/test.h" @@ -53,7 +54,7 @@ static HMODULE hOleaut32; static HRESULT (WINAPI *pOleLoadPicture)(LPSTREAM,LONG,BOOL,REFIID,LPVOID*); -static HRESULT (WINAPI *pOleCreatePictureIndirect)(PICTDESC*,REFIID,BOOL,LPVOID*); +static HRESULT (WINAPI *pOleLoadPictureEx)(LPSTREAM,LONG,BOOL,REFIID,DWORD,DWORD,DWORD,LPVOID*); #define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr) @@ -169,17 +170,17 @@ }; -struct NoStatStreamImpl -{ - const IStreamVtbl *lpVtbl; +typedef struct NoStatStreamImpl +{ + IStream IStream_iface; LONG ref; HGLOBAL supportHandle; ULARGE_INTEGER streamSize; ULARGE_INTEGER currentPosition; -}; -typedef struct NoStatStreamImpl NoStatStreamImpl; -static NoStatStreamImpl* NoStatStreamImpl_Construct(HGLOBAL hGlobal); +} NoStatStreamImpl; + +static IStream* NoStatStream_Construct(HGLOBAL hGlobal); static void test_pic_with_stream(LPSTREAM stream, unsigned int imgsize) @@ -219,7 +220,7 @@ if (handle) { BITMAP bmp; - GetObject((HGDIOBJ)handle, sizeof(BITMAP), &bmp); + GetObject(UlongToHandle(handle), sizeof(BITMAP), &bmp); todo_wine ok(bmp.bmBits != 0, "not a dib\n"); } @@ -282,7 +283,7 @@ IStream_Release(stream); /* again with Non Statable and Non Seekable stream */ - stream = (LPSTREAM)NoStatStreamImpl_Construct(hglob); + stream = NoStatStream_Construct(hglob); hglob = 0; /* Non-statable impl always deletes on release */ test_pic_with_stream(stream, 0); @@ -313,7 +314,7 @@ IStream_Release(stream); /* again with Non Statable and Non Seekable stream */ - stream = (LPSTREAM)NoStatStreamImpl_Construct(hglob); + stream = NoStatStream_Construct(hglob); hglob = 0; /* Non-statable impl always deletes on release */ test_pic_with_stream(stream, 0); @@ -481,24 +482,26 @@ static void test_OleCreatePictureIndirect(void) { + OLE_HANDLE handle; IPicture *pict; HRESULT hr; short type; - OLE_HANDLE handle; - - if(!pOleCreatePictureIndirect) - { - win_skip("Skipping OleCreatePictureIndirect tests\n"); - return; - } - - hr = pOleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, (void**)&pict); + +if (0) +{ + /* crashes on native */ + OleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, NULL); +} + + hr = OleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, (void**)&pict); ok(hr == S_OK, "hr %08x\n", hr); + type = PICTYPE_NONE; hr = IPicture_get_Type(pict, &type); ok(hr == S_OK, "hr %08x\n", hr); ok(type == PICTYPE_UNINITIALIZED, "type %d\n", type); + handle = 0xdeadbeef; hr = IPicture_get_Handle(pict, &handle); ok(hr == S_OK, "hr %08x\n", hr); ok(handle == 0, "handle %08x\n", handle); @@ -518,7 +521,7 @@ short type; if(!winetest_interactive) { - skip("Bug 5000: oleaut_winetest:olepicture crashes with Page Fault.\n"); + skip("ROSTESTS-2: oleaut_winetest:olepicture crashes with Page Fault.\n"); return; } @@ -527,7 +530,7 @@ memcpy(data, apmdata, sizeof(apmdata)); ole_check(CreateStreamOnHGlobal(hglob, TRUE, &stream)); - ole_check(OleLoadPictureEx(stream, sizeof(apmdata), TRUE, &IID_IPicture, 100, 100, 0, (LPVOID *)&pict)); + ole_check(pOleLoadPictureEx(stream, sizeof(apmdata), TRUE, &IID_IPicture, 100, 100, 0, (LPVOID *)&pict)); ole_check(IPicture_get_Handle(pict, &handle)); ok(handle != 0, "handle is null\n"); @@ -562,7 +565,7 @@ ole_check(CreateStreamOnHGlobal(hglob, TRUE, &stream)); /* Windows does not load simple metafiles */ - ole_expect(OleLoadPictureEx(stream, sizeof(metafile), TRUE, &IID_IPicture, 100, 100, 0, (LPVOID *)&pict), E_FAIL); + ole_expect(pOleLoadPictureEx(stream, sizeof(metafile), TRUE, &IID_IPicture, 100, 100, 0, (LPVOID *)&pict), E_FAIL); IStream_Release(stream); } @@ -579,7 +582,7 @@ short type; if(!winetest_interactive) { - skip("Bug 5000: oleaut_winetest:olepicture crashes with Page Fault.\n"); + skip("ROSTESTS-2: oleaut_winetest:olepicture crashes with Page Fault.\n"); return; } @@ -588,7 +591,7 @@ memcpy(data, enhmetafile, sizeof(enhmetafile)); ole_check(CreateStreamOnHGlobal(hglob, TRUE, &stream)); - ole_check(OleLoadPictureEx(stream, sizeof(enhmetafile), TRUE, &IID_IPicture, 10, 10, 0, (LPVOID *)&pict)); + ole_check(pOleLoadPictureEx(stream, sizeof(enhmetafile), TRUE, &IID_IPicture, 10, 10, 0, (LPVOID *)&pict)); ole_check(IPicture_get_Handle(pict, &handle)); ok(handle != 0, "handle is null\n"); @@ -675,9 +678,9 @@ IPicture_get_Width(pic, &pWidth); IPicture_get_Height(pic, &pHeight); - SetPixelV(hdc, 0, 0, 0x00F0F0F0); - SetPixelV(hdc, 5, 5, 0x00F0F0F0); - SetPixelV(hdc, 10, 10, 0x00F0F0F0); + SetPixelV(hdc, 0, 0, 0x00223344); + SetPixelV(hdc, 5, 5, 0x00223344); + SetPixelV(hdc, 10, 10, 0x00223344); expected = GetPixel(hdc, 0, 0); hres = IPicture_Render(pic, hdc, 1, 1, 9, 9, 0, 0, pWidth, -pHeight, NULL); @@ -800,9 +803,8 @@ hres = OleLoadPicturePath(emptyW, NULL, 0, 0, NULL, (void **)&pic); todo_wine ok(hres == INET_E_UNKNOWN_PROTOCOL || /* XP/Vista+ */ - hres == E_UNEXPECTED || /* NT4/Win95 */ - hres == E_FAIL || /* Win95 OSR2 */ - hres == E_OUTOFMEMORY, /* Win98/Win2k/Win2k3 */ + broken(hres == E_UNEXPECTED) || /* NT4 */ + broken(hres == E_OUTOFMEMORY), /* Win2k/Win2k3 */ "Expected OleLoadPicturePath to return INET_E_UNKNOWN_PROTOCOL, got 0x%08x\n", hres); ok(pic == NULL, "Expected the output interface pointer to be NULL, got %p\n", pic); @@ -811,9 +813,8 @@ hres = OleLoadPicturePath(emptyW, NULL, 0, 0, &IID_IPicture, (void **)&pic); todo_wine ok(hres == INET_E_UNKNOWN_PROTOCOL || /* XP/Vista+ */ - hres == E_UNEXPECTED || /* NT4/Win95 */ - hres == E_FAIL || /* Win95 OSR2 */ - hres == E_OUTOFMEMORY, /* Win98/Win2k/Win2k3 */ + broken(hres == E_UNEXPECTED) || /* NT4 */ + broken(hres == E_OUTOFMEMORY), /* Win2k/Win2k3 */ "Expected OleLoadPicturePath to return INET_E_UNKNOWN_PROTOCOL, got 0x%08x\n", hres); ok(pic == NULL, "Expected the output interface pointer to be NULL, got %p\n", pic); @@ -831,7 +832,7 @@ /* Try a normal DOS path. */ hres = OleLoadPicturePath(temp_fileW + 8, NULL, 0, 0, &IID_IPicture, (void **)&pic); ok(hres == S_OK || - broken(hres == E_UNEXPECTED), /* NT4/Win95 */ + broken(hres == E_UNEXPECTED), /* NT4 */ "Expected OleLoadPicturePath to return S_OK, got 0x%08x\n", hres); if (pic) IPicture_Release(pic); @@ -839,7 +840,7 @@ /* Try a DOS path with tacked on "file:". */ hres = OleLoadPicturePath(temp_fileW, NULL, 0, 0, &IID_IPicture, (void **)&pic); ok(hres == S_OK || - broken(hres == E_UNEXPECTED), /* NT4/Win95 */ + broken(hres == E_UNEXPECTED), /* NT4 */ "Expected OleLoadPicturePath to return S_OK, got 0x%08x\n", hres); if (pic) IPicture_Release(pic); @@ -849,14 +850,14 @@ /* Try with a nonexistent file. */ hres = OleLoadPicturePath(temp_fileW + 8, NULL, 0, 0, &IID_IPicture, (void **)&pic); ok(hres == INET_E_RESOURCE_NOT_FOUND || /* XP+ */ - hres == E_UNEXPECTED || /* NT4/Win95 */ - hres == E_FAIL, /* Win9x/Win2k */ + broken(hres == E_UNEXPECTED) || /* NT4 */ + broken(hres == E_FAIL), /*Win2k */ "Expected OleLoadPicturePath to return INET_E_RESOURCE_NOT_FOUND, got 0x%08x\n", hres); hres = OleLoadPicturePath(temp_fileW, NULL, 0, 0, &IID_IPicture, (void **)&pic); ok(hres == INET_E_RESOURCE_NOT_FOUND || /* XP+ */ - hres == E_UNEXPECTED || /* NT4/Win95 */ - hres == E_FAIL, /* Win9x/Win2k */ + broken(hres == E_UNEXPECTED) || /* NT4 */ + broken(hres == E_FAIL), /* Win2k */ "Expected OleLoadPicturePath to return INET_E_RESOURCE_NOT_FOUND, got 0x%08x\n", hres); file = CreateFileA(temp_file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, @@ -875,7 +876,7 @@ hres = OleLoadPicturePath(temp_fileW, NULL, 0, 0, &IID_IPicture, (void **)&pic); ok(hres == S_OK || - broken(hres == E_UNEXPECTED), /* NT4/Win95 */ + broken(hres == E_UNEXPECTED), /* NT4 */ "Expected OleLoadPicturePath to return S_OK, got 0x%08x\n", hres); if (pic) IPicture_Release(pic); @@ -885,35 +886,267 @@ /* Try with a nonexistent file. */ hres = OleLoadPicturePath(temp_fileW, NULL, 0, 0, &IID_IPicture, (void **)&pic); ok(hres == INET_E_RESOURCE_NOT_FOUND || /* XP+ */ - hres == E_UNEXPECTED || /* NT4/Win95 */ - hres == E_FAIL, /* Win9x/Win2k */ + broken(hres == E_UNEXPECTED) || /* NT4 */ + broken(hres == E_FAIL), /* Win2k */ "Expected OleLoadPicturePath to return INET_E_RESOURCE_NOT_FOUND, got 0x%08x\n", hres); } +static void test_himetric(void) +{ + static const BYTE bmp_bits[1024]; + OLE_XSIZE_HIMETRIC cx; + OLE_YSIZE_HIMETRIC cy; + IPicture *pic; + PICTDESC desc; + HBITMAP bmp; + HRESULT hr; + HICON icon; + HDC hdc; + INT d; + + desc.cbSizeofstruct = sizeof(desc); + desc.picType = PICTYPE_BITMAP; + desc.u.bmp.hpal = NULL; + + hdc = CreateCompatibleDC(0); + + bmp = CreateBitmap(1.9 * GetDeviceCaps(hdc, LOGPIXELSX), + 1.9 * GetDeviceCaps(hdc, LOGPIXELSY), 1, 1, NULL); + + desc.u.bmp.hbitmap = bmp; + + /* size in himetric units reported rounded up to next integer value */ + hr = OleCreatePictureIndirect(&desc, &IID_IPicture, FALSE, (void**)&pic); + ok(hr == S_OK, "got 0x%08x\n", hr); + + cx = 0; + d = MulDiv((INT)(1.9 * GetDeviceCaps(hdc, LOGPIXELSX)), 2540, GetDeviceCaps(hdc, LOGPIXELSX)); + hr = IPicture_get_Width(pic, &cx); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(cx == d, "got %d, expected %d\n", cx, d); + + cy = 0; + d = MulDiv((INT)(1.9 * GetDeviceCaps(hdc, LOGPIXELSY)), 2540, GetDeviceCaps(hdc, LOGPIXELSY)); + hr = IPicture_get_Height(pic, &cy); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(cy == d, "got %d, expected %d\n", cy, d); + + DeleteObject(bmp); + IPicture_Release(pic); + + /* same thing with icon */ + icon = CreateIcon(NULL, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), + 1, 1, bmp_bits, bmp_bits); + ok(icon != NULL, "failed to create icon\n"); + + desc.picType = PICTYPE_ICON; + desc.u.icon.hicon = icon; + + hr = OleCreatePictureIndirect(&desc, &IID_IPicture, FALSE, (void**)&pic); + ok(hr == S_OK, "got 0x%08x\n", hr); + + cx = 0; + d = MulDiv(GetSystemMetrics(SM_CXICON), 2540, GetDeviceCaps(hdc, LOGPIXELSX)); + hr = IPicture_get_Width(pic, &cx); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(cx == d, "got %d, expected %d\n", cx, d); + + cy = 0; + d = MulDiv(GetSystemMetrics(SM_CYICON), 2540, GetDeviceCaps(hdc, LOGPIXELSY)); + hr = IPicture_get_Height(pic, &cy); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(cy == d, "got %d, expected %d\n", cy, d); + + IPicture_Release(pic); + DestroyIcon(icon); + + DeleteDC(hdc); +} + +static void test_load_save_bmp(void) +{ + IPicture *pic; + PICTDESC desc; + short type; + OLE_HANDLE handle; + HGLOBAL hmem; + DWORD *mem; + IPersistStream *src_stream; + IStream *dst_stream; + HRESULT hr; + + desc.cbSizeofstruct = sizeof(desc); + desc.picType = PICTYPE_BITMAP; + desc.u.bmp.hpal = 0; + desc.u.bmp.hbitmap = CreateBitmap(1, 1, 1, 1, NULL); + hr = OleCreatePictureIndirect(&desc, &IID_IPicture, FALSE, (void**)&pic); + ok(hr == S_OK, "OleCreatePictureIndirect error %#x\n", hr); + + type = -1; + hr = IPicture_get_Type(pic, &type); + ok(hr == S_OK,"get_Type error %#8x\n", hr); + ok(type == PICTYPE_BITMAP,"expected picture type PICTYPE_BITMAP, got %d\n", type); + + hr = IPicture_get_Handle(pic, &handle); + ok(hr == S_OK,"get_Handle error %#8x\n", hr); + ok(IntToPtr(handle) == desc.u.bmp.hbitmap, "get_Handle returned wrong handle %#x\n", handle); + + hmem = GlobalAlloc(GMEM_ZEROINIT, 4096); + hr = CreateStreamOnHGlobal(hmem, FALSE, &dst_stream); + ok(hr == S_OK, "createstreamonhglobal error %#x\n", hr); + + hr = IPicture_QueryInterface(pic, &IID_IPersistStream, (void **)&src_stream); + ok(hr == S_OK, "QueryInterface error %#x\n", hr); + + hr = IPersistStream_Save(src_stream, dst_stream, TRUE); + ok(hr == S_OK, "Save error %#x\n", hr); + + IPersistStream_Release(src_stream); + IStream_Release(dst_stream); + + mem = GlobalLock(hmem); + ok(!memcmp(mem, "lt\0\0", 4), "got wrong stream header %04x\n", mem[0]); + ok(mem[1] == 66, "expected stream size 66, got %u\n", mem[1]); + ok(!memcmp(&mem[2], "BM", 2), "got wrong bmp header %04x\n", mem[2]); + + GlobalUnlock(hmem); + GlobalFree(hmem); + + DeleteObject(desc.u.bmp.hbitmap); + IPicture_Release(pic); +} + +static void test_load_save_icon(void) +{ + IPicture *pic; + PICTDESC desc; + short type; + OLE_HANDLE handle; + HGLOBAL hmem; + DWORD *mem; + IPersistStream *src_stream; + IStream *dst_stream; + HRESULT hr; + + desc.cbSizeofstruct = sizeof(desc); + desc.picType = PICTYPE_ICON; + desc.u.icon.hicon = LoadIcon(0, IDI_APPLICATION); + hr = OleCreatePictureIndirect(&desc, &IID_IPicture, FALSE, (void**)&pic); + ok(hr == S_OK, "OleCreatePictureIndirect error %#x\n", hr); + + type = -1; + hr = IPicture_get_Type(pic, &type); + ok(hr == S_OK,"get_Type error %#8x\n", hr); + ok(type == PICTYPE_ICON,"expected picture type PICTYPE_ICON, got %d\n", type); + + hr = IPicture_get_Handle(pic, &handle); + ok(hr == S_OK,"get_Handle error %#8x\n", hr); + ok(IntToPtr(handle) == desc.u.icon.hicon, "get_Handle returned wrong handle %#x\n", handle); + + hmem = GlobalAlloc(GMEM_ZEROINIT, 8192); + hr = CreateStreamOnHGlobal(hmem, FALSE, &dst_stream); + ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr); + + hr = IPicture_QueryInterface(pic, &IID_IPersistStream, (void **)&src_stream); + ok(hr == S_OK, "QueryInterface error %#x\n", hr); + + hr = IPersistStream_Save(src_stream, dst_stream, TRUE); + ok(hr == S_OK, "Saveerror %#x\n", hr); + + IPersistStream_Release(src_stream); + IStream_Release(dst_stream); + + mem = GlobalLock(hmem); + ok(!memcmp(mem, "lt\0\0", 4), "got wrong stream header %04x\n", mem[0]); +todo_wine + ok(mem[1] == 766, "expected stream size 766, got %u\n", mem[1]); + ok(mem[2] == 0x00010000, "got wrong icon header %04x\n", mem[2]); + + GlobalUnlock(hmem); + GlobalFree(hmem); + + DestroyIcon(desc.u.icon.hicon); + IPicture_Release(pic); +} + +static void test_load_save_empty_picture(void) +{ + IPicture *pic; + PICTDESC desc; + short type; + OLE_HANDLE handle; + HGLOBAL hmem; + DWORD *mem; + IPersistStream *src_stream; + IStream *dst_stream; + HRESULT hr; + + memset(&pic, 0, sizeof(pic)); + desc.cbSizeofstruct = sizeof(desc); + desc.picType = PICTYPE_NONE; + hr = OleCreatePictureIndirect(&desc, &IID_IPicture, FALSE, (void **)&pic); + ok(hr == S_OK, "OleCreatePictureIndirect error %#x\n", hr); + + type = -1; + hr = IPicture_get_Type(pic, &type); + ok(hr == S_OK,"get_Type error %#8x\n", hr); + ok(type == PICTYPE_NONE,"expected picture type PICTYPE_NONE, got %d\n", type); + + handle = (OLE_HANDLE)0xdeadbeef; + hr = IPicture_get_Handle(pic, &handle); + ok(hr == S_OK,"get_Handle error %#8x\n", hr); + ok(!handle, "get_Handle returned wrong handle %#x\n", handle); + + hmem = GlobalAlloc(GMEM_ZEROINIT, 4096); + hr = CreateStreamOnHGlobal(hmem, FALSE, &dst_stream); + ok(hr == S_OK, "createstreamonhglobal error %#x\n", hr); + + hr = IPicture_QueryInterface(pic, &IID_IPersistStream, (void **)&src_stream); + ok(hr == S_OK, "QueryInterface error %#x\n", hr); + + hr = IPersistStream_Save(src_stream, dst_stream, TRUE); + ok(hr == S_OK, "Save error %#x\n", hr); + + mem = GlobalLock(hmem); + ok(!memcmp(mem, "lt\0\0", 4), "got wrong stream header %04x\n", mem[0]); + ok(mem[1] == 0, "expected stream size 0, got %u\n", mem[1]); + GlobalUnlock(hmem); + + IPersistStream_Release(src_stream); + IStream_Release(dst_stream); + + GlobalFree(hmem); + IPicture_Release(pic); +} + START_TEST(olepicture) { - hOleaut32 = GetModuleHandleA("oleaut32.dll"); - pOleLoadPicture = (void*)GetProcAddress(hOleaut32, "OleLoadPicture"); - pOleCreatePictureIndirect = (void*)GetProcAddress(hOleaut32, "OleCreatePictureIndirect"); - if (!pOleLoadPicture) - { - win_skip("OleLoadPicture is not available\n"); - return; - } - - /* Test regular 1x1 pixel images of gif, jpg, bmp type */ - test_pic(gifimage, sizeof(gifimage)); - test_pic(jpgimage, sizeof(jpgimage)); - test_pic(bmpimage, sizeof(bmpimage)); - test_pic(gif4pixel, sizeof(gif4pixel)); - /* FIXME: No PNG support in Windows... */ - if (0) test_pic(pngimage, sizeof(pngimage)); - test_empty_image(); - test_empty_image_2(); + hOleaut32 = GetModuleHandleA("oleaut32.dll"); + pOleLoadPicture = (void*)GetProcAddress(hOleaut32, "OleLoadPicture"); + pOleLoadPictureEx = (void*)GetProcAddress(hOleaut32, "OleLoadPictureEx"); + if (!pOleLoadPicture) + { + win_skip("OleLoadPicture is not available\n"); + return; + } + + /* Test regular 1x1 pixel images of gif, jpg, bmp type */ + test_pic(gifimage, sizeof(gifimage)); + test_pic(jpgimage, sizeof(jpgimage)); + test_pic(bmpimage, sizeof(bmpimage)); + test_pic(gif4pixel, sizeof(gif4pixel)); + /* FIXME: No PNG support in Windows... */ + if (0) test_pic(pngimage, sizeof(pngimage)); + test_empty_image(); + test_empty_image_2(); + if (pOleLoadPictureEx) + { test_apm(); test_metafile(); test_enhmetafile(); - + } + else + win_skip("OleLoadPictureEx is not available\n"); test_Invoke(); test_OleCreatePictureIndirect(); test_Render(); @@ -921,11 +1154,20 @@ test_get_Handle(); test_get_Type(); test_OleLoadPicturePath(); + test_himetric(); + test_load_save_bmp(); + test_load_save_icon(); + test_load_save_empty_picture(); } /* Helper functions only ... */ + +static inline NoStatStreamImpl *impl_from_IStream(IStream *iface) +{ + return CONTAINING_RECORD(iface, NoStatStreamImpl, IStream_iface); +} static void NoStatStreamImpl_Destroy(NoStatStreamImpl* This) { @@ -937,7 +1179,7 @@ static ULONG WINAPI NoStatStreamImpl_AddRef( IStream* iface) { - NoStatStreamImpl* const This=(NoStatStreamImpl*)iface; + NoStatStreamImpl* const This = impl_from_IStream(iface); return InterlockedIncrement(&This->ref); } @@ -946,7 +1188,7 @@ REFIID riid, /* [in] */ void** ppvObject) /* [iid_is][out] */ { - NoStatStreamImpl* const This=(NoStatStreamImpl*)iface; + NoStatStreamImpl* const This = impl_from_IStream(iface); if (ppvObject==0) return E_INVALIDARG; *ppvObject = 0; if (IsEqualIID(&IID_IUnknown, riid)) @@ -967,7 +1209,7 @@ static ULONG WINAPI NoStatStreamImpl_Release( IStream* iface) { - NoStatStreamImpl* const This=(NoStatStreamImpl*)iface; + NoStatStreamImpl* const This = impl_from_IStream(iface); ULONG newRef = InterlockedDecrement(&This->ref); if (newRef==0) NoStatStreamImpl_Destroy(This); @@ -980,7 +1222,7 @@ ULONG cb, /* [in] */ ULONG* pcbRead) /* [out] */ { - NoStatStreamImpl* const This=(NoStatStreamImpl*)iface; + NoStatStreamImpl* const This = impl_from_IStream(iface); void* supportBuffer; ULONG bytesReadBuffer; ULONG bytesToReadFromBuffer; @@ -1004,7 +1246,7 @@ ULONG cb, /* [in] */ ULONG* pcbWritten) /* [out] */ { - NoStatStreamImpl* const This=(NoStatStreamImpl*)iface; + NoStatStreamImpl* const This = impl_from_IStream(iface); void* supportBuffer; ULARGE_INTEGER newSize; ULONG bytesWritten = 0; @@ -1032,7 +1274,7 @@ DWORD dwOrigin, /* [in] */ ULARGE_INTEGER* plibNewPosition) /* [out] */ { - NoStatStreamImpl* const This=(NoStatStreamImpl*)iface; + NoStatStreamImpl* const This = impl_from_IStream(iface); ULARGE_INTEGER newPosition; switch (dwOrigin) { @@ -1061,7 +1303,7 @@ IStream* iface, ULARGE_INTEGER libNewSize) /* [in] */ { - NoStatStreamImpl* const This=(NoStatStreamImpl*)iface; + NoStatStreamImpl* const This = impl_from_IStream(iface); HGLOBAL supportHandle; if (libNewSize.u.HighPart != 0) return STG_E_INVALIDFUNCTION; @@ -1174,14 +1416,14 @@ In any case the object takes ownership of memory handle and will free it on object release. */ -static NoStatStreamImpl* NoStatStreamImpl_Construct(HGLOBAL hGlobal) +static IStream* NoStatStream_Construct(HGLOBAL hGlobal) { NoStatStreamImpl* newStream; newStream = HeapAlloc(GetProcessHeap(), 0, sizeof(NoStatStreamImpl)); if (newStream!=0) { - newStream->lpVtbl = &NoStatStreamImpl_Vtbl; + newStream->IStream_iface.lpVtbl = &NoStatStreamImpl_Vtbl; newStream->ref = 1; newStream->supportHandle = hGlobal; @@ -1193,7 +1435,7 @@ newStream->streamSize.u.HighPart = 0; newStream->streamSize.u.LowPart = GlobalSize(newStream->supportHandle); } - return newStream; + return &newStream->IStream_iface; }
12 years
1
0
0
0
[akhaldi] 57889: [OLEAUT32] * Sync to Wine 1.5.19.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Dec 12 13:52:25 2012 New Revision: 57889 URL:
http://svn.reactos.org/svn/reactos?rev=57889&view=rev
Log: [OLEAUT32] * Sync to Wine 1.5.19. Added: trunk/reactos/dll/win32/oleaut32/oleaut32.rgs (with props) trunk/reactos/dll/win32/oleaut32/oleaut32_oaidl.rgs (with props) trunk/reactos/dll/win32/oleaut32/oleaut32_ocidl.rgs (with props) trunk/reactos/dll/win32/oleaut32/olepropframe.c (with props) Removed: trunk/reactos/dll/win32/oleaut32/regsvr.c trunk/reactos/dll/win32/oleaut32/stubs.c trunk/reactos/dll/win32/oleaut32/ungif.c trunk/reactos/dll/win32/oleaut32/ungif.h trunk/reactos/dll/win32/oleaut32/version.rc Modified: trunk/reactos/dll/win32/oleaut32/CMakeLists.txt trunk/reactos/dll/win32/oleaut32/connpt.c trunk/reactos/dll/win32/oleaut32/dispatch.c trunk/reactos/dll/win32/oleaut32/oleaut.c trunk/reactos/dll/win32/oleaut32/oleaut32.rc trunk/reactos/dll/win32/oleaut32/oleaut32_oaidl.idl trunk/reactos/dll/win32/oleaut32/oleaut32_ocidl.idl trunk/reactos/dll/win32/oleaut32/olefont.c trunk/reactos/dll/win32/oleaut32/olepicture.c trunk/reactos/dll/win32/oleaut32/recinfo.c trunk/reactos/dll/win32/oleaut32/safearray.c trunk/reactos/dll/win32/oleaut32/tmarshal.c trunk/reactos/dll/win32/oleaut32/typelib.c trunk/reactos/dll/win32/oleaut32/typelib.h trunk/reactos/dll/win32/oleaut32/typelib2.c trunk/reactos/dll/win32/oleaut32/usrmarshal.c trunk/reactos/dll/win32/oleaut32/varformat.c trunk/reactos/dll/win32/oleaut32/variant.c trunk/reactos/dll/win32/oleaut32/vartype.c trunk/reactos/media/doc/README.WINE [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/dll/win32/oleaut32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/CMakeLi…
Modified: trunk/reactos/dll/win32/oleaut32/connpt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/connpt.…
Modified: trunk/reactos/dll/win32/oleaut32/dispatch.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/dispatc…
Modified: trunk/reactos/dll/win32/oleaut32/oleaut.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/oleaut.…
Modified: trunk/reactos/dll/win32/oleaut32/oleaut32.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/oleaut3…
Added: trunk/reactos/dll/win32/oleaut32/oleaut32.rgs URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/oleaut3…
Modified: trunk/reactos/dll/win32/oleaut32/oleaut32_oaidl.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/oleaut3…
Added: trunk/reactos/dll/win32/oleaut32/oleaut32_oaidl.rgs URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/oleaut3…
Modified: trunk/reactos/dll/win32/oleaut32/oleaut32_ocidl.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/oleaut3…
Added: trunk/reactos/dll/win32/oleaut32/oleaut32_ocidl.rgs URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/oleaut3…
Modified: trunk/reactos/dll/win32/oleaut32/olefont.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/olefont…
Modified: trunk/reactos/dll/win32/oleaut32/olepicture.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/olepict…
Added: trunk/reactos/dll/win32/oleaut32/olepropframe.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/oleprop…
Modified: trunk/reactos/dll/win32/oleaut32/recinfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/recinfo…
Removed: trunk/reactos/dll/win32/oleaut32/regsvr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/regsvr.…
Modified: trunk/reactos/dll/win32/oleaut32/safearray.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/safearr…
Removed: trunk/reactos/dll/win32/oleaut32/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/stubs.c…
Modified: trunk/reactos/dll/win32/oleaut32/tmarshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/tmarsha…
Modified: trunk/reactos/dll/win32/oleaut32/typelib.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/typelib…
Modified: trunk/reactos/dll/win32/oleaut32/typelib.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/typelib…
Modified: trunk/reactos/dll/win32/oleaut32/typelib2.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/typelib…
Removed: trunk/reactos/dll/win32/oleaut32/ungif.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/ungif.c…
Removed: trunk/reactos/dll/win32/oleaut32/ungif.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/ungif.h…
Modified: trunk/reactos/dll/win32/oleaut32/usrmarshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/usrmars…
Modified: trunk/reactos/dll/win32/oleaut32/varformat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/varform…
Modified: trunk/reactos/dll/win32/oleaut32/variant.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/variant…
Modified: trunk/reactos/dll/win32/oleaut32/vartype.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/vartype…
Removed: trunk/reactos/dll/win32/oleaut32/version.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/version…
Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
12 years
1
0
0
0
[akhaldi] 57888: [ATL_WINETEST] * Sync with Wine 1.5.19.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Dec 12 12:55:58 2012 New Revision: 57888 URL:
http://svn.reactos.org/svn/reactos?rev=57888&view=rev
Log: [ATL_WINETEST] * Sync with Wine 1.5.19. Modified: trunk/rostests/winetests/atl/registrar.c Modified: trunk/rostests/winetests/atl/registrar.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/atl/registrar.c…
============================================================================== --- trunk/rostests/winetests/atl/registrar.c [iso-8859-1] (original) +++ trunk/rostests/winetests/atl/registrar.c [iso-8859-1] Wed Dec 12 12:55:58 2012 @@ -135,11 +135,23 @@ IRegistrar_Release(registrar); } +static void test_aggregation(void) +{ + IUnknown *unk = (IUnknown*)0xdeadbeef; + HRESULT hres; + + hres = CoCreateInstance(&CLSID_Registrar, (IUnknown*)0xdeadbeef, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, + &IID_IUnknown, (void**)&unk); + ok(hres == CLASS_E_NOAGGREGATION, "CoCreateInstance failed: %08x, expected CLASS_E_NOAGGREGATION\n", hres); + ok(!unk, "unk = %p\n", unk); +} + START_TEST(registrar) { CoInitialize(NULL); test_registrar(); + test_aggregation(); CoUninitialize(); }
12 years
1
0
0
0
[akhaldi] 57887: [ATL] * Sync with Wine 1.5.19. [ATL100] * Import from Wine 1.5.19.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Dec 12 12:48:52 2012 New Revision: 57887 URL:
http://svn.reactos.org/svn/reactos?rev=57887&view=rev
Log: [ATL] * Sync with Wine 1.5.19. [ATL100] * Import from Wine 1.5.19. Added: trunk/reactos/dll/win32/atl/atl_classes.idl (with props) trunk/reactos/dll/win32/atl100/ (with props) trunk/reactos/dll/win32/atl100/CMakeLists.txt (with props) trunk/reactos/dll/win32/atl100/atl.c (with props) trunk/reactos/dll/win32/atl100/atl100.spec (with props) trunk/reactos/dll/win32/atl100/atl_ax.c (with props) trunk/reactos/dll/win32/atl100/registrar.c (with props) trunk/reactos/include/reactos/wine/atlbase.h (with props) trunk/reactos/include/reactos/wine/atlwin.h (with props) Removed: trunk/reactos/dll/win32/atl/atl_ax.c trunk/reactos/dll/win32/atl/atlbase.h trunk/reactos/dll/win32/atl/atliface.idl trunk/reactos/dll/win32/atl/atlwin.h trunk/reactos/dll/win32/atl/stubs.c Modified: trunk/reactos/dll/win32/CMakeLists.txt trunk/reactos/dll/win32/atl/CMakeLists.txt trunk/reactos/dll/win32/atl/atl.rgs trunk/reactos/dll/win32/atl/atl.spec trunk/reactos/dll/win32/atl/atl_main.c trunk/reactos/dll/win32/atl/registrar.c trunk/reactos/dll/win32/atl/rsrc.rc trunk/reactos/include/psdk/atliface.idl trunk/reactos/media/doc/README.WINE [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/dll/win32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/CMakeLists.txt?r…
Modified: trunk/reactos/dll/win32/atl/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/CMakeLists.t…
Modified: trunk/reactos/dll/win32/atl/atl.rgs URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/atl.rgs?rev=…
Modified: trunk/reactos/dll/win32/atl/atl.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/atl.spec?rev…
Removed: trunk/reactos/dll/win32/atl/atl_ax.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/atl_ax.c?rev…
Added: trunk/reactos/dll/win32/atl/atl_classes.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/atl_classes.…
Modified: trunk/reactos/dll/win32/atl/atl_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/atl_main.c?r…
Removed: trunk/reactos/dll/win32/atl/atlbase.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/atlbase.h?re…
Removed: trunk/reactos/dll/win32/atl/atliface.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/atliface.idl…
Removed: trunk/reactos/dll/win32/atl/atlwin.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/atlwin.h?rev…
Modified: trunk/reactos/dll/win32/atl/registrar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/registrar.c?…
Modified: trunk/reactos/dll/win32/atl/rsrc.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/rsrc.rc?rev=…
Removed: trunk/reactos/dll/win32/atl/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/stubs.c?rev=…
Added: trunk/reactos/dll/win32/atl100/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl100/CMakeList…
Added: trunk/reactos/dll/win32/atl100/atl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl100/atl.c?rev…
Added: trunk/reactos/dll/win32/atl100/atl100.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl100/atl100.sp…
Added: trunk/reactos/dll/win32/atl100/atl_ax.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl100/atl_ax.c?…
Added: trunk/reactos/dll/win32/atl100/registrar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl100/registrar…
Modified: trunk/reactos/include/psdk/atliface.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/atliface.idl?…
Added: trunk/reactos/include/reactos/wine/atlbase.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/atlba…
Added: trunk/reactos/include/reactos/wine/atlwin.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/atlwi…
Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
12 years
1
0
0
0
[akhaldi] 57886: [SHELL32] * Remove unneeded config.h inclusion. * Remove an unneeded include dir.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Dec 12 12:20:26 2012 New Revision: 57886 URL:
http://svn.reactos.org/svn/reactos?rev=57886&view=rev
Log: [SHELL32] * Remove unneeded config.h inclusion. * Remove an unneeded include dir. Modified: trunk/reactos/dll/win32/shell32/CMakeLists.txt trunk/reactos/dll/win32/shell32/precomp.h Modified: trunk/reactos/dll/win32/shell32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CMakeLis…
============================================================================== --- trunk/reactos/dll/win32/shell32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/CMakeLists.txt [iso-8859-1] Wed Dec 12 12:20:26 2012 @@ -9,7 +9,6 @@ -D_WINE) include_directories( - ${REACTOS_SOURCE_DIR}/include/reactos/wine ${REACTOS_SOURCE_DIR}/lib/recyclebin ${REACTOS_SOURCE_DIR}/lib/atl ${REACTOS_SOURCE_DIR}) Modified: trunk/reactos/dll/win32/shell32/precomp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/precomp.…
============================================================================== --- trunk/reactos/dll/win32/shell32/precomp.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/precomp.h [iso-8859-1] Wed Dec 12 12:20:26 2012 @@ -1,7 +1,5 @@ #ifndef _PRECOMP_H__ #define _PRECOMP_H__ - -#include "config.h" #include <stdarg.h> #include <stdlib.h>
12 years
1
0
0
0
[akhaldi] 57885: [BROWSEUI] * Remove an unneeded include dir.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Dec 12 12:14:41 2012 New Revision: 57885 URL:
http://svn.reactos.org/svn/reactos?rev=57885&view=rev
Log: [BROWSEUI] * Remove an unneeded include dir. Modified: trunk/reactos/dll/win32/browseui/CMakeLists.txt Modified: trunk/reactos/dll/win32/browseui/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/browseui/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/CMakeLists.txt [iso-8859-1] Wed Dec 12 12:14:41 2012 @@ -12,11 +12,7 @@ remove_definitions(-D_WIN32_WINNT=0x502) add_definitions(-D_WIN32_WINNT=0x600) -include_directories( - ${REACTOS_SOURCE_DIR}/include/reactos/wine - ${REACTOS_SOURCE_DIR}/lib/atl) - -set_rc_compiler() +include_directories(${REACTOS_SOURCE_DIR}/lib/atl) spec2def(browseui.dll browseui.spec)
12 years
1
0
0
0
[ekohl] 57884: [SETUPAPI] SetupDiLoadClassIcon: Return the handle to or index of the default icon (Other devices icon) if no valid ClassGuid was provided by the caller. With this patch, the class i...
by ekohl@svn.reactos.org
Author: ekohl Date: Tue Dec 11 22:47:35 2012 New Revision: 57884 URL:
http://svn.reactos.org/svn/reactos?rev=57884&view=rev
Log: [SETUPAPI] SetupDiLoadClassIcon: Return the handle to or index of the default icon (Other devices icon) if no valid ClassGuid was provided by the caller. With this patch, the class icon of 'Other devices' appears in the device property sheets in the device manager. Modified: trunk/reactos/dll/win32/setupapi/devclass.c Modified: trunk/reactos/dll/win32/setupapi/devclass.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/devclas…
============================================================================== --- trunk/reactos/dll/win32/setupapi/devclass.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/setupapi/devclass.c [iso-8859-1] Tue Dec 11 22:47:35 2012 @@ -646,108 +646,105 @@ OUT HICON *LargeIcon OPTIONAL, OUT PINT MiniIconIndex OPTIONAL) { + LPWSTR Buffer = NULL; + LPCWSTR DllName; + INT iconIndex = -18; + HKEY hKey = INVALID_HANDLE_VALUE; + BOOL ret = FALSE; - if (!ClassGuid) - SetLastError(ERROR_INVALID_PARAMETER); + if (ClassGuid) + { + hKey = SetupDiOpenClassRegKey(ClassGuid, KEY_QUERY_VALUE); + if (hKey != INVALID_HANDLE_VALUE) + SETUP_GetIconIndex(hKey, &iconIndex); + } + + if (iconIndex > 0) + { + /* Look up icon in dll specified by Installer32 or EnumPropPages32 key */ + PWCHAR Comma; + LONG rc; + DWORD dwRegType, dwLength; + rc = RegQueryValueExW(hKey, REGSTR_VAL_INSTALLER_32, NULL, &dwRegType, NULL, &dwLength); + if (rc == ERROR_SUCCESS && dwRegType == REG_SZ) + { + Buffer = MyMalloc(dwLength + sizeof(WCHAR)); + if (Buffer == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + goto cleanup; + } + rc = RegQueryValueExW(hKey, REGSTR_VAL_INSTALLER_32, NULL, NULL, (LPBYTE)Buffer, &dwLength); + if (rc != ERROR_SUCCESS) + { + SetLastError(rc); + goto cleanup; + } + /* make sure the returned buffer is NULL-terminated */ + Buffer[dwLength / sizeof(WCHAR)] = 0; + } + else if + (ERROR_SUCCESS == (rc = RegQueryValueExW(hKey, REGSTR_VAL_ENUMPROPPAGES_32, NULL, &dwRegType, NULL, &dwLength)) + && dwRegType == REG_SZ) + { + Buffer = MyMalloc(dwLength + sizeof(WCHAR)); + if (Buffer == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + goto cleanup; + } + rc = RegQueryValueExW(hKey, REGSTR_VAL_ENUMPROPPAGES_32, NULL, NULL, (LPBYTE)Buffer, &dwLength); + if (rc != ERROR_SUCCESS) + { + SetLastError(rc); + goto cleanup; + } + /* make sure the returned buffer is NULL-terminated */ + Buffer[dwLength / sizeof(WCHAR)] = 0; + } + else + { + /* Unable to find where to load the icon */ + SetLastError(ERROR_FILE_NOT_FOUND); + goto cleanup; + } + Comma = strchrW(Buffer, ','); + if (!Comma) + { + SetLastError(ERROR_GEN_FAILURE); + goto cleanup; + } + *Comma = '\0'; + DllName = Buffer; + } else { - LPWSTR Buffer = NULL; - LPCWSTR DllName; - INT iconIndex = 0; - HKEY hKey = INVALID_HANDLE_VALUE; - - hKey = SetupDiOpenClassRegKey(ClassGuid, KEY_QUERY_VALUE); - if (hKey == INVALID_HANDLE_VALUE) - goto cleanup; - - if (!SETUP_GetIconIndex(hKey, &iconIndex)) - goto cleanup; - - if (iconIndex > 0) - { - /* Look up icon in dll specified by Installer32 or EnumPropPages32 key */ - PWCHAR Comma; - LONG rc; - DWORD dwRegType, dwLength; - rc = RegQueryValueExW(hKey, REGSTR_VAL_INSTALLER_32, NULL, &dwRegType, NULL, &dwLength); - if (rc == ERROR_SUCCESS && dwRegType == REG_SZ) - { - Buffer = MyMalloc(dwLength + sizeof(WCHAR)); - if (Buffer == NULL) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto cleanup; - } - rc = RegQueryValueExW(hKey, REGSTR_VAL_INSTALLER_32, NULL, NULL, (LPBYTE)Buffer, &dwLength); - if (rc != ERROR_SUCCESS) - { - SetLastError(rc); - goto cleanup; - } - /* make sure the returned buffer is NULL-terminated */ - Buffer[dwLength / sizeof(WCHAR)] = 0; - } - else if - (ERROR_SUCCESS == (rc = RegQueryValueExW(hKey, REGSTR_VAL_ENUMPROPPAGES_32, NULL, &dwRegType, NULL, &dwLength)) - && dwRegType == REG_SZ) - { - Buffer = MyMalloc(dwLength + sizeof(WCHAR)); - if (Buffer == NULL) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto cleanup; - } - rc = RegQueryValueExW(hKey, REGSTR_VAL_ENUMPROPPAGES_32, NULL, NULL, (LPBYTE)Buffer, &dwLength); - if (rc != ERROR_SUCCESS) - { - SetLastError(rc); - goto cleanup; - } - /* make sure the returned buffer is NULL-terminated */ - Buffer[dwLength / sizeof(WCHAR)] = 0; - } - else - { - /* Unable to find where to load the icon */ - SetLastError(ERROR_FILE_NOT_FOUND); - goto cleanup; - } - Comma = strchrW(Buffer, ','); - if (!Comma) - { - SetLastError(ERROR_GEN_FAILURE); - goto cleanup; - } - *Comma = '\0'; - DllName = Buffer; - } - else - { - /* Look up icon in setupapi.dll */ - DllName = SetupapiDll; - iconIndex = -iconIndex; - } - - TRACE("Icon index %d, dll name %s\n", iconIndex, debugstr_w(DllName)); - if (LargeIcon) - { - *LargeIcon = LoadImage(hInstance, MAKEINTRESOURCE(iconIndex), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); - if (!*LargeIcon) - { - SetLastError(ERROR_INVALID_INDEX); - goto cleanup; - } - } - if (MiniIconIndex) - *MiniIconIndex = iconIndex; - ret = TRUE; + /* Look up icon in setupapi.dll */ + DllName = SetupapiDll; + iconIndex = -iconIndex; + } + + TRACE("Icon index %d, dll name %s\n", iconIndex, debugstr_w(DllName)); + if (LargeIcon) + { + *LargeIcon = LoadImage(hInstance, MAKEINTRESOURCE(iconIndex), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); + if (!*LargeIcon) + { + SetLastError(ERROR_INVALID_INDEX); + goto cleanup; + } + } + if (MiniIconIndex) + *MiniIconIndex = iconIndex; + ret = TRUE; cleanup: - if (hKey != INVALID_HANDLE_VALUE) - RegCloseKey(hKey); + if (hKey != INVALID_HANDLE_VALUE) + RegCloseKey(hKey); + + if (Buffer != NULL) MyFree(Buffer); - } TRACE("Returning %d\n", ret); return ret;
12 years
1
0
0
0
[akhaldi] 57883: [GDIPLUS_WINETEST] * Sync with Wine 1.5.19.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Dec 11 21:40:34 2012 New Revision: 57883 URL:
http://svn.reactos.org/svn/reactos?rev=57883&view=rev
Log: [GDIPLUS_WINETEST] * Sync with Wine 1.5.19. Modified: trunk/rostests/winetests/gdiplus/CMakeLists.txt trunk/rostests/winetests/gdiplus/font.c trunk/rostests/winetests/gdiplus/graphics.c trunk/rostests/winetests/gdiplus/image.c trunk/rostests/winetests/gdiplus/metafile.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/rostests/winetests/gdiplus/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/CMakeLi…
Modified: trunk/rostests/winetests/gdiplus/font.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/font.c?…
Modified: trunk/rostests/winetests/gdiplus/graphics.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/graphic…
Modified: trunk/rostests/winetests/gdiplus/image.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/image.c…
Modified: trunk/rostests/winetests/gdiplus/metafile.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/metafil…
12 years
1
0
0
0
← Newer
1
...
16
17
18
19
20
21
22
...
29
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Results per page:
10
25
50
100
200