vbscript: Support changing script state to SCRIPTSTATE_INITIALIZED.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-11-05 14:08:22 +01:00 committed by Alexandre Julliard
parent 706898dcbb
commit 9e2700b2fc
2 changed files with 33 additions and 5 deletions

View File

@ -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);

View File

@ -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");