vbscript: Added SetScriptState implementation.

This commit is contained in:
Jacek Caban 2011-09-05 11:13:54 +02:00 committed by Alexandre Julliard
parent dac6d862ec
commit 3d3504a6d7
2 changed files with 52 additions and 1 deletions

View File

@ -326,9 +326,22 @@ static void test_vbscript(void)
hres = IActiveScriptParse64_InitNew(parser);
ok(hres == E_UNEXPECTED, "InitNew failed: %08x, expected E_UNEXPECTED\n", hres);
SET_EXPECT(OnStateChange_CONNECTED);
hres = IActiveScript_SetScriptState(vbscript, SCRIPTSTATE_CONNECTED);
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_CONNECTED) failed: %08x\n", hres);
CHECK_CALLED(OnStateChange_CONNECTED);
test_state(vbscript, SCRIPTSTATE_CONNECTED);
SET_EXPECT(OnStateChange_DISCONNECTED);
SET_EXPECT(OnStateChange_INITIALIZED);
SET_EXPECT(OnStateChange_CLOSED);
hres = IActiveScript_Close(vbscript);
ok(hres == S_OK, "Close failed: %08x\n", hres);
todo_wine
CHECK_CALLED(OnStateChange_DISCONNECTED);
todo_wine
CHECK_CALLED(OnStateChange_INITIALIZED);
CHECK_CALLED(OnStateChange_CLOSED);
test_state(vbscript, SCRIPTSTATE_CLOSED);

View File

@ -63,6 +63,11 @@ static void change_state(VBScript *This, SCRIPTSTATE state)
IActiveScriptSite_OnStateChange(This->site, state);
}
static void exec_queued_code(VBScript *This)
{
FIXME("\n");
}
static HRESULT set_ctx_site(VBScript *This)
{
This->ctx->lcid = This->lcid;
@ -207,7 +212,40 @@ static HRESULT WINAPI VBScript_GetScriptSite(IActiveScript *iface, REFIID riid,
static HRESULT WINAPI VBScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE ss)
{
VBScript *This = impl_from_IActiveScript(iface);
FIXME("(%p)->(%d)\n", This, ss);
TRACE("(%p)->(%d)\n", This, ss);
if(This->thread_id && GetCurrentThreadId() != This->thread_id)
return E_UNEXPECTED;
if(ss == SCRIPTSTATE_UNINITIALIZED) {
if(This->state == SCRIPTSTATE_CLOSED)
return E_UNEXPECTED;
decrease_state(This, SCRIPTSTATE_UNINITIALIZED);
return S_OK;
}
if(!This->ctx)
return E_UNEXPECTED;
switch(ss) {
case SCRIPTSTATE_STARTED:
case SCRIPTSTATE_CONNECTED: /* FIXME */
if(This->state == SCRIPTSTATE_CLOSED)
return E_UNEXPECTED;
exec_queued_code(This);
break;
case SCRIPTSTATE_INITIALIZED:
FIXME("unimplemented SCRIPTSTATE_INITIALIZED\n");
return S_OK;
default:
FIXME("unimplemented state %d\n", ss);
return E_NOTIMPL;
}
change_state(This, ss);
return S_OK;
}