Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b5290bde
Commit
b5290bde
authored
Dec 30, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 31, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added a test using script dispatch after closing engine.
parent
2c0edb94
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
23 deletions
+60
-23
jscript.c
dlls/jscript/tests/jscript.c
+60
-23
No files found.
dlls/jscript/tests/jscript.c
View file @
b5290bde
...
...
@@ -203,37 +203,70 @@ static const IActiveScriptSiteVtbl ActiveScriptSiteVtbl = {
static
IActiveScriptSite
ActiveScriptSite
=
{
&
ActiveScriptSiteVtbl
};
static
void
test_script_dispatch
(
I
ActiveScript
*
script
,
BOOL
initialized
)
static
void
test_script_dispatch
(
I
DispatchEx
*
dispex
)
{
IDispatchEx
*
dispex
;
IDispatch
*
disp
;
DISPPARAMS
dp
=
{
NULL
,
NULL
,
0
,
0
}
;
EXCEPINFO
ei
;
BSTR
str
;
DISPID
id
;
VARIANT
v
;
HRESULT
hres
;
disp
=
(
void
*
)
0xdeadbeef
;
hres
=
IActiveScript_GetScriptDispatch
(
script
,
NULL
,
&
disp
);
if
(
!
initialized
)
{
ok
(
hres
==
E_UNEXPECTED
,
"hres = %08x, expected E_UNEXPECTED
\n
"
,
hres
);
ok
(
!
disp
,
"disp != NULL
\n
"
);
return
;
}
str
=
a2bstr
(
"ActiveXObject"
);
hres
=
IDispatchEx_GetDispID
(
dispex
,
str
,
fdexNameCaseSensitive
,
&
id
);
SysFreeString
(
str
);
ok
(
hres
==
S_OK
,
"GetDispID failed: %08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"GetScriptDispatch failed: %08x
\n
"
,
hres
);
if
(
FAILED
(
hres
))
return
;
str
=
a2bstr
(
"Math"
);
hres
=
IDispatchEx_GetDispID
(
dispex
,
str
,
fdexNameCaseSensitive
,
&
id
);
SysFreeString
(
str
);
ok
(
hres
==
S_OK
,
"GetDispID failed: %08x
\n
"
,
hres
);
ok
(
disp
!=
NULL
,
"disp == NULL
\n
"
);
hres
=
IDispatch_QueryInterface
(
disp
,
&
IID_IDispatchEx
,
(
void
**
)
&
dispex
);
IDispatch_Release
(
disp
);
ok
(
hres
==
S_OK
,
"Could not get IDispatchEx interface: %08x
\n
"
,
hres
);
memset
(
&
ei
,
0
,
sizeof
(
ei
));
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
0
,
DISPATCH_PROPERTYGET
,
&
dp
,
&
v
,
&
ei
,
NULL
);
ok
(
hres
==
S_OK
,
"InvokeEx failed: %08x
\n
"
,
hres
);
ok
(
V_VT
(
&
v
)
==
VT_DISPATCH
,
"V_VT(v) = %d
\n
"
,
V_VT
(
&
v
));
ok
(
V_DISPATCH
(
&
v
)
!=
NULL
,
"V_DISPATCH(v) = NULL
\n
"
);
VariantClear
(
&
v
);
str
=
a2bstr
(
"
ActiveXObject
"
);
str
=
a2bstr
(
"
String
"
);
hres
=
IDispatchEx_GetDispID
(
dispex
,
str
,
fdexNameCaseSensitive
,
&
id
);
SysFreeString
(
str
);
ok
(
hres
==
S_OK
,
"GetDispID failed: %08x
\n
"
,
hres
);
IDispatchEx_Release
(
dispex
);
memset
(
&
ei
,
0
,
sizeof
(
ei
));
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
0
,
DISPATCH_PROPERTYGET
,
&
dp
,
&
v
,
&
ei
,
NULL
);
ok
(
hres
==
S_OK
,
"InvokeEx failed: %08x
\n
"
,
hres
);
ok
(
V_VT
(
&
v
)
==
VT_DISPATCH
,
"V_VT(v) = %d
\n
"
,
V_VT
(
&
v
));
ok
(
V_DISPATCH
(
&
v
)
!=
NULL
,
"V_DISPATCH(v) = NULL
\n
"
);
VariantClear
(
&
v
);
}
static
IDispatchEx
*
get_script_dispatch
(
IActiveScript
*
script
)
{
IDispatchEx
*
dispex
;
IDispatch
*
disp
;
HRESULT
hres
;
disp
=
(
void
*
)
0xdeadbeef
;
hres
=
IActiveScript_GetScriptDispatch
(
script
,
NULL
,
&
disp
);
ok
(
hres
==
S_OK
,
"GetScriptDispatch failed: %08x
\n
"
,
hres
);
IDispatch_QueryInterface
(
disp
,
&
IID_IDispatchEx
,
(
void
**
)
&
dispex
);
IDispatch_Release
(
disp
);
ok
(
hres
==
S_OK
,
"Could not get IDispatch iface: %08x
\n
"
,
hres
);
return
dispex
;
}
static
void
test_no_script_dispatch
(
IActiveScript
*
script
)
{
IDispatch
*
disp
;
HRESULT
hres
;
disp
=
(
void
*
)
0xdeadbeef
;
hres
=
IActiveScript_GetScriptDispatch
(
script
,
NULL
,
&
disp
);
ok
(
hres
==
E_UNEXPECTED
,
"hres = %08x, expected E_UNEXPECTED
\n
"
,
hres
);
ok
(
!
disp
,
"disp != NULL
\n
"
);
}
static
void
test_safety
(
IUnknown
*
unk
)
...
...
@@ -342,6 +375,7 @@ static void test_jscript(void)
{
IActiveScriptParse
*
parse
;
IActiveScript
*
script
;
IDispatchEx
*
dispex
;
IUnknown
*
unk
;
ULONG
ref
;
HRESULT
hres
;
...
...
@@ -377,7 +411,7 @@ static void test_jscript(void)
ok
(
hres
==
E_POINTER
,
"SetScriptSite failed: %08x, expected E_POINTER
\n
"
,
hres
);
test_state
(
script
,
SCRIPTSTATE_UNINITIALIZED
);
test_
script_dispatch
(
script
,
FALSE
);
test_
no_script_dispatch
(
script
);
SET_EXPECT
(
GetLCID
);
SET_EXPECT
(
OnStateChange_INITIALIZED
);
...
...
@@ -391,7 +425,8 @@ static void test_jscript(void)
hres
=
IActiveScript_SetScriptSite
(
script
,
&
ActiveScriptSite
);
ok
(
hres
==
E_UNEXPECTED
,
"SetScriptSite failed: %08x, expected E_UNEXPECTED
\n
"
,
hres
);
test_script_dispatch
(
script
,
TRUE
);
dispex
=
get_script_dispatch
(
script
);
test_script_dispatch
(
dispex
);
SET_EXPECT
(
OnStateChange_STARTED
);
hres
=
IActiveScript_SetScriptState
(
script
,
SCRIPTSTATE_STARTED
);
...
...
@@ -406,7 +441,9 @@ static void test_jscript(void)
CHECK_CALLED
(
OnStateChange_CLOSED
);
test_state
(
script
,
SCRIPTSTATE_CLOSED
);
test_script_dispatch
(
script
,
FALSE
);
test_no_script_dispatch
(
script
);
test_script_dispatch
(
dispex
);
IDispatchEx_Release
(
dispex
);
IUnknown_Release
(
parse
);
IActiveScript_Release
(
script
);
...
...
@@ -474,7 +511,7 @@ static void test_jscript2(void)
CHECK_CALLED
(
OnStateChange_CLOSED
);
test_state
(
script
,
SCRIPTSTATE_CLOSED
);
test_
script_dispatch
(
script
,
FALSE
);
test_
no_script_dispatch
(
script
);
IUnknown_Release
(
parse
);
IActiveScript_Release
(
script
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment