Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
f3eb7761
Commit
f3eb7761
authored
Sep 01, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 02, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added script site tests.
parent
9efb87ea
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
163 additions
and
1 deletion
+163
-1
jscript.c
dlls/jscript/tests/jscript.c
+163
-1
No files found.
dlls/jscript/tests/jscript.c
View file @
f3eb7761
...
...
@@ -17,6 +17,7 @@
*/
#define COBJMACROS
#define CONST_VTABLE
#include <initguid.h>
#include <ole2.h>
...
...
@@ -30,6 +31,146 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
static
const
CLSID
CLSID_JScript
=
{
0xf414c260
,
0x6ac0
,
0x11cf
,{
0xb6
,
0xd1
,
0x00
,
0xaa
,
0x00
,
0xbb
,
0xbb
,
0x58
}};
#define DEFINE_EXPECT(func) \
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
#define SET_EXPECT(func) \
expect_ ## func = TRUE
#define SET_CALLED(func) \
called_ ## func = TRUE
#define CHECK_EXPECT2(func) \
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \
}while(0)
#define CHECK_EXPECT(func) \
do { \
CHECK_EXPECT2(func); \
expect_ ## func = FALSE; \
}while(0)
#define CHECK_CALLED(func) \
do { \
ok(called_ ## func, "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
DEFINE_EXPECT
(
GetLCID
);
DEFINE_EXPECT
(
OnStateChange_STARTED
);
DEFINE_EXPECT
(
OnStateChange_CLOSED
);
DEFINE_EXPECT
(
OnStateChange_INITIALIZED
);
DEFINE_EXPECT
(
OnEnterScript
);
DEFINE_EXPECT
(
OnLeaveScript
);
static
HRESULT
WINAPI
ActiveScriptSite_QueryInterface
(
IActiveScriptSite
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
*
ppv
=
NULL
;
if
(
IsEqualGUID
(
&
IID_IUnknown
,
riid
))
*
ppv
=
iface
;
else
if
(
IsEqualGUID
(
&
IID_IActiveScriptSite
,
riid
))
*
ppv
=
iface
;
else
return
E_NOINTERFACE
;
IUnknown_AddRef
((
IUnknown
*
)
*
ppv
);
return
S_OK
;
}
static
ULONG
WINAPI
ActiveScriptSite_AddRef
(
IActiveScriptSite
*
iface
)
{
return
2
;
}
static
ULONG
WINAPI
ActiveScriptSite_Release
(
IActiveScriptSite
*
iface
)
{
return
1
;
}
static
HRESULT
WINAPI
ActiveScriptSite_GetLCID
(
IActiveScriptSite
*
iface
,
LCID
*
plcid
)
{
CHECK_EXPECT
(
GetLCID
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
ActiveScriptSite_GetItemInfo
(
IActiveScriptSite
*
iface
,
LPCOLESTR
pstrName
,
DWORD
dwReturnMask
,
IUnknown
**
ppiunkItem
,
ITypeInfo
**
ppti
)
{
ok
(
0
,
"unexpected call
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
ActiveScriptSite_GetDocVersionString
(
IActiveScriptSite
*
iface
,
BSTR
*
pbstrVersion
)
{
ok
(
0
,
"unexpected call
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
ActiveScriptSite_OnScriptTerminate
(
IActiveScriptSite
*
iface
,
const
VARIANT
*
pvarResult
,
const
EXCEPINFO
*
pexcepinfo
)
{
ok
(
0
,
"unexpected call
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
ActiveScriptSite_OnStateChange
(
IActiveScriptSite
*
iface
,
SCRIPTSTATE
ssScriptState
)
{
switch
(
ssScriptState
)
{
case
SCRIPTSTATE_STARTED
:
CHECK_EXPECT
(
OnStateChange_STARTED
);
return
S_OK
;
case
SCRIPTSTATE_CLOSED
:
CHECK_EXPECT
(
OnStateChange_CLOSED
);
return
S_OK
;
case
SCRIPTSTATE_INITIALIZED
:
CHECK_EXPECT
(
OnStateChange_INITIALIZED
);
return
S_OK
;
default:
ok
(
0
,
"unexpected call %d
\n
"
,
ssScriptState
);
}
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
ActiveScriptSite_OnScriptError
(
IActiveScriptSite
*
iface
,
IActiveScriptError
*
pscripterror
)
{
ok
(
0
,
"unexpected call
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
ActiveScriptSite_OnEnterScript
(
IActiveScriptSite
*
iface
)
{
CHECK_EXPECT
(
OnEnterScript
);
return
S_OK
;
}
static
HRESULT
WINAPI
ActiveScriptSite_OnLeaveScript
(
IActiveScriptSite
*
iface
)
{
CHECK_EXPECT
(
OnLeaveScript
);
return
S_OK
;
}
#undef ACTSCPSITE_THIS
static
const
IActiveScriptSiteVtbl
ActiveScriptSiteVtbl
=
{
ActiveScriptSite_QueryInterface
,
ActiveScriptSite_AddRef
,
ActiveScriptSite_Release
,
ActiveScriptSite_GetLCID
,
ActiveScriptSite_GetItemInfo
,
ActiveScriptSite_GetDocVersionString
,
ActiveScriptSite_OnScriptTerminate
,
ActiveScriptSite_OnStateChange
,
ActiveScriptSite_OnScriptError
,
ActiveScriptSite_OnEnterScript
,
ActiveScriptSite_OnLeaveScript
};
static
IActiveScriptSite
ActiveScriptSite
=
{
&
ActiveScriptSiteVtbl
};
static
void
test_safety
(
IUnknown
*
unk
)
{
IObjectSafety
*
safety
;
...
...
@@ -94,6 +235,7 @@ static void test_jscript(void)
IActiveScriptParse
*
parse
;
IActiveScript
*
script
;
IUnknown
*
unk
;
ULONG
ref
;
HRESULT
hres
;
hres
=
CoCreateInstance
(
&
CLSID_JScript
,
NULL
,
CLSCTX_INPROC_SERVER
|
CLSCTX_INPROC_HANDLER
,
...
...
@@ -116,9 +258,29 @@ static void test_jscript(void)
hres
=
IActiveScriptParse_InitNew
(
parse
);
ok
(
hres
==
E_UNEXPECTED
,
"InitNew failed: %08x, expected E_UNEXPECTED
\n
"
,
hres
);
hres
=
IActiveScript_SetScriptSite
(
script
,
NULL
);
ok
(
hres
==
E_POINTER
,
"SetScriptSite failed: %08x, expected E_POINTER
\n
"
,
hres
);
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
);
hres
=
IActiveScript_SetScriptSite
(
script
,
&
ActiveScriptSite
);
ok
(
hres
==
E_UNEXPECTED
,
"SetScriptSite failed: %08x, expected E_UNEXPECTED
\n
"
,
hres
);
SET_EXPECT
(
OnStateChange_CLOSED
);
hres
=
IActiveScript_Close
(
script
);
ok
(
hres
==
S_OK
,
"Close failed: %08x
\n
"
,
hres
);
CHECK_CALLED
(
OnStateChange_CLOSED
);
IActiveScriptParse_Release
(
parse
);
IActiveScript_Release
(
script
);
IUnknown_Release
(
unk
);
ref
=
IUnknown_Release
(
unk
);
ok
(
!
ref
,
"ref = %d
\n
"
,
ref
);
}
START_TEST
(
jscript
)
...
...
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