Jacek Caban : shdocvw: Added QueryStatus implementation.
Alexandre Julliard
julliard at winehq.org
Tue Feb 24 10:21:29 CST 2009
Module: wine
Branch: master
Commit: 64adaf723bdffabedef62d7f166df6675e1988b9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=64adaf723bdffabedef62d7f166df6675e1988b9
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Feb 23 15:38:30 2009 +0100
shdocvw: Added QueryStatus implementation.
---
dlls/shdocvw/oleobject.c | 21 +++++++++++++++++++--
dlls/shdocvw/tests/webbrowser.c | 33 +++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/dlls/shdocvw/oleobject.c b/dlls/shdocvw/oleobject.c
index 9b7168f..aab06d0 100644
--- a/dlls/shdocvw/oleobject.c
+++ b/dlls/shdocvw/oleobject.c
@@ -868,9 +868,26 @@ static HRESULT WINAPI WBOleCommandTarget_QueryStatus(IOleCommandTarget *iface,
const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
{
WebBrowser *This = OLECMD_THIS(iface);
- FIXME("(%p)->(%s %u %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds,
+ IOleCommandTarget *cmdtrg;
+ HRESULT hres;
+
+ TRACE("(%p)->(%s %u %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds,
pCmdText);
- return E_NOTIMPL;
+
+ if(!This->doc_host.document)
+ return 0x80040104;
+
+ /* NOTE: There are probably some commands that we should handle here
+ * instead of forwarding to document object. */
+
+ hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IOleCommandTarget, (void**)&cmdtrg);
+ if(FAILED(hres))
+ return hres;
+
+ hres = IOleCommandTarget_QueryStatus(cmdtrg, pguidCmdGroup, cCmds, prgCmds, pCmdText);
+ IOleCommandTarget_Release(cmdtrg);
+
+ return hres;
}
static HRESULT WINAPI WBOleCommandTarget_Exec(IOleCommandTarget *iface,
diff --git a/dlls/shdocvw/tests/webbrowser.c b/dlls/shdocvw/tests/webbrowser.c
index f699e90..2f1c7d7 100644
--- a/dlls/shdocvw/tests/webbrowser.c
+++ b/dlls/shdocvw/tests/webbrowser.c
@@ -30,6 +30,7 @@
#include "exdisp.h"
#include "htiframe.h"
#include "mshtmhst.h"
+#include "mshtmcid.h"
#include "idispids.h"
#include "olectl.h"
#include "mshtmdid.h"
@@ -2123,6 +2124,36 @@ static void test_download(void)
CHECK_CALLED(Invoke_DOCUMENTCOMPLETE);
}
+static void test_olecmd(IUnknown *unk, BOOL loaded)
+{
+ IOleCommandTarget *cmdtrg;
+ OLECMD cmds[3];
+ HRESULT hres;
+
+ hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
+ ok(hres == S_OK, "Could not get IOleCommandTarget iface: %08x\n", hres);
+ if(FAILED(hres))
+ return;
+
+ cmds[0].cmdID = OLECMDID_SPELL;
+ cmds[0].cmdf = 0xdeadbeef;
+ cmds[1].cmdID = OLECMDID_REFRESH;
+ cmds[1].cmdf = 0xdeadbeef;
+ hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 2, cmds, NULL);
+ if(loaded) {
+ ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
+ ok(cmds[0].cmdf == OLECMDF_SUPPORTED, "OLECMDID_SPELL cmdf = %x\n", cmds[0].cmdf);
+ ok(cmds[1].cmdf == (OLECMDF_ENABLED|OLECMDF_SUPPORTED),
+ "OLECMDID_REFRESH cmdf = %x\n", cmds[1].cmdf);
+ }else {
+ ok(hres == 0x80040104, "QueryStatus failed: %08x\n", hres);
+ ok(cmds[0].cmdf == 0xdeadbeef, "OLECMDID_SPELL cmdf = %x\n", cmds[0].cmdf);
+ ok(cmds[1].cmdf == 0xdeadbeef, "OLECMDID_REFRESH cmdf = %x\n", cmds[0].cmdf);
+ }
+
+ IOleCommandTarget_Release(cmdtrg);
+}
+
static void test_IServiceProvider(IUnknown *unk)
{
IServiceProvider *servprov = (void*)0xdeadbeef;
@@ -2213,10 +2244,12 @@ static void test_WebBrowser(BOOL do_download)
test_Extent(unk);
test_wb_funcs(unk, TRUE);
test_DoVerb(unk);
+ test_olecmd(unk, FALSE);
test_Navigate2(unk);
if(do_download) {
test_download();
+ test_olecmd(unk, TRUE);
}
test_ClientSite(unk, NULL);
More information about the wine-cvs
mailing list