mshtml: Added OLECMDID_OPTICAL_ZOOM tests and stub.

This commit is contained in:
Jacek Caban 2015-01-22 20:04:52 +01:00 committed by Alexandre Julliard
parent 23d74d3b73
commit 286e4a8655
2 changed files with 43 additions and 8 deletions

View File

@ -546,6 +546,12 @@ static HRESULT exec_get_print_template(HTMLDocument *This, DWORD nCmdexecopt, VA
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT exec_optical_zoom(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
return E_NOTIMPL;
}
static HRESULT query_mshtml_copy(HTMLDocument *This, OLECMD *cmd) static HRESULT query_mshtml_copy(HTMLDocument *This, OLECMD *cmd)
{ {
FIXME("(%p)\n", This); FIXME("(%p)\n", This);
@ -695,7 +701,7 @@ static HRESULT query_enabled_stub(HTMLDocument *This, OLECMD *cmd)
static const struct { static const struct {
OLECMDF cmdf; OLECMDF cmdf;
HRESULT (*func)(HTMLDocument*,DWORD,VARIANT*,VARIANT*); HRESULT (*func)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
} exec_table[OLECMDID_GETPRINTTEMPLATE+1] = { } exec_table[] = {
{0}, {0},
{ OLECMDF_SUPPORTED, exec_open }, /* OLECMDID_OPEN */ { OLECMDF_SUPPORTED, exec_open }, /* OLECMDID_OPEN */
{ OLECMDF_SUPPORTED, exec_new }, /* OLECMDID_NEW */ { OLECMDF_SUPPORTED, exec_new }, /* OLECMDID_NEW */
@ -735,7 +741,9 @@ static const struct {
{ OLECMDF_SUPPORTED, exec_close }, /* OLECMDID_CLOSE */ { OLECMDF_SUPPORTED, exec_close }, /* OLECMDID_CLOSE */
{0},{0},{0}, {0},{0},{0},
{ OLECMDF_SUPPORTED, exec_set_print_template }, /* OLECMDID_SETPRINTTEMPLATE */ { OLECMDF_SUPPORTED, exec_set_print_template }, /* OLECMDID_SETPRINTTEMPLATE */
{ OLECMDF_SUPPORTED, exec_get_print_template } /* OLECMDID_GETPRINTTEMPLATE */ { OLECMDF_SUPPORTED, exec_get_print_template }, /* OLECMDID_GETPRINTTEMPLATE */
{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},
{ 0, /* not reported as supported */ exec_optical_zoom } /* OLECMDID_OPTICAL_ZOOM */
}; };
static const cmdtable_t base_cmds[] = { static const cmdtable_t base_cmds[] = {
@ -874,7 +882,7 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID
HTMLDocument *This = impl_from_IOleCommandTarget(iface); HTMLDocument *This = impl_from_IOleCommandTarget(iface);
if(!pguidCmdGroup) { if(!pguidCmdGroup) {
if(nCmdID<OLECMDID_OPEN || nCmdID>OLECMDID_GETPRINTTEMPLATE || !exec_table[nCmdID].func) { if(nCmdID < OLECMDID_OPEN || nCmdID >= sizeof(exec_table)/sizeof(*exec_table) || !exec_table[nCmdID].func) {
WARN("Unsupported cmdID = %d\n", nCmdID); WARN("Unsupported cmdID = %d\n", nCmdID);
return OLECMDERR_E_NOTSUPPORTED; return OLECMDERR_E_NOTSUPPORTED;
} }

View File

@ -6292,7 +6292,7 @@ static void test_clear(IHTMLDocument2 *doc)
ok(hres == S_OK, "clear failed: %08x\n", hres); ok(hres == S_OK, "clear failed: %08x\n", hres);
} }
static const OLECMDF expect_cmds[OLECMDID_GETPRINTTEMPLATE+1] = { static const OLECMDF expect_cmds[] = {
0, 0,
OLECMDF_SUPPORTED, /* OLECMDID_OPEN */ OLECMDF_SUPPORTED, /* OLECMDID_OPEN */
OLECMDF_SUPPORTED, /* OLECMDID_NEW */ OLECMDF_SUPPORTED, /* OLECMDID_NEW */
@ -6347,7 +6347,7 @@ static void _test_QueryStatus(unsigned line, IUnknown *unk, REFIID cgid, ULONG c
return; return;
hres = IOleCommandTarget_QueryStatus(cmdtrg, cgid, 1, &olecmd, NULL); hres = IOleCommandTarget_QueryStatus(cmdtrg, cgid, 1, &olecmd, NULL);
ok(hres == S_OK, "QueryStatus(%u) failed: %08x\n", cmdid, hres); ok(hres == cmdf ? S_OK : OLECMDERR_E_NOTSUPPORTED, "QueryStatus(%u) failed: %08x\n", cmdid, hres);
IOleCommandTarget_Release(cmdtrg); IOleCommandTarget_Release(cmdtrg);
@ -6380,7 +6380,7 @@ static void test_MSHTML_QueryStatus(IHTMLDocument2 *doc, DWORD cmdf)
static void test_OleCommandTarget(IHTMLDocument2 *doc) static void test_OleCommandTarget(IHTMLDocument2 *doc)
{ {
IOleCommandTarget *cmdtrg; IOleCommandTarget *cmdtrg;
OLECMD cmds[OLECMDID_GETPRINTTEMPLATE]; OLECMD cmds[sizeof(expect_cmds)/sizeof(*expect_cmds)-1];
int i; int i;
HRESULT hres; HRESULT hres;
@ -6389,7 +6389,7 @@ static void test_OleCommandTarget(IHTMLDocument2 *doc)
if(FAILED(hres)) if(FAILED(hres))
return; return;
for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) { for(i=0; i < sizeof(cmds)/sizeof(*cmds); i++) {
cmds[i].cmdID = i+1; cmds[i].cmdID = i+1;
cmds[i].cmdf = 0xf0f0; cmds[i].cmdf = 0xf0f0;
} }
@ -6401,7 +6401,7 @@ static void test_OleCommandTarget(IHTMLDocument2 *doc)
CHECK_CALLED(QueryStatus_OPEN); CHECK_CALLED(QueryStatus_OPEN);
CHECK_CALLED(QueryStatus_NEW); CHECK_CALLED(QueryStatus_NEW);
for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) { for(i=0; i < sizeof(cmds)/sizeof(*cmds); i++) {
ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %x\n", i, cmds[i].cmdID); ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %x\n", i, cmds[i].cmdID);
if(i+1 == OLECMDID_FIND) if(i+1 == OLECMDID_FIND)
continue; continue;
@ -6624,6 +6624,31 @@ static void test_exec_noargs(IUnknown *unk, DWORD cmdid)
IOleCommandTarget_Release(cmdtrg); IOleCommandTarget_Release(cmdtrg);
} }
static void test_exec_optical_zoom(IHTMLDocument2 *doc, int factor)
{
IOleCommandTarget *cmdtrg;
VARIANT v;
HRESULT hres;
hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
if(FAILED(hres))
return;
V_VT(&v) = VT_I4;
V_I4(&v) = factor;
SET_EXPECT(GetOverrideKeyPath);
hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_OPTICAL_ZOOM,
OLECMDEXECOPT_DODEFAULT, &v, NULL);
todo_wine ok(hres == S_OK || broken(hres == OLECMDERR_E_NOTSUPPORTED) /* IE6 */, "Exec failed: %08x\n", hres);
CLEAR_CALLED(GetOverrideKeyPath);
IOleCommandTarget_Release(cmdtrg);
test_QueryStatus((IUnknown*)doc, NULL, OLECMDID_OPTICAL_ZOOM, 0);
}
static void test_IsDirty(IHTMLDocument2 *doc, HRESULT exhres) static void test_IsDirty(IHTMLDocument2 *doc, HRESULT exhres)
{ {
IPersistStreamInit *perinit; IPersistStreamInit *perinit;
@ -7489,6 +7514,8 @@ static void test_HTMLDocument(BOOL do_load, BOOL mime)
test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED); test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
test_OleCommandTarget_fail(doc); test_OleCommandTarget_fail(doc);
test_OleCommandTarget(doc); test_OleCommandTarget(doc);
test_exec_optical_zoom(doc, 200);
test_exec_optical_zoom(doc, 100);
test_OnAmbientPropertyChange(doc); test_OnAmbientPropertyChange(doc);
test_Window(doc, TRUE); test_Window(doc, TRUE);
test_external(doc, TRUE); test_external(doc, TRUE);