ole32: Call the draw_continue function.

This commit is contained in:
Huw Davies 2010-09-28 10:48:23 +01:00 committed by Alexandre Julliard
parent 6c7dd939cf
commit 250b55c41d
2 changed files with 19 additions and 0 deletions

View File

@ -1633,6 +1633,8 @@ static HRESULT WINAPI DataCache_Draw(
if (cache_entry->stgmedium.tymed == TYMED_NULL)
continue;
if (pfnContinue && !pfnContinue(dwContinue)) return E_ABORT;
switch (cache_entry->data_cf)
{
case CF_METAFILEPICT:

View File

@ -897,6 +897,12 @@ static BOOL STDMETHODCALLTYPE draw_continue(ULONG_PTR param)
return TRUE;
}
static BOOL STDMETHODCALLTYPE draw_continue_false(ULONG_PTR param)
{
CHECK_EXPECTED_METHOD("draw_continue_false");
return FALSE;
}
static HRESULT WINAPI AdviseSink_QueryInterface(IAdviseSink *iface, REFIID riid, void **ppv)
{
if (IsEqualIID(riid, &IID_IAdviseSink) || IsEqualIID(riid, &IID_IUnknown))
@ -1117,6 +1123,7 @@ static void test_data_cache(void)
{ "AdviseSink_OnViewChange", 0 },
{ "AdviseSink_OnViewChange", 0 },
{ "draw_continue", 1 },
{ "draw_continue_false", 1 },
{ "DataObject_DAdvise", 0 },
{ "DataObject_DAdvise", 0 },
{ "DataObject_DUnadvise", 0 },
@ -1268,6 +1275,16 @@ static void test_data_cache(void)
hr = IViewObject_Draw(pViewObject, DVASPECT_CONTENT, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
/* a NULL draw_continue fn ptr */
hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, NULL, 0xdeadbeef);
ok_ole_success(hr, "IViewObject_Draw");
/* draw_continue that returns FALSE to abort drawing */
hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue_false, 0xdeadbeef);
ok(hr == E_ABORT ||
broken(hr == S_OK), /* win9x may skip the callbacks */
"IViewObject_Draw with draw_continue_false returns 0x%08x\n", hr);
DeleteDC(hdcMem);
hr = IOleCacheControl_OnRun(pOleCacheControl, &DataObject);