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
Show 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 = {
...
@@ -203,37 +203,70 @@ static const IActiveScriptSiteVtbl ActiveScriptSiteVtbl = {
static
IActiveScriptSite
ActiveScriptSite
=
{
&
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
;
DISPPARAMS
dp
=
{
NULL
,
NULL
,
0
,
0
}
;
IDispatch
*
disp
;
EXCEPINFO
ei
;
BSTR
str
;
BSTR
str
;
DISPID
id
;
DISPID
id
;
VARIANT
v
;
HRESULT
hres
;
HRESULT
hres
;
disp
=
(
void
*
)
0xdeadbeef
;
str
=
a2bstr
(
"ActiveXObject"
);
hres
=
IActiveScript_GetScriptDispatch
(
script
,
NULL
,
&
disp
);
hres
=
IDispatchEx_GetDispID
(
dispex
,
str
,
fdexNameCaseSensitive
,
&
id
);
if
(
!
initialized
)
{
SysFreeString
(
str
);
ok
(
hres
==
E_UNEXPECTED
,
"hres = %08x, expected E_UNEXPECTED
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"GetDispID failed: %08x
\n
"
,
hres
);
ok
(
!
disp
,
"disp != NULL
\n
"
);
return
;
}
ok
(
hres
==
S_OK
,
"GetScriptDispatch failed: %08x
\n
"
,
hres
);
str
=
a2bstr
(
"Math"
);
if
(
FAILED
(
hres
))
hres
=
IDispatchEx_GetDispID
(
dispex
,
str
,
fdexNameCaseSensitive
,
&
id
);
return
;
SysFreeString
(
str
);
ok
(
hres
==
S_OK
,
"GetDispID failed: %08x
\n
"
,
hres
);
ok
(
disp
!=
NULL
,
"disp == NULL
\n
"
);
memset
(
&
ei
,
0
,
sizeof
(
ei
));
hres
=
IDispatch_QueryInterface
(
disp
,
&
IID_IDispatchEx
,
(
void
**
)
&
dispex
);
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
0
,
DISPATCH_PROPERTYGET
,
&
dp
,
&
v
,
&
ei
,
NULL
);
IDispatch_Release
(
disp
);
ok
(
hres
==
S_OK
,
"InvokeEx failed: %08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"Could not get IDispatchEx interface: %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
);
hres
=
IDispatchEx_GetDispID
(
dispex
,
str
,
fdexNameCaseSensitive
,
&
id
);
SysFreeString
(
str
);
SysFreeString
(
str
);
ok
(
hres
==
S_OK
,
"GetDispID failed: %08x
\n
"
,
hres
);
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
)
static
void
test_safety
(
IUnknown
*
unk
)
...
@@ -342,6 +375,7 @@ static void test_jscript(void)
...
@@ -342,6 +375,7 @@ static void test_jscript(void)
{
{
IActiveScriptParse
*
parse
;
IActiveScriptParse
*
parse
;
IActiveScript
*
script
;
IActiveScript
*
script
;
IDispatchEx
*
dispex
;
IUnknown
*
unk
;
IUnknown
*
unk
;
ULONG
ref
;
ULONG
ref
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -377,7 +411,7 @@ static void test_jscript(void)
...
@@ -377,7 +411,7 @@ static void test_jscript(void)
ok
(
hres
==
E_POINTER
,
"SetScriptSite failed: %08x, expected E_POINTER
\n
"
,
hres
);
ok
(
hres
==
E_POINTER
,
"SetScriptSite failed: %08x, expected E_POINTER
\n
"
,
hres
);
test_state
(
script
,
SCRIPTSTATE_UNINITIALIZED
);
test_state
(
script
,
SCRIPTSTATE_UNINITIALIZED
);
test_
script_dispatch
(
script
,
FALSE
);
test_
no_script_dispatch
(
script
);
SET_EXPECT
(
GetLCID
);
SET_EXPECT
(
GetLCID
);
SET_EXPECT
(
OnStateChange_INITIALIZED
);
SET_EXPECT
(
OnStateChange_INITIALIZED
);
...
@@ -391,7 +425,8 @@ static void test_jscript(void)
...
@@ -391,7 +425,8 @@ static void test_jscript(void)
hres
=
IActiveScript_SetScriptSite
(
script
,
&
ActiveScriptSite
);
hres
=
IActiveScript_SetScriptSite
(
script
,
&
ActiveScriptSite
);
ok
(
hres
==
E_UNEXPECTED
,
"SetScriptSite failed: %08x, expected E_UNEXPECTED
\n
"
,
hres
);
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
);
SET_EXPECT
(
OnStateChange_STARTED
);
hres
=
IActiveScript_SetScriptState
(
script
,
SCRIPTSTATE_STARTED
);
hres
=
IActiveScript_SetScriptState
(
script
,
SCRIPTSTATE_STARTED
);
...
@@ -406,7 +441,9 @@ static void test_jscript(void)
...
@@ -406,7 +441,9 @@ static void test_jscript(void)
CHECK_CALLED
(
OnStateChange_CLOSED
);
CHECK_CALLED
(
OnStateChange_CLOSED
);
test_state
(
script
,
SCRIPTSTATE_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
);
IUnknown_Release
(
parse
);
IActiveScript_Release
(
script
);
IActiveScript_Release
(
script
);
...
@@ -474,7 +511,7 @@ static void test_jscript2(void)
...
@@ -474,7 +511,7 @@ static void test_jscript2(void)
CHECK_CALLED
(
OnStateChange_CLOSED
);
CHECK_CALLED
(
OnStateChange_CLOSED
);
test_state
(
script
,
SCRIPTSTATE_CLOSED
);
test_state
(
script
,
SCRIPTSTATE_CLOSED
);
test_
script_dispatch
(
script
,
FALSE
);
test_
no_script_dispatch
(
script
);
IUnknown_Release
(
parse
);
IUnknown_Release
(
parse
);
IActiveScript_Release
(
script
);
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