Commit 9e2700b2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Support changing script state to SCRIPTSTATE_INITIALIZED.

parent 706898dc
......@@ -796,6 +796,35 @@ static void test_vbscript_uninitializing(void)
test_state(script, SCRIPTSTATE_INITIALIZED);
SET_EXPECT(OnStateChange_STARTED);
hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_STARTED);
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_UNINITIALIZED) failed: %08x\n", hres);
CHECK_CALLED(OnStateChange_STARTED);
SET_EXPECT(OnStateChange_INITIALIZED);
hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_INITIALIZED);
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_UNINITIALIZED) failed: %08x\n", hres);
CHECK_CALLED(OnStateChange_INITIALIZED);
hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_INITIALIZED);
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_UNINITIALIZED) failed: %08x\n", hres);
SET_EXPECT(OnStateChange_CLOSED);
hres = IActiveScript_Close(script);
ok(hres == S_OK, "Close failed: %08x\n", hres);
CHECK_CALLED(OnStateChange_CLOSED);
test_state(script, SCRIPTSTATE_CLOSED);
SET_EXPECT(GetLCID);
SET_EXPECT(OnStateChange_INITIALIZED);
hres = IActiveScript_SetScriptSite(script, &ActiveScriptSite);
ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres);
CHECK_CALLED(GetLCID);
CHECK_CALLED(OnStateChange_INITIALIZED);
test_state(script, SCRIPTSTATE_INITIALIZED);
SET_EXPECT(OnStateChange_CLOSED);
hres = IActiveScript_Close(script);
ok(hres == S_OK, "Close failed: %08x\n", hres);
......
......@@ -207,14 +207,13 @@ static void decrease_state(VBScript *This, SCRIPTSTATE state)
/* FALLTHROUGH */
case SCRIPTSTATE_STARTED:
case SCRIPTSTATE_DISCONNECTED:
if(This->state == SCRIPTSTATE_DISCONNECTED)
change_state(This, SCRIPTSTATE_INITIALIZED);
if(state == SCRIPTSTATE_INITIALIZED)
break;
change_state(This, SCRIPTSTATE_INITIALIZED);
/* FALLTHROUGH */
case SCRIPTSTATE_INITIALIZED:
case SCRIPTSTATE_UNINITIALIZED:
change_state(This, state);
if(state == SCRIPTSTATE_INITIALIZED)
break;
release_script(This->ctx);
This->thread_id = 0;
break;
......@@ -469,7 +468,7 @@ static HRESULT WINAPI VBScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE
exec_queued_code(This->ctx);
break;
case SCRIPTSTATE_INITIALIZED:
FIXME("unimplemented SCRIPTSTATE_INITIALIZED\n");
decrease_state(This, SCRIPTSTATE_INITIALIZED);
return S_OK;
case SCRIPTSTATE_DISCONNECTED:
FIXME("unimplemented SCRIPTSTATE_DISCONNECTED\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment