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
012004bc
Commit
012004bc
authored
Aug 31, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 01, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added function object tests.
parent
65d0929c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
1 deletion
+98
-1
script.c
dlls/mshtml/tests/script.c
+98
-1
No files found.
dlls/mshtml/tests/script.c
View file @
012004bc
...
...
@@ -129,6 +129,25 @@ static const char *debugstr_guid(REFIID riid)
return
buf
;
}
static
int
strcmp_wa
(
LPCWSTR
strw
,
const
char
*
stra
)
{
CHAR
buf
[
512
];
WideCharToMultiByte
(
CP_ACP
,
0
,
strw
,
-
1
,
buf
,
sizeof
(
buf
),
NULL
,
NULL
);
return
lstrcmpA
(
stra
,
buf
);
}
static
BSTR
a2bstr
(
const
char
*
str
)
{
BSTR
ret
;
int
len
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
ret
=
SysAllocStringLen
(
NULL
,
len
);
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
ret
,
len
);
return
ret
;
}
static
HRESULT
WINAPI
PropertyNotifySink_QueryInterface
(
IPropertyNotifySink
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
...
...
@@ -617,12 +636,76 @@ static HRESULT WINAPI ActiveScriptParse_AddScriptlet(IActiveScriptParse *iface,
return
E_NOTIMPL
;
}
static
void
test_func
(
IDispatchEx
*
obj
)
{
DISPID
id
,
propput_arg
=
DISPID_PROPERTYPUT
;
IDispatchEx
*
dispex
;
IDispatch
*
disp
;
EXCEPINFO
ei
;
DISPPARAMS
dp
;
BSTR
str
;
VARIANT
var
;
HRESULT
hres
;
str
=
a2bstr
(
"toString"
);
hres
=
IDispatchEx_GetDispID
(
obj
,
str
,
fdexNameCaseSensitive
,
&
id
);
SysFreeString
(
str
);
ok
(
hres
==
S_OK
,
"GetDispID failed: %08x
\n
"
,
hres
);
ok
(
id
==
DISPID_IOMNAVIGATOR_TOSTRING
,
"id = %x
\n
"
,
id
);
memset
(
&
dp
,
0
,
sizeof
(
dp
));
memset
(
&
ei
,
0
,
sizeof
(
ei
));
VariantInit
(
&
var
);
hres
=
IDispatchEx_InvokeEx
(
obj
,
id
,
LOCALE_NEUTRAL
,
DISPATCH_PROPERTYGET
,
&
dp
,
&
var
,
&
ei
,
NULL
);
ok
(
hres
==
S_OK
,
"InvokeEx failed: %08x
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_DISPATCH
,
"V_VT(var)=%d
\n
"
,
V_VT
(
&
var
));
ok
(
V_DISPATCH
(
&
var
)
!=
NULL
,
"V_DISPATCH(var) == NULL
\n
"
);
disp
=
V_DISPATCH
(
&
var
);
memset
(
&
dp
,
0
,
sizeof
(
dp
));
memset
(
&
ei
,
0
,
sizeof
(
ei
));
VariantInit
(
&
var
);
hres
=
IDispatchEx_InvokeEx
(
obj
,
id
,
LOCALE_NEUTRAL
,
DISPATCH_PROPERTYGET
,
&
dp
,
&
var
,
&
ei
,
NULL
);
ok
(
hres
==
S_OK
,
"InvokeEx failed: %08x
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_DISPATCH
,
"V_VT(var)=%d
\n
"
,
V_VT
(
&
var
));
ok
(
V_DISPATCH
(
&
var
)
==
disp
,
"V_DISPATCH(var) != disp
\n
"
);
VariantClear
(
&
var
);
hres
=
IDispatch_QueryInterface
(
disp
,
&
IID_IDispatchEx
,
(
void
**
)
&
dispex
);
IDispatch_Release
(
disp
);
ok
(
hres
==
S_OK
,
"Could not get IDispatchEx iface: %08x
\n
"
,
hres
);
/* FIXME: Test InvokeEx(DISPATCH_METHOD) */
memset
(
&
dp
,
0
,
sizeof
(
dp
));
memset
(
&
ei
,
0
,
sizeof
(
ei
));
VariantInit
(
&
var
);
hres
=
IDispatchEx_Invoke
(
dispex
,
DISPID_VALUE
,
&
IID_NULL
,
LOCALE_NEUTRAL
,
DISPATCH_METHOD
,
&
dp
,
&
var
,
&
ei
,
NULL
);
ok
(
hres
==
S_OK
,
"InvokeEx failed: %08x
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_BSTR
,
"V_VT(var)=%d
\n
"
,
V_VT
(
&
var
));
ok
(
!
strcmp_wa
(
V_BSTR
(
&
var
),
"[object]"
),
"V_BSTR(var) = %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
var
)));
VariantClear
(
&
var
);
dp
.
cArgs
=
1
;
dp
.
rgvarg
=
&
var
;
dp
.
cNamedArgs
=
1
;
dp
.
rgdispidNamedArgs
=
&
propput_arg
;
V_VT
(
&
var
)
=
VT_I4
;
V_I4
(
&
var
)
=
100
;
hres
=
IDispatchEx_InvokeEx
(
obj
,
id
,
LOCALE_NEUTRAL
,
DISPATCH_PROPERTYPUT
,
&
dp
,
NULL
,
&
ei
,
NULL
);
ok
(
hres
==
E_NOTIMPL
,
"InvokeEx failed: %08x
\n
"
,
hres
);
IDispatchEx_Release
(
dispex
);
}
static
HRESULT
WINAPI
ActiveScriptParse_ParseScriptText
(
IActiveScriptParse
*
iface
,
LPCOLESTR
pstrCode
,
LPCOLESTR
pstrItemName
,
IUnknown
*
punkContext
,
LPCOLESTR
pstrDelimiter
,
CTXARG_T
dwSourceContextCookie
,
ULONG
ulStartingLine
,
DWORD
dwFlags
,
VARIANT
*
pvarResult
,
EXCEPINFO
*
pexcepinfo
)
{
IDispatchEx
*
document
;
IDispatchEx
*
document
,
*
dispex
;
IHTMLWindow2
*
window
;
IOmNavigator
*
navigator
;
IUnknown
*
unk
;
VARIANT
var
,
arg
;
DISPPARAMS
dp
;
...
...
@@ -737,6 +820,20 @@ static HRESULT WINAPI ActiveScriptParse_ParseScriptText(IActiveScriptParse *ifac
IDispatchEx_Release
(
document
);
hres
=
IDispatchEx_QueryInterface
(
window_dispex
,
&
IID_IHTMLWindow2
,
(
void
**
)
&
window
);
ok
(
hres
==
S_OK
,
"Could not get IHTMLWindow2 iface: %08x
\n
"
,
hres
);
hres
=
IHTMLWindow2_get_navigator
(
window
,
&
navigator
);
IHTMLWindow2_Release
(
window
);
ok
(
hres
==
S_OK
,
"get_navigator failed: %08x
\n
"
,
hres
);
hres
=
IOmNavigator_QueryInterface
(
navigator
,
&
IID_IDispatchEx
,
(
void
**
)
&
dispex
);
IOmNavigator_Release
(
navigator
);
ok
(
hres
==
S_OK
,
"Could not get IDispatchEx iface: %08x
\n
"
,
hres
);
test_func
(
dispex
);
IDispatchEx_Release
(
dispex
);
return
S_OK
;
}
...
...
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