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
389eb971
Commit
389eb971
authored
Aug 31, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 31, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Added more IActiveScript tests.
parent
01ce1873
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
186 additions
and
5 deletions
+186
-5
vbscript.c
dlls/vbscript/tests/vbscript.c
+186
-5
No files found.
dlls/vbscript/tests/vbscript.c
View file @
389eb971
...
...
@@ -25,25 +25,207 @@
#include "wine/test.h"
#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_UNINITIALIZED
);
DEFINE_EXPECT
(
OnStateChange_STARTED
);
DEFINE_EXPECT
(
OnStateChange_CONNECTED
);
DEFINE_EXPECT
(
OnStateChange_DISCONNECTED
);
DEFINE_EXPECT
(
OnStateChange_CLOSED
);
DEFINE_EXPECT
(
OnStateChange_INITIALIZED
);
DEFINE_EXPECT
(
OnEnterScript
);
DEFINE_EXPECT
(
OnLeaveScript
);
DEFINE_GUID
(
CLSID_VBScript
,
0xb54f3741
,
0x5b07
,
0x11cf
,
0xa4
,
0xb0
,
0x00
,
0xaa
,
0x00
,
0x4a
,
0x55
,
0xe8
);
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_UNINITIALIZED
:
CHECK_EXPECT
(
OnStateChange_UNINITIALIZED
);
return
S_OK
;
case
SCRIPTSTATE_STARTED
:
CHECK_EXPECT
(
OnStateChange_STARTED
);
return
S_OK
;
case
SCRIPTSTATE_CONNECTED
:
CHECK_EXPECT
(
OnStateChange_CONNECTED
);
return
S_OK
;
case
SCRIPTSTATE_DISCONNECTED
:
CHECK_EXPECT
(
OnStateChange_DISCONNECTED
);
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
;
}
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
IActiveScript
*
create_vbscript
(
void
)
{
IActiveScript
*
ret
;
HRESULT
hres
;
hres
=
CoCreateInstance
(
&
CLSID_VBScript
,
NULL
,
CLSCTX_INPROC_SERVER
|
CLSCTX_INPROC_HANDLER
,
&
IID_IActiveScript
,
(
void
**
)
&
ret
);
ok
(
hres
==
S_OK
,
"CoCreateInstance failed: %08x
\n
"
,
hres
);
return
ret
;
}
static
void
test_vbscript
(
void
)
{
IActiveScriptParse
*
parser
;
IActiveScript
*
vbscript
;
ULONG
ref
;
HRESULT
hres
;
hres
=
CoCreateInstance
(
&
CLSID_VBScript
,
NULL
,
CLSCTX_INPROC_SERVER
|
CLSCTX_INPROC_HANDLER
,
&
IID_IActiveScript
,
(
void
**
)
&
vbscript
);
ok
(
hres
==
S_OK
,
"CoCreateInstance failed: %08x
\n
"
,
hres
);
vbscript
=
create_vbscript
();
hres
=
IActiveScript_QueryInterface
(
vbscript
,
&
IID_IActiveScriptParse
,
(
void
**
)
&
parser
);
ok
(
hres
==
S_OK
,
"Could not get IActiveScriptParse iface: %08x
\n
"
,
hres
);
SET_EXPECT
(
GetLCID
);
hres
=
IActiveScript_SetScriptSite
(
vbscript
,
&
ActiveScriptSite
);
ok
(
hres
==
S_OK
,
"SetScriptSite failed: %08x
\n
"
,
hres
);
CHECK_CALLED
(
GetLCID
);
SET_EXPECT
(
OnStateChange_INITIALIZED
);
hres
=
IActiveScriptParse64_InitNew
(
parser
);
ok
(
hres
==
S_OK
,
"InitNew failed: %08x
\n
"
,
hres
);
CHECK_CALLED
(
OnStateChange_INITIALIZED
);
hres
=
IActiveScriptParse64_InitNew
(
parser
);
ok
(
hres
==
E_UNEXPECTED
,
"InitNew failed: %08x, expected E_UNEXPECTED
\n
"
,
hres
);
SET_EXPECT
(
OnStateChange_CLOSED
);
hres
=
IActiveScript_Close
(
vbscript
);
ok
(
hres
==
S_OK
,
"Close failed: %08x
\n
"
,
hres
);
CHECK_CALLED
(
OnStateChange_CLOSED
);
IActiveScriptParse64_Release
(
parser
);
IActiveScript_Release
(
vbscript
);
ref
=
IActiveScript_Release
(
vbscript
);
ok
(
!
ref
,
"ref = %d
\n
"
,
ref
);
}
static
BOOL
check_vbscript
(
void
)
{
IActiveScript
*
vbscript
;
...
...
@@ -57,7 +239,6 @@ static BOOL check_vbscript(void)
return
hres
==
S_OK
;
}
START_TEST
(
vbscript
)
{
CoInitialize
(
NULL
);
...
...
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