2 * Object Linking and Embedding Tests
4 * Copyright 2005 Robert Shearman
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "wine/test.h"
33 #define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
35 static IPersistStorage OleObjectPersistStg;
36 static IOleCache *cache;
37 static IRunnableObject *runnable;
39 static const CLSID CLSID_WineTest =
40 { /* 9474ba1a-258b-490b-bc13-516e9239ace0 */
44 {0xbc, 0x13, 0x51, 0x6e, 0x92, 0x39, 0xac, 0xe0}
47 static char const * const *expected_method_list;
49 BOOL g_showRunnable = TRUE;
50 BOOL g_isRunning = TRUE;
52 #define CHECK_EXPECTED_METHOD(method_name) \
54 trace("%s\n", method_name); \
55 ok(*expected_method_list != NULL, "Extra method %s called\n", method_name); \
56 if (*expected_method_list) \
58 ok(!strcmp(*expected_method_list, method_name), "Expected %s to be called instead of %s\n", \
59 *expected_method_list, method_name); \
60 expected_method_list++; \
64 static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppv)
66 CHECK_EXPECTED_METHOD("OleObject_QueryInterface");
70 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IOleObject))
72 else if (IsEqualIID(riid, &IID_IPersistStorage))
73 *ppv = &OleObjectPersistStg;
74 else if (IsEqualIID(riid, &IID_IOleCache))
76 else if (IsEqualIID(riid, &IID_IRunnableObject) && g_showRunnable)
80 IUnknown_AddRef((IUnknown*)*ppv);
84 trace("OleObject_QueryInterface: returning E_NOINTERFACE\n");
88 static ULONG WINAPI OleObject_AddRef(IOleObject *iface)
90 CHECK_EXPECTED_METHOD("OleObject_AddRef");
94 static ULONG WINAPI OleObject_Release(IOleObject *iface)
96 CHECK_EXPECTED_METHOD("OleObject_Release");
100 static HRESULT WINAPI OleObject_SetClientSite
103 IOleClientSite *pClientSite
106 CHECK_EXPECTED_METHOD("OleObject_SetClientSite");
110 static HRESULT WINAPI OleObject_GetClientSite
113 IOleClientSite **ppClientSite
116 CHECK_EXPECTED_METHOD("OleObject_GetClientSite");
120 static HRESULT WINAPI OleObject_SetHostNames
123 LPCOLESTR szContainerApp,
124 LPCOLESTR szContainerObj
127 CHECK_EXPECTED_METHOD("OleObject_SetHostNames");
131 static HRESULT WINAPI OleObject_Close
137 CHECK_EXPECTED_METHOD("OleObject_Close");
141 static HRESULT WINAPI OleObject_SetMoniker
144 DWORD dwWhichMoniker,
148 CHECK_EXPECTED_METHOD("OleObject_SetMoniker");
152 static HRESULT WINAPI OleObject_GetMoniker
156 DWORD dwWhichMoniker,
160 CHECK_EXPECTED_METHOD("OleObject_GetMoniker");
164 static HRESULT WINAPI OleObject_InitFromData
167 IDataObject *pDataObject,
172 CHECK_EXPECTED_METHOD("OleObject_InitFromData");
176 static HRESULT WINAPI OleObject_GetClipboardData
180 IDataObject **ppDataObject
183 CHECK_EXPECTED_METHOD("OleObject_GetClipboardData");
187 static HRESULT WINAPI OleObject_DoVerb
192 IOleClientSite *pActiveSite,
198 CHECK_EXPECTED_METHOD("OleObject_DoVerb");
202 static HRESULT WINAPI OleObject_EnumVerbs
205 IEnumOLEVERB **ppEnumOleVerb
208 CHECK_EXPECTED_METHOD("OleObject_EnumVerbs");
212 static HRESULT WINAPI OleObject_Update
217 CHECK_EXPECTED_METHOD("OleObject_Update");
221 static HRESULT WINAPI OleObject_IsUpToDate
226 CHECK_EXPECTED_METHOD("OleObject_IsUpToDate");
230 static HRESULT WINAPI OleObject_GetUserClassID
236 CHECK_EXPECTED_METHOD("OleObject_GetUserClassID");
240 static HRESULT WINAPI OleObject_GetUserType
244 LPOLESTR *pszUserType
247 CHECK_EXPECTED_METHOD("OleObject_GetUserType");
251 static HRESULT WINAPI OleObject_SetExtent
258 CHECK_EXPECTED_METHOD("OleObject_SetExtent");
262 static HRESULT WINAPI OleObject_GetExtent
269 CHECK_EXPECTED_METHOD("OleObject_GetExtent");
273 static HRESULT WINAPI OleObject_Advise
276 IAdviseSink *pAdvSink,
280 CHECK_EXPECTED_METHOD("OleObject_Advise");
284 static HRESULT WINAPI OleObject_Unadvise
290 CHECK_EXPECTED_METHOD("OleObject_Unadvise");
294 static HRESULT WINAPI OleObject_EnumAdvise
297 IEnumSTATDATA **ppenumAdvise
300 CHECK_EXPECTED_METHOD("OleObject_EnumAdvise");
304 static HRESULT WINAPI OleObject_GetMiscStatus
311 CHECK_EXPECTED_METHOD("OleObject_GetMiscStatus");
312 *pdwStatus = DVASPECT_CONTENT;
316 static HRESULT WINAPI OleObject_SetColorScheme
322 CHECK_EXPECTED_METHOD("OleObject_SetColorScheme");
326 static const IOleObjectVtbl OleObjectVtbl =
328 OleObject_QueryInterface,
331 OleObject_SetClientSite,
332 OleObject_GetClientSite,
333 OleObject_SetHostNames,
335 OleObject_SetMoniker,
336 OleObject_GetMoniker,
337 OleObject_InitFromData,
338 OleObject_GetClipboardData,
342 OleObject_IsUpToDate,
343 OleObject_GetUserClassID,
344 OleObject_GetUserType,
349 OleObject_EnumAdvise,
350 OleObject_GetMiscStatus,
351 OleObject_SetColorScheme
354 static IOleObject OleObject = { &OleObjectVtbl };
356 static HRESULT WINAPI OleObjectPersistStg_QueryInterface(IPersistStorage *iface, REFIID riid, void **ppv)
358 trace("OleObjectPersistStg_QueryInterface\n");
359 return IUnknown_QueryInterface((IUnknown *)&OleObject, riid, ppv);
362 static ULONG WINAPI OleObjectPersistStg_AddRef(IPersistStorage *iface)
364 CHECK_EXPECTED_METHOD("OleObjectPersistStg_AddRef");
368 static ULONG WINAPI OleObjectPersistStg_Release(IPersistStorage *iface)
370 CHECK_EXPECTED_METHOD("OleObjectPersistStg_Release");
374 static HRESULT WINAPI OleObjectPersistStg_GetClassId(IPersistStorage *iface, CLSID *clsid)
376 CHECK_EXPECTED_METHOD("OleObjectPersistStg_GetClassId");
380 static HRESULT WINAPI OleObjectPersistStg_IsDirty
382 IPersistStorage *iface
385 CHECK_EXPECTED_METHOD("OleObjectPersistStg_IsDirty");
389 static HRESULT WINAPI OleObjectPersistStg_InitNew
391 IPersistStorage *iface,
395 CHECK_EXPECTED_METHOD("OleObjectPersistStg_InitNew");
399 static HRESULT WINAPI OleObjectPersistStg_Load
401 IPersistStorage *iface,
405 CHECK_EXPECTED_METHOD("OleObjectPersistStg_Load");
409 static HRESULT WINAPI OleObjectPersistStg_Save
411 IPersistStorage *iface,
416 CHECK_EXPECTED_METHOD("OleObjectPersistStg_Save");
420 static HRESULT WINAPI OleObjectPersistStg_SaveCompleted
422 IPersistStorage *iface,
426 CHECK_EXPECTED_METHOD("OleObjectPersistStg_SaveCompleted");
430 static HRESULT WINAPI OleObjectPersistStg_HandsOffStorage
432 IPersistStorage *iface
435 CHECK_EXPECTED_METHOD("OleObjectPersistStg_HandsOffStorage");
439 static const IPersistStorageVtbl OleObjectPersistStgVtbl =
441 OleObjectPersistStg_QueryInterface,
442 OleObjectPersistStg_AddRef,
443 OleObjectPersistStg_Release,
444 OleObjectPersistStg_GetClassId,
445 OleObjectPersistStg_IsDirty,
446 OleObjectPersistStg_InitNew,
447 OleObjectPersistStg_Load,
448 OleObjectPersistStg_Save,
449 OleObjectPersistStg_SaveCompleted,
450 OleObjectPersistStg_HandsOffStorage
453 static IPersistStorage OleObjectPersistStg = { &OleObjectPersistStgVtbl };
455 static HRESULT WINAPI OleObjectCache_QueryInterface(IOleCache *iface, REFIID riid, void **ppv)
457 return IUnknown_QueryInterface((IUnknown *)&OleObject, riid, ppv);
460 static ULONG WINAPI OleObjectCache_AddRef(IOleCache *iface)
462 CHECK_EXPECTED_METHOD("OleObjectCache_AddRef");
466 static ULONG WINAPI OleObjectCache_Release(IOleCache *iface)
468 CHECK_EXPECTED_METHOD("OleObjectCache_Release");
472 static HRESULT WINAPI OleObjectCache_Cache
475 FORMATETC *pformatetc,
480 CHECK_EXPECTED_METHOD("OleObjectCache_Cache");
484 static HRESULT WINAPI OleObjectCache_Uncache
490 CHECK_EXPECTED_METHOD("OleObjectCache_Uncache");
494 static HRESULT WINAPI OleObjectCache_EnumCache
497 IEnumSTATDATA **ppenumSTATDATA
500 CHECK_EXPECTED_METHOD("OleObjectCache_EnumCache");
505 static HRESULT WINAPI OleObjectCache_InitCache
508 IDataObject *pDataObject
511 CHECK_EXPECTED_METHOD("OleObjectCache_InitCache");
516 static HRESULT WINAPI OleObjectCache_SetData
519 FORMATETC *pformatetc,
524 CHECK_EXPECTED_METHOD("OleObjectCache_SetData");
529 static const IOleCacheVtbl OleObjectCacheVtbl =
531 OleObjectCache_QueryInterface,
532 OleObjectCache_AddRef,
533 OleObjectCache_Release,
534 OleObjectCache_Cache,
535 OleObjectCache_Uncache,
536 OleObjectCache_EnumCache,
537 OleObjectCache_InitCache,
538 OleObjectCache_SetData
541 static IOleCache OleObjectCache = { &OleObjectCacheVtbl };
543 static HRESULT WINAPI OleObjectCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
545 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
548 IUnknown_AddRef(iface);
552 return E_NOINTERFACE;
555 static ULONG WINAPI OleObjectCF_AddRef(IClassFactory *iface)
560 static ULONG WINAPI OleObjectCF_Release(IClassFactory *iface)
565 static HRESULT WINAPI OleObjectCF_CreateInstance(IClassFactory *iface, IUnknown *punkOuter, REFIID riid, void **ppv)
567 return IUnknown_QueryInterface((IUnknown *)&OleObject, riid, ppv);
570 static HRESULT WINAPI OleObjectCF_LockServer(IClassFactory *iface, BOOL lock)
575 static const IClassFactoryVtbl OleObjectCFVtbl =
577 OleObjectCF_QueryInterface,
580 OleObjectCF_CreateInstance,
581 OleObjectCF_LockServer
584 static IClassFactory OleObjectCF = { &OleObjectCFVtbl };
586 static HRESULT WINAPI OleObjectRunnable_QueryInterface(IRunnableObject *iface, REFIID riid, void **ppv)
588 return IUnknown_QueryInterface((IUnknown *)&OleObject, riid, ppv);
591 static ULONG WINAPI OleObjectRunnable_AddRef(IRunnableObject *iface)
593 CHECK_EXPECTED_METHOD("OleObjectRunnable_AddRef");
597 static ULONG WINAPI OleObjectRunnable_Release(IRunnableObject *iface)
599 CHECK_EXPECTED_METHOD("OleObjectRunnable_Release");
603 static HRESULT WINAPI OleObjectRunnable_GetRunningClass(
604 IRunnableObject *iface,
607 CHECK_EXPECTED_METHOD("OleObjectRunnable_GetRunningClass");
611 static HRESULT WINAPI OleObjectRunnable_Run(
612 IRunnableObject *iface,
615 CHECK_EXPECTED_METHOD("OleObjectRunnable_Run");
619 static BOOL WINAPI OleObjectRunnable_IsRunning(IRunnableObject *iface)
621 CHECK_EXPECTED_METHOD("OleObjectRunnable_IsRunning");
625 static HRESULT WINAPI OleObjectRunnable_LockRunning(
626 IRunnableObject *iface,
628 BOOL fLastUnlockCloses)
630 CHECK_EXPECTED_METHOD("OleObjectRunnable_LockRunning");
634 static HRESULT WINAPI OleObjectRunnable_SetContainedObject(
635 IRunnableObject *iface,
638 CHECK_EXPECTED_METHOD("OleObjectRunnable_SetContainedObject");
642 static const IRunnableObjectVtbl OleObjectRunnableVtbl =
644 OleObjectRunnable_QueryInterface,
645 OleObjectRunnable_AddRef,
646 OleObjectRunnable_Release,
647 OleObjectRunnable_GetRunningClass,
648 OleObjectRunnable_Run,
649 OleObjectRunnable_IsRunning,
650 OleObjectRunnable_LockRunning,
651 OleObjectRunnable_SetContainedObject
654 static IRunnableObject OleObjectRunnable = { &OleObjectRunnableVtbl };
656 static const CLSID CLSID_Equation3 = {0x0002CE02, 0x0000, 0x0000, {0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} };
658 static void test_OleCreate(IStorage *pStorage)
663 static const char *methods_olerender_none[] =
665 "OleObject_QueryInterface",
667 "OleObject_QueryInterface",
668 "OleObjectPersistStg_AddRef",
669 "OleObjectPersistStg_InitNew",
670 "OleObjectPersistStg_Release",
674 static const char *methods_olerender_draw[] =
676 "OleObject_QueryInterface",
678 "OleObject_QueryInterface",
679 "OleObjectPersistStg_AddRef",
680 "OleObjectPersistStg_InitNew",
681 "OleObjectPersistStg_Release",
682 "OleObject_QueryInterface",
683 "OleObjectRunnable_AddRef",
684 "OleObjectRunnable_Run",
685 "OleObjectRunnable_Release",
686 "OleObject_QueryInterface",
687 "OleObjectCache_AddRef",
688 "OleObjectCache_Cache",
689 "OleObjectCache_Release",
693 static const char *methods_olerender_format[] =
695 "OleObject_QueryInterface",
697 "OleObject_QueryInterface",
699 "OleObject_GetMiscStatus",
700 "OleObject_QueryInterface",
701 "OleObjectPersistStg_AddRef",
702 "OleObjectPersistStg_InitNew",
703 "OleObjectPersistStg_Release",
704 "OleObject_SetClientSite",
706 "OleObject_QueryInterface",
707 "OleObjectRunnable_AddRef",
708 "OleObjectRunnable_Run",
709 "OleObjectRunnable_Release",
710 "OleObject_QueryInterface",
711 "OleObjectCache_AddRef",
712 "OleObjectCache_Cache",
713 "OleObjectCache_Release",
717 static const char *methods_olerender_asis[] =
719 "OleObject_QueryInterface",
721 "OleObject_QueryInterface",
722 "OleObjectPersistStg_AddRef",
723 "OleObjectPersistStg_InitNew",
724 "OleObjectPersistStg_Release",
728 static const char *methods_olerender_draw_no_runnable[] =
730 "OleObject_QueryInterface",
732 "OleObject_QueryInterface",
733 "OleObjectPersistStg_AddRef",
734 "OleObjectPersistStg_InitNew",
735 "OleObjectPersistStg_Release",
736 "OleObject_QueryInterface",
737 "OleObject_QueryInterface",
738 "OleObjectCache_AddRef",
739 "OleObjectCache_Cache",
740 "OleObjectCache_Release",
744 static const char *methods_olerender_draw_no_cache[] =
746 "OleObject_QueryInterface",
748 "OleObject_QueryInterface",
749 "OleObjectPersistStg_AddRef",
750 "OleObjectPersistStg_InitNew",
751 "OleObjectPersistStg_Release",
752 "OleObject_QueryInterface",
753 "OleObjectRunnable_AddRef",
754 "OleObjectRunnable_Run",
755 "OleObjectRunnable_Release",
756 "OleObject_QueryInterface",
761 runnable = &OleObjectRunnable;
762 cache = &OleObjectCache;
763 expected_method_list = methods_olerender_none;
764 trace("OleCreate with OLERENDER_NONE:\n");
765 hr = OleCreate(&CLSID_Equation3, &IID_IOleObject, OLERENDER_NONE, NULL, NULL, pStorage, (void **)&pObject);
766 ok_ole_success(hr, "OleCreate");
767 IOleObject_Release(pObject);
768 ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
770 expected_method_list = methods_olerender_draw;
771 trace("OleCreate with OLERENDER_DRAW:\n");
772 hr = OleCreate(&CLSID_Equation3, &IID_IOleObject, OLERENDER_DRAW, NULL, NULL, pStorage, (void **)&pObject);
773 ok_ole_success(hr, "OleCreate");
774 IOleObject_Release(pObject);
775 ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
777 formatetc.cfFormat = CF_TEXT;
778 formatetc.ptd = NULL;
779 formatetc.dwAspect = DVASPECT_CONTENT;
780 formatetc.lindex = -1;
781 formatetc.tymed = TYMED_HGLOBAL;
782 expected_method_list = methods_olerender_format;
783 trace("OleCreate with OLERENDER_FORMAT:\n");
784 hr = OleCreate(&CLSID_Equation3, &IID_IOleObject, OLERENDER_FORMAT, &formatetc, (IOleClientSite *)0xdeadbeef, pStorage, (void **)&pObject);
785 ok_ole_success(hr, "OleCreate");
787 IOleObject_Release(pObject);
788 ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
790 expected_method_list = methods_olerender_asis;
791 trace("OleCreate with OLERENDER_ASIS:\n");
792 hr = OleCreate(&CLSID_Equation3, &IID_IOleObject, OLERENDER_ASIS, NULL, NULL, pStorage, (void **)&pObject);
793 ok_ole_success(hr, "OleCreate");
794 IOleObject_Release(pObject);
795 ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
798 expected_method_list = methods_olerender_draw_no_runnable;
799 trace("OleCreate with OLERENDER_DRAW (no IOlObjectRunnable):\n");
800 hr = OleCreate(&CLSID_Equation3, &IID_IOleObject, OLERENDER_DRAW, NULL, NULL, pStorage, (void **)&pObject);
801 ok_ole_success(hr, "OleCreate");
802 IOleObject_Release(pObject);
803 ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
805 runnable = &OleObjectRunnable;
807 expected_method_list = methods_olerender_draw_no_cache;
808 trace("OleCreate with OLERENDER_DRAW (no IOlObjectRunnable):\n");
809 hr = OleCreate(&CLSID_Equation3, &IID_IOleObject, OLERENDER_DRAW, NULL, NULL, pStorage, (void **)&pObject);
810 ok_ole_success(hr, "OleCreate");
811 IOleObject_Release(pObject);
812 ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
816 static void test_OleLoad(IStorage *pStorage)
821 static const char *methods_oleload[] =
823 "OleObject_QueryInterface",
825 "OleObject_QueryInterface",
827 "OleObject_GetMiscStatus",
828 "OleObject_QueryInterface",
829 "OleObjectPersistStg_AddRef",
830 "OleObjectPersistStg_Load",
831 "OleObjectPersistStg_Release",
832 "OleObject_SetClientSite",
834 "OleObject_QueryInterface",
839 expected_method_list = methods_oleload;
841 hr = OleLoad(pStorage, &IID_IOleObject, (IOleClientSite *)0xdeadbeef, (void **)&pObject);
842 ok_ole_success(hr, "OleLoad");
844 IOleObject_Release(pObject);
845 ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
848 static BOOL STDMETHODCALLTYPE draw_continue(ULONG_PTR param)
850 CHECK_EXPECTED_METHOD("draw_continue");
854 static HRESULT WINAPI AdviseSink_QueryInterface(IAdviseSink *iface, REFIID riid, void **ppv)
856 if (IsEqualIID(riid, &IID_IAdviseSink) || IsEqualIID(riid, &IID_IUnknown))
859 IUnknown_AddRef(iface);
863 return E_NOINTERFACE;
866 static ULONG WINAPI AdviseSink_AddRef(IAdviseSink *iface)
871 static ULONG WINAPI AdviseSink_Release(IAdviseSink *iface)
877 static void WINAPI AdviseSink_OnDataChange(
879 FORMATETC *pFormatetc,
882 CHECK_EXPECTED_METHOD("AdviseSink_OnDataChange");
885 static void WINAPI AdviseSink_OnViewChange(
890 CHECK_EXPECTED_METHOD("AdviseSink_OnViewChange");
893 static void WINAPI AdviseSink_OnRename(
897 CHECK_EXPECTED_METHOD("AdviseSink_OnRename");
900 static void WINAPI AdviseSink_OnSave(IAdviseSink *iface)
902 CHECK_EXPECTED_METHOD("AdviseSink_OnSave");
905 static void WINAPI AdviseSink_OnClose(IAdviseSink *iface)
907 CHECK_EXPECTED_METHOD("AdviseSink_OnClose");
910 static const IAdviseSinkVtbl AdviseSinkVtbl =
912 AdviseSink_QueryInterface,
915 AdviseSink_OnDataChange,
916 AdviseSink_OnViewChange,
922 static IAdviseSink AdviseSink = { &AdviseSinkVtbl };
924 static HRESULT WINAPI DataObject_QueryInterface(
929 if (IsEqualIID(riid, &IID_IDataObject) || IsEqualIID(riid, &IID_IUnknown))
938 static ULONG WINAPI DataObject_AddRef(
944 static ULONG WINAPI DataObject_Release(
950 static HRESULT WINAPI DataObject_GetData(
952 LPFORMATETC pformatetcIn,
955 CHECK_EXPECTED_METHOD("DataObject_GetData");
959 static HRESULT WINAPI DataObject_GetDataHere(
961 LPFORMATETC pformatetc,
964 CHECK_EXPECTED_METHOD("DataObject_GetDataHere");
968 static HRESULT WINAPI DataObject_QueryGetData(
970 LPFORMATETC pformatetc)
972 CHECK_EXPECTED_METHOD("DataObject_QueryGetData");
976 static HRESULT WINAPI DataObject_GetCanonicalFormatEtc(
978 LPFORMATETC pformatectIn,
979 LPFORMATETC pformatetcOut)
981 CHECK_EXPECTED_METHOD("DataObject_GetCanonicalFormatEtc");
985 static HRESULT WINAPI DataObject_SetData(
987 LPFORMATETC pformatetc,
991 CHECK_EXPECTED_METHOD("DataObject_SetData");
995 static HRESULT WINAPI DataObject_EnumFormatEtc(
998 IEnumFORMATETC** ppenumFormatEtc)
1000 CHECK_EXPECTED_METHOD("DataObject_EnumFormatEtc");
1004 static HRESULT WINAPI DataObject_DAdvise(
1006 FORMATETC* pformatetc,
1008 IAdviseSink* pAdvSink,
1009 DWORD* pdwConnection)
1011 CHECK_EXPECTED_METHOD("DataObject_DAdvise");
1016 static HRESULT WINAPI DataObject_DUnadvise(
1020 CHECK_EXPECTED_METHOD("DataObject_DUnadvise");
1024 static HRESULT WINAPI DataObject_EnumDAdvise(
1026 IEnumSTATDATA** ppenumAdvise)
1028 CHECK_EXPECTED_METHOD("DataObject_EnumDAdvise");
1029 return OLE_E_ADVISENOTSUPPORTED;
1032 static IDataObjectVtbl DataObjectVtbl =
1034 DataObject_QueryInterface,
1038 DataObject_GetDataHere,
1039 DataObject_QueryGetData,
1040 DataObject_GetCanonicalFormatEtc,
1042 DataObject_EnumFormatEtc,
1044 DataObject_DUnadvise,
1045 DataObject_EnumDAdvise
1048 static IDataObject DataObject = { &DataObjectVtbl };
1050 static void test_data_cache(void)
1053 IOleCache2 *pOleCache;
1055 IPersistStorage *pPS;
1056 IViewObject *pViewObject;
1057 IOleCacheControl *pOleCacheControl;
1059 STGMEDIUM stgmedium;
1065 char szSystemDir[MAX_PATH];
1066 WCHAR wszPath[MAX_PATH];
1067 static const WCHAR wszShell32[] = {'\\','s','h','e','l','l','3','2','.','d','l','l',0};
1069 static const char *methods_cacheinitnew[] =
1071 "AdviseSink_OnViewChange",
1072 "AdviseSink_OnViewChange",
1074 "DataObject_DAdvise",
1075 "DataObject_DAdvise",
1076 "DataObject_DUnadvise",
1077 "DataObject_DUnadvise",
1080 static const char *methods_cacheload[] =
1082 "AdviseSink_OnViewChange",
1086 "DataObject_GetData",
1087 "DataObject_GetData",
1088 "DataObject_GetData",
1092 GetSystemDirectory(szSystemDir, sizeof(szSystemDir)/sizeof(szSystemDir[0]));
1094 expected_method_list = methods_cacheinitnew;
1096 fmtetc.cfFormat = CF_METAFILEPICT;
1097 fmtetc.dwAspect = DVASPECT_ICON;
1100 fmtetc.tymed = TYMED_MFPICT;
1102 hr = StgCreateDocfile(NULL, STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_DELETEONRELEASE, 0, &pStorage);
1103 ok_ole_success(hr, "StgCreateDocfile");
1105 /* Test with new data */
1107 hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IOleCache2, (LPVOID *)&pOleCache);
1108 ok_ole_success(hr, "CreateDataCache");
1110 hr = IOleCache_QueryInterface(pOleCache, &IID_IPersistStorage, (LPVOID *)&pPS);
1111 ok_ole_success(hr, "IOleCache_QueryInterface(IID_IPersistStorage)");
1112 hr = IOleCache_QueryInterface(pOleCache, &IID_IViewObject, (LPVOID *)&pViewObject);
1113 ok_ole_success(hr, "IOleCache_QueryInterface(IID_IViewObject)");
1114 hr = IOleCache_QueryInterface(pOleCache, &IID_IOleCacheControl, (LPVOID *)&pOleCacheControl);
1115 ok_ole_success(hr, "IOleCache_QueryInterface(IID_IOleCacheControl)");
1117 hr = IViewObject_SetAdvise(pViewObject, DVASPECT_ICON, ADVF_PRIMEFIRST, &AdviseSink);
1118 ok_ole_success(hr, "IViewObject_SetAdvise");
1120 hr = IPersistStorage_InitNew(pPS, pStorage);
1121 ok_ole_success(hr, "IPersistStorage_InitNew");
1123 hr = IPersistStorage_IsDirty(pPS);
1124 ok_ole_success(hr, "IPersistStorage_IsDirty");
1126 hr = IPersistStorage_GetClassID(pPS, &clsid);
1127 ok_ole_success(hr, "IPersistStorage_GetClassID");
1128 ok(IsEqualCLSID(&clsid, &IID_NULL), "clsid should be blank\n");
1130 hr = IOleCache_Uncache(pOleCache, 0xdeadbeef);
1131 ok(hr == OLE_E_NOCONNECTION, "IOleCache_Uncache with invalid value should return OLE_E_NOCONNECTION instead of 0x%x\n", hr);
1133 /* Both tests crash on NT4 and below */
1136 hr = IOleCache_Cache(pOleCache, NULL, 0, &dwConnection);
1137 ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL fmtetc should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1139 hr = IOleCache_Cache(pOleCache, NULL, 0, NULL);
1140 ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL pdwConnection should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1143 for (fmtetc.cfFormat = CF_TEXT; fmtetc.cfFormat < CF_MAX; fmtetc.cfFormat++)
1146 fmtetc.dwAspect = DVASPECT_THUMBNAIL;
1147 for (i = 0; i < 7; i++)
1149 fmtetc.tymed = 1 << i;
1150 hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
1151 if ((fmtetc.cfFormat == CF_METAFILEPICT && fmtetc.tymed == TYMED_MFPICT) ||
1152 (fmtetc.cfFormat == CF_BITMAP && fmtetc.tymed == TYMED_GDI) ||
1153 (fmtetc.cfFormat == CF_DIB && fmtetc.tymed == TYMED_HGLOBAL) ||
1154 (fmtetc.cfFormat == CF_ENHMETAFILE && fmtetc.tymed == TYMED_ENHMF))
1155 ok(hr == S_OK, "IOleCache_Cache cfFormat = %d, tymed = %d should have returned S_OK instead of 0x%08x\n",
1156 fmtetc.cfFormat, fmtetc.tymed, hr);
1157 else if (fmtetc.tymed == TYMED_HGLOBAL)
1158 ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED,
1159 "IOleCache_Cache cfFormat = %d, tymed = %d should have returned CACHE_S_FORMATETC_NOTSUPPORTED instead of 0x%08x\n",
1160 fmtetc.cfFormat, fmtetc.tymed, hr);
1162 ok(hr == DV_E_TYMED, "IOleCache_Cache cfFormat = %d, tymed = %d should have returned DV_E_TYMED instead of 0x%08x\n",
1163 fmtetc.cfFormat, fmtetc.tymed, hr);
1166 hr = IOleCache_Uncache(pOleCache, dwConnection);
1167 ok_ole_success(hr, "IOleCache_Uncache");
1172 fmtetc.cfFormat = CF_BITMAP;
1173 fmtetc.dwAspect = DVASPECT_THUMBNAIL;
1174 fmtetc.tymed = TYMED_GDI;
1175 hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
1176 ok_ole_success(hr, "IOleCache_Cache");
1178 fmtetc.cfFormat = 0;
1179 fmtetc.dwAspect = DVASPECT_ICON;
1180 fmtetc.tymed = TYMED_MFPICT;
1181 hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
1182 ok_ole_success(hr, "IOleCache_Cache");
1184 MultiByteToWideChar(CP_ACP, 0, szSystemDir, -1, wszPath, sizeof(wszPath)/sizeof(wszPath[0]));
1185 memcpy(wszPath+lstrlenW(wszPath), wszShell32, sizeof(wszShell32));
1187 fmtetc.cfFormat = CF_METAFILEPICT;
1188 stgmedium.tymed = TYMED_MFPICT;
1189 U(stgmedium).hMetaFilePict = OleMetafilePictFromIconAndLabel(
1190 LoadIcon(NULL, IDI_APPLICATION), wszPath, wszPath, 0);
1191 stgmedium.pUnkForRelease = NULL;
1193 fmtetc.dwAspect = DVASPECT_CONTENT;
1194 hr = IOleCache_SetData(pOleCache, &fmtetc, &stgmedium, FALSE);
1195 ok(hr == OLE_E_BLANK, "IOleCache_SetData for aspect not in cache should have return OLE_E_BLANK instead of 0x%08x\n", hr);
1197 fmtetc.dwAspect = DVASPECT_ICON;
1198 hr = IOleCache_SetData(pOleCache, &fmtetc, &stgmedium, FALSE);
1199 ok_ole_success(hr, "IOleCache_SetData");
1201 hr = IViewObject_Freeze(pViewObject, DVASPECT_ICON, -1, NULL, &dwFreeze);
1203 ok_ole_success(hr, "IViewObject_Freeze");
1204 hr = IViewObject_Freeze(pViewObject, DVASPECT_CONTENT, -1, NULL, &dwFreeze);
1205 ok(hr == OLE_E_BLANK, "IViewObject_Freeze with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
1210 rcBounds.right = 100;
1211 rcBounds.bottom = 100;
1212 hdcMem = CreateCompatibleDC(NULL);
1214 hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1215 ok_ole_success(hr, "IViewObject_Draw");
1217 hr = IViewObject_Draw(pViewObject, DVASPECT_CONTENT, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1218 ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
1222 hr = IOleCacheControl_OnRun(pOleCacheControl, &DataObject);
1224 ok_ole_success(hr, "IOleCacheControl_OnRun");
1227 hr = IPersistStorage_Save(pPS, pStorage, TRUE);
1228 ok_ole_success(hr, "IPersistStorage_Save");
1230 hr = IPersistStorage_SaveCompleted(pPS, NULL);
1231 ok_ole_success(hr, "IPersistStorage_SaveCompleted");
1233 hr = IPersistStorage_IsDirty(pPS);
1234 ok(hr == S_FALSE, "IPersistStorage_IsDirty should have returned S_FALSE instead of 0x%x\n", hr);
1236 IPersistStorage_Release(pPS);
1237 IViewObject_Release(pViewObject);
1238 IOleCache_Release(pOleCache);
1239 IOleCacheControl_Release(pOleCacheControl);
1242 ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
1245 /* Test with loaded data */
1246 trace("Testing loaded data with CreateDataCache:\n");
1247 expected_method_list = methods_cacheload;
1249 hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IOleCache2, (LPVOID *)&pOleCache);
1250 ok_ole_success(hr, "CreateDataCache");
1252 hr = IOleCache_QueryInterface(pOleCache, &IID_IPersistStorage, (LPVOID *)&pPS);
1253 ok_ole_success(hr, "IOleCache_QueryInterface(IID_IPersistStorage)");
1254 hr = IOleCache_QueryInterface(pOleCache, &IID_IViewObject, (LPVOID *)&pViewObject);
1255 ok_ole_success(hr, "IOleCache_QueryInterface(IID_IViewObject)");
1257 hr = IViewObject_SetAdvise(pViewObject, DVASPECT_ICON, ADVF_PRIMEFIRST, &AdviseSink);
1258 ok_ole_success(hr, "IViewObject_SetAdvise");
1260 hr = IPersistStorage_Load(pPS, pStorage);
1261 ok_ole_success(hr, "IPersistStorage_Load");
1263 hr = IPersistStorage_IsDirty(pPS);
1264 ok(hr == S_FALSE, "IPersistStorage_IsDirty should have returned S_FALSE instead of 0x%x\n", hr);
1266 fmtetc.cfFormat = 0;
1267 fmtetc.dwAspect = DVASPECT_ICON;
1270 fmtetc.tymed = TYMED_MFPICT;
1271 hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
1272 ok(hr == CACHE_S_SAMECACHE, "IOleCache_Cache with already loaded data format type should return CACHE_S_SAMECACHE instead of 0x%x\n", hr);
1276 rcBounds.right = 100;
1277 rcBounds.bottom = 100;
1278 hdcMem = CreateCompatibleDC(NULL);
1280 hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1281 ok_ole_success(hr, "IViewObject_Draw");
1283 hr = IViewObject_Draw(pViewObject, DVASPECT_CONTENT, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1284 ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
1286 /* unload the cached storage object, causing it to be reloaded */
1287 hr = IOleCache2_DiscardCache(pOleCache, DISCARDCACHE_NOSAVE);
1288 ok_ole_success(hr, "IOleCache2_DiscardCache");
1289 hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1290 ok_ole_success(hr, "IViewObject_Draw");
1292 /* unload the cached storage object, but don't allow it to be reloaded */
1293 hr = IPersistStorage_HandsOffStorage(pPS);
1294 ok_ole_success(hr, "IPersistStorage_HandsOffStorage");
1295 hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1296 ok_ole_success(hr, "IViewObject_Draw");
1297 hr = IOleCache2_DiscardCache(pOleCache, DISCARDCACHE_NOSAVE);
1298 ok_ole_success(hr, "IOleCache2_DiscardCache");
1299 hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1300 ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
1305 hr = IOleCache_InitCache(pOleCache, &DataObject);
1306 ok(hr == CACHE_E_NOCACHE_UPDATED, "IOleCache_InitCache should have returned CACHE_E_NOCACHE_UPDATED instead of 0x%08x\n", hr);
1309 IPersistStorage_Release(pPS);
1310 IViewObject_Release(pViewObject);
1311 IOleCache_Release(pOleCache);
1314 ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
1317 IStorage_Release(pStorage);
1318 ReleaseStgMedium(&stgmedium);
1321 static void test_default_handler(void)
1324 IOleObject *pObject;
1325 IRunnableObject *pRunnableObject;
1326 IOleClientSite *pClientSite;
1327 IDataObject *pDataObject;
1331 LPOLESTR pszUserType;
1336 IOleInPlaceObject *pInPlaceObj;
1337 IEnumOLEVERB *pEnumVerbs;
1338 static const WCHAR wszUnknown[] = {'U','n','k','n','o','w','n',0};
1339 static const WCHAR wszHostName[] = {'W','i','n','e',' ','T','e','s','t',' ','P','r','o','g','r','a','m',0};
1340 static const WCHAR wszDelim[] = {'!',0};
1342 hr = CoCreateInstance(&CLSID_WineTest, NULL, CLSCTX_INPROC_HANDLER, &IID_IOleObject, (void **)&pObject);
1343 ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance should have failed with REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
1345 hr = OleCreateDefaultHandler(&CLSID_WineTest, NULL, &IID_IOleObject, (void **)&pObject);
1346 ok_ole_success(hr, "OleCreateDefaultHandler");
1348 hr = IOleObject_QueryInterface(pObject, &IID_IOleInPlaceObject, (void **)&pInPlaceObj);
1349 ok(hr == E_NOINTERFACE, "IOleObject_QueryInterface(&IID_IOleInPlaceObject) should return E_NOINTERFACE instead of 0x%08x\n", hr);
1351 hr = IOleObject_Advise(pObject, &AdviseSink, &dwAdvConn);
1352 ok_ole_success(hr, "IOleObject_Advise");
1354 hr = IOleObject_Close(pObject, OLECLOSE_NOSAVE);
1355 ok_ole_success(hr, "IOleObject_Close");
1357 /* FIXME: test IOleObject_EnumAdvise */
1359 hr = IOleObject_EnumVerbs(pObject, &pEnumVerbs);
1360 ok(hr == REGDB_E_CLASSNOTREG, "IOleObject_EnumVerbs should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
1362 hr = IOleObject_GetClientSite(pObject, &pClientSite);
1363 ok_ole_success(hr, "IOleObject_GetClientSite");
1365 hr = IOleObject_GetClipboardData(pObject, 0, &pDataObject);
1366 ok(hr == OLE_E_NOTRUNNING,
1367 "IOleObject_GetClipboardData should have returned OLE_E_NOTRUNNING instead of 0x%08x\n",
1370 hr = IOleObject_GetExtent(pObject, DVASPECT_CONTENT, &sizel);
1371 ok(hr == OLE_E_BLANK, "IOleObject_GetExtent should have returned OLE_E_BLANK instead of 0x%08x\n",
1374 hr = IOleObject_GetMiscStatus(pObject, DVASPECT_CONTENT, &dwStatus);
1376 ok(hr == REGDB_E_CLASSNOTREG, "IOleObject_GetMiscStatus should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
1378 hr = IOleObject_GetUserClassID(pObject, &clsid);
1379 ok_ole_success(hr, "IOleObject_GetUserClassID");
1380 ok(IsEqualCLSID(&clsid, &CLSID_WineTest), "clsid != CLSID_WineTest\n");
1382 hr = IOleObject_GetUserType(pObject, USERCLASSTYPE_FULL, &pszUserType);
1384 ok_ole_success(hr, "IOleObject_GetUserType");
1385 ok(!lstrcmpW(pszUserType, wszUnknown), "Retrieved user type was wrong\n");
1388 hr = IOleObject_InitFromData(pObject, NULL, TRUE, 0);
1389 ok(hr == OLE_E_NOTRUNNING, "IOleObject_InitFromData should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr);
1391 hr = IOleObject_IsUpToDate(pObject);
1392 ok(hr == OLE_E_NOTRUNNING, "IOleObject_IsUpToDate should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr);
1394 palette.palNumEntries = 1;
1395 palette.palVersion = 2;
1396 memset(&palette.palPalEntry[0], 0, sizeof(palette.palPalEntry[0]));
1397 hr = IOleObject_SetColorScheme(pObject, &palette);
1398 ok(hr == OLE_E_NOTRUNNING, "IOleObject_SetColorScheme should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr);
1400 sizel.cx = sizel.cy = 0;
1401 hr = IOleObject_SetExtent(pObject, DVASPECT_CONTENT, &sizel);
1403 hr = IOleObject_SetHostNames(pObject, wszHostName, NULL);
1404 ok_ole_success(hr, "IOleObject_SetHostNames");
1406 hr = CreateItemMoniker(wszDelim, wszHostName, &pMoniker);
1407 ok_ole_success(hr, "CreateItemMoniker");
1408 hr = IOleObject_SetMoniker(pObject, OLEWHICHMK_CONTAINER, pMoniker);
1409 ok_ole_success(hr, "IOleObject_SetMoniker");
1410 IMoniker_Release(pMoniker);
1412 hr = IOleObject_GetMoniker(pObject, OLEGETMONIKER_ONLYIFTHERE, OLEWHICHMK_CONTAINER, &pMoniker);
1413 ok(hr == E_FAIL, "IOleObject_GetMoniker should have returned E_FAIL instead of 0x%08x\n", hr);
1415 hr = IOleObject_Update(pObject);
1417 ok(hr == REGDB_E_CLASSNOTREG, "IOleObject_Update should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
1419 hr = IOleObject_QueryInterface(pObject, &IID_IDataObject, (void **)&pDataObject);
1420 ok_ole_success(hr, "IOleObject_QueryInterface");
1422 fmtetc.cfFormat = CF_TEXT;
1424 fmtetc.dwAspect = DVASPECT_CONTENT;
1426 fmtetc.tymed = TYMED_NULL;
1427 hr = IDataObject_DAdvise(pDataObject, &fmtetc, 0, &AdviseSink, &dwAdvConn);
1428 ok_ole_success(hr, "IDataObject_DAdvise");
1430 fmtetc.cfFormat = CF_ENHMETAFILE;
1432 fmtetc.dwAspect = DVASPECT_CONTENT;
1434 fmtetc.tymed = TYMED_ENHMF;
1435 hr = IDataObject_DAdvise(pDataObject, &fmtetc, 0, &AdviseSink, &dwAdvConn);
1436 ok_ole_success(hr, "IDataObject_DAdvise");
1438 fmtetc.cfFormat = CF_ENHMETAFILE;
1440 fmtetc.dwAspect = DVASPECT_CONTENT;
1442 fmtetc.tymed = TYMED_ENHMF;
1443 hr = IDataObject_QueryGetData(pDataObject, &fmtetc);
1445 ok(hr == OLE_E_NOTRUNNING, "IDataObject_QueryGetData should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr);
1447 fmtetc.cfFormat = CF_TEXT;
1449 fmtetc.dwAspect = DVASPECT_CONTENT;
1451 fmtetc.tymed = TYMED_NULL;
1452 hr = IDataObject_QueryGetData(pDataObject, &fmtetc);
1454 ok(hr == OLE_E_NOTRUNNING, "IDataObject_QueryGetData should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr);
1456 hr = IOleObject_QueryInterface(pObject, &IID_IRunnableObject, (void **)&pRunnableObject);
1457 ok_ole_success(hr, "IOleObject_QueryInterface");
1459 hr = IRunnableObject_SetContainedObject(pRunnableObject, TRUE);
1460 ok_ole_success(hr, "IRunnableObject_SetContainedObject");
1462 hr = IRunnableObject_Run(pRunnableObject, NULL);
1463 ok(hr == REGDB_E_CLASSNOTREG, "IOleObject_Run should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
1465 hr = IOleObject_Close(pObject, OLECLOSE_NOSAVE);
1466 ok_ole_success(hr, "IOleObject_Close");
1468 IRunnableObject_Release(pRunnableObject);
1469 IOleObject_Release(pObject);
1472 void test_runnable(void)
1474 static const char *methods_query_runnable[] =
1476 "OleObject_QueryInterface",
1477 "OleObjectRunnable_AddRef",
1478 "OleObjectRunnable_IsRunning",
1479 "OleObjectRunnable_Release",
1483 static const char *methods_no_runnable[] =
1485 "OleObject_QueryInterface",
1489 IOleObject *object = (IOleObject *)&OleObject;
1491 expected_method_list = methods_query_runnable;
1492 ok(OleIsRunning(object), "Object should be running\n");
1493 ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
1495 g_isRunning = FALSE;
1496 expected_method_list = methods_query_runnable;
1497 ok(OleIsRunning(object) == FALSE, "Object should not be running\n");
1498 ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
1500 g_showRunnable = FALSE; /* QueryInterface(IID_IRunnableObject, ...) will fail */
1501 expected_method_list = methods_no_runnable;
1502 ok(OleIsRunning(object), "Object without IRunnableObject should be running\n");
1503 ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
1506 g_showRunnable = TRUE;
1518 hr = CoRegisterClassObject(&CLSID_Equation3, (IUnknown *)&OleObjectCF, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &dwRegister);
1519 ok_ole_success(hr, "CoRegisterClassObject");
1521 hr = StgCreateDocfile(NULL, STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_DELETEONRELEASE, 0, &pStorage);
1522 ok_ole_success(hr, "StgCreateDocfile");
1524 test_OleCreate(pStorage);
1526 hr = IStorage_Stat(pStorage, &statstg, STATFLAG_NONAME);
1527 ok_ole_success(hr, "IStorage_Stat");
1528 ok(IsEqualCLSID(&CLSID_Equation3, &statstg.clsid), "Wrong CLSID in storage\n");
1530 test_OleLoad(pStorage);
1532 IStorage_Release(pStorage);
1534 hr = CoRevokeClassObject(dwRegister);
1535 ok_ole_success(hr, "CoRevokeClassObject");
1538 test_default_handler();