ReactOS 0.4.15-dev-7931-gfd331f1
main.c File Reference
#include "wine/test.h"
#include <stdio.h>
#include "initguid.h"
#include <oleacc.h>
Include dependency graph for main.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define DEFINE_EXPECT(func)    static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
 
#define SET_EXPECT(func)    do { called_ ## func = FALSE; expect_ ## func = TRUE; } while(0)
 
#define CHECK_EXPECT2(func)
 
#define CHECK_EXPECT(func)
 
#define CHECK_CALLED(func)
 

Functions

 DEFINE_EXPECT (Accessible_QI_IEnumVARIANT)
 
 DEFINE_EXPECT (Accessible_get_accChildCount)
 
 DEFINE_EXPECT (Accessible_get_accChild)
 
static HANDLE (WINAPI *pGetProcessHandleFromHwnd)(HWND)
 
static BOOL init (void)
 
static HRESULT WINAPI Accessible_QueryInterface (IAccessible *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI Accessible_AddRef (IAccessible *iface)
 
static ULONG WINAPI Accessible_Release (IAccessible *iface)
 
static HRESULT WINAPI Accessible_GetTypeInfoCount (IAccessible *iface, UINT *pctinfo)
 
static HRESULT WINAPI Accessible_GetTypeInfo (IAccessible *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI Accessible_GetIDsOfNames (IAccessible *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI Accessible_Invoke (IAccessible *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI Accessible_get_accParent (IAccessible *iface, IDispatch **ppdispParent)
 
static HRESULT WINAPI Accessible_get_accChildCount (IAccessible *iface, LONG *pcountChildren)
 
static HRESULT WINAPI Accessible_get_accChild (IAccessible *iface, VARIANT varChildID, IDispatch **ppdispChild)
 
static HRESULT WINAPI Accessible_get_accName (IAccessible *iface, VARIANT varID, BSTR *pszName)
 
static HRESULT WINAPI Accessible_get_accValue (IAccessible *iface, VARIANT varID, BSTR *pszValue)
 
static HRESULT WINAPI Accessible_get_accDescription (IAccessible *iface, VARIANT varID, BSTR *pszDescription)
 
static HRESULT WINAPI Accessible_get_accRole (IAccessible *iface, VARIANT varID, VARIANT *pvarRole)
 
static HRESULT WINAPI Accessible_get_accState (IAccessible *iface, VARIANT varID, VARIANT *pvarState)
 
static HRESULT WINAPI Accessible_get_accHelp (IAccessible *iface, VARIANT varID, BSTR *pszHelp)
 
static HRESULT WINAPI Accessible_get_accHelpTopic (IAccessible *iface, BSTR *pszHelpFile, VARIANT varID, LONG *pidTopic)
 
static HRESULT WINAPI Accessible_get_accKeyboardShortcut (IAccessible *iface, VARIANT varID, BSTR *pszKeyboardShortcut)
 
static HRESULT WINAPI Accessible_get_accFocus (IAccessible *iface, VARIANT *pvarID)
 
static HRESULT WINAPI Accessible_get_accSelection (IAccessible *iface, VARIANT *pvarID)
 
static HRESULT WINAPI Accessible_get_accDefaultAction (IAccessible *iface, VARIANT varID, BSTR *pszDefaultAction)
 
static HRESULT WINAPI Accessible_accSelect (IAccessible *iface, LONG flagsSelect, VARIANT varID)
 
static HRESULT WINAPI Accessible_accLocation (IAccessible *iface, LONG *pxLeft, LONG *pyTop, LONG *pcxWidth, LONG *pcyHeight, VARIANT varID)
 
static HRESULT WINAPI Accessible_accNavigate (IAccessible *iface, LONG navDir, VARIANT varStart, VARIANT *pvarEnd)
 
static HRESULT WINAPI Accessible_accHitTest (IAccessible *iface, LONG xLeft, LONG yTop, VARIANT *pvarID)
 
static HRESULT WINAPI Accessible_accDoDefaultAction (IAccessible *iface, VARIANT varID)
 
static HRESULT WINAPI Accessible_put_accName (IAccessible *iface, VARIANT varID, BSTR pszName)
 
static HRESULT WINAPI Accessible_put_accValue (IAccessible *iface, VARIANT varID, BSTR pszValue)
 
static void test_getroletext (void)
 
static void test_GetStateText (void)
 
static HRESULT WINAPI Object_QueryInterface (IUnknown *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI Object_AddRef (IUnknown *iface)
 
static ULONG WINAPI Object_Release (IUnknown *iface)
 
static void test_LresultFromObject (const char *name)
 
static LRESULT WINAPI test_window_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static BOOL register_window_class (void)
 
static void unregister_window_class (void)
 
static void test_AccessibleObjectFromWindow (void)
 
static void test_GetProcessHandleFromHwnd (void)
 
static void test_AccessibleChildren (IAccessible *acc)
 
static void test_default_client_accessible_object (void)
 
static void test_CAccPropServices (void)
 
 START_TEST (main)
 

Variables

static IAccessibleVtbl AccessibleVtbl
 
static IAccessible Accessible = {&AccessibleVtbl}
 
static int Object_ref = 1
 
static IUnknownVtbl ObjectVtbl
 
static IUnknown Object = {&ObjectVtbl}
 

Macro Definition Documentation

◆ CHECK_CALLED

#define CHECK_CALLED (   func)
Value:
do { \
ok(called_ ## func, "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
#define FALSE
Definition: types.h:117
GLenum func
Definition: glext.h:6028
#define expect_(expected, got, precision)
Definition: font.c:29

Definition at line 47 of file main.c.

◆ CHECK_EXPECT

#define CHECK_EXPECT (   func)
Value:
do { \
CHECK_EXPECT2(func); \
expect_ ## func = FALSE; \
}while(0)

Definition at line 41 of file main.c.

◆ CHECK_EXPECT2

#define CHECK_EXPECT2 (   func)
Value:
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \
}while(0)
#define TRUE
Definition: types.h:120

Definition at line 35 of file main.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file main.c.

◆ DEFINE_EXPECT

#define DEFINE_EXPECT (   func)     static BOOL expect_ ## func = FALSE, called_ ## func = FALSE

Definition at line 29 of file main.c.

◆ SET_EXPECT

#define SET_EXPECT (   func)     do { called_ ## func = FALSE; expect_ ## func = TRUE; } while(0)

Definition at line 32 of file main.c.

Function Documentation

◆ Accessible_accDoDefaultAction()

static HRESULT WINAPI Accessible_accDoDefaultAction ( IAccessible iface,
VARIANT  varID 
)
static

Definition at line 253 of file main.c.

255{
256 ok(0, "unexpected call\n");
257 return E_NOTIMPL;
258}
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Accessible_accHitTest()

static HRESULT WINAPI Accessible_accHitTest ( IAccessible iface,
LONG  xLeft,
LONG  yTop,
VARIANT pvarID 
)
static

Definition at line 246 of file main.c.

248{
249 ok(0, "unexpected call\n");
250 return E_NOTIMPL;
251}

◆ Accessible_accLocation()

static HRESULT WINAPI Accessible_accLocation ( IAccessible iface,
LONG pxLeft,
LONG pyTop,
LONG pcxWidth,
LONG pcyHeight,
VARIANT  varID 
)
static

Definition at line 232 of file main.c.

234{
235 ok(0, "unexpected call\n");
236 return E_NOTIMPL;
237}

◆ Accessible_accNavigate()

static HRESULT WINAPI Accessible_accNavigate ( IAccessible iface,
LONG  navDir,
VARIANT  varStart,
VARIANT pvarEnd 
)
static

Definition at line 239 of file main.c.

241{
242 ok(0, "unexpected call\n");
243 return E_NOTIMPL;
244}

◆ Accessible_accSelect()

static HRESULT WINAPI Accessible_accSelect ( IAccessible iface,
LONG  flagsSelect,
VARIANT  varID 
)
static

Definition at line 225 of file main.c.

227{
228 ok(0, "unexpected call\n");
229 return E_NOTIMPL;
230}

◆ Accessible_AddRef()

static ULONG WINAPI Accessible_AddRef ( IAccessible iface)
static

Definition at line 84 of file main.c.

85{
86 return 2;
87}

◆ Accessible_get_accChild()

static HRESULT WINAPI Accessible_get_accChild ( IAccessible iface,
VARIANT  varChildID,
IDispatch **  ppdispChild 
)
static

Definition at line 138 of file main.c.

140{
142 ok(V_VT(&varChildID) == VT_I4, "V_VT(&varChildID) = %d\n", V_VT(&varChildID));
143 ok(V_I4(&varChildID) == 1, "V_I4(&varChildID) = %d\n", V_I4(&varChildID));
144
145 *ppdispChild = NULL;
146 return S_OK;
147}
#define NULL
Definition: types.h:112
@ VT_I4
Definition: compat.h:2298
#define S_OK
Definition: intsafe.h:52
#define CHECK_EXPECT(func)
Definition: main.c:41
static HRESULT WINAPI Accessible_get_accChild(IAccessible *iface, VARIANT varChildID, IDispatch **ppdispChild)
Definition: main.c:138
#define V_VT(A)
Definition: oleauto.h:211
#define V_I4(A)
Definition: oleauto.h:247

Referenced by Accessible_get_accChild(), and test_AccessibleChildren().

◆ Accessible_get_accChildCount()

static HRESULT WINAPI Accessible_get_accChildCount ( IAccessible iface,
LONG pcountChildren 
)
static

Definition at line 130 of file main.c.

132{
134 *pcountChildren = 1;
135 return S_OK;
136}
static HRESULT WINAPI Accessible_get_accChildCount(IAccessible *iface, LONG *pcountChildren)
Definition: main.c:130

Referenced by Accessible_get_accChildCount(), and test_AccessibleChildren().

◆ Accessible_get_accDefaultAction()

static HRESULT WINAPI Accessible_get_accDefaultAction ( IAccessible iface,
VARIANT  varID,
BSTR pszDefaultAction 
)
static

Definition at line 218 of file main.c.

220{
221 ok(0, "unexpected call\n");
222 return E_NOTIMPL;
223}

◆ Accessible_get_accDescription()

static HRESULT WINAPI Accessible_get_accDescription ( IAccessible iface,
VARIANT  varID,
BSTR pszDescription 
)
static

Definition at line 163 of file main.c.

165{
166 ok(0, "unexpected call\n");
167 return E_NOTIMPL;
168}

◆ Accessible_get_accFocus()

static HRESULT WINAPI Accessible_get_accFocus ( IAccessible iface,
VARIANT pvarID 
)
static

Definition at line 205 of file main.c.

206{
207 ok(0, "unexpected call\n");
208 return E_NOTIMPL;
209}

◆ Accessible_get_accHelp()

static HRESULT WINAPI Accessible_get_accHelp ( IAccessible iface,
VARIANT  varID,
BSTR pszHelp 
)
static

Definition at line 184 of file main.c.

186{
187 ok(0, "unexpected call\n");
188 return E_NOTIMPL;
189}

◆ Accessible_get_accHelpTopic()

static HRESULT WINAPI Accessible_get_accHelpTopic ( IAccessible iface,
BSTR pszHelpFile,
VARIANT  varID,
LONG pidTopic 
)
static

Definition at line 191 of file main.c.

193{
194 ok(0, "unexpected call\n");
195 return E_NOTIMPL;
196}

◆ Accessible_get_accKeyboardShortcut()

static HRESULT WINAPI Accessible_get_accKeyboardShortcut ( IAccessible iface,
VARIANT  varID,
BSTR pszKeyboardShortcut 
)
static

Definition at line 198 of file main.c.

200{
201 ok(0, "unexpected call\n");
202 return E_NOTIMPL;
203}

◆ Accessible_get_accName()

static HRESULT WINAPI Accessible_get_accName ( IAccessible iface,
VARIANT  varID,
BSTR pszName 
)
static

Definition at line 149 of file main.c.

151{
152 ok(0, "unexpected call\n");
153 return E_NOTIMPL;
154}

◆ Accessible_get_accParent()

static HRESULT WINAPI Accessible_get_accParent ( IAccessible iface,
IDispatch **  ppdispParent 
)
static

Definition at line 123 of file main.c.

125{
126 ok(0, "unexpected call\n");
127 return E_NOTIMPL;
128}

◆ Accessible_get_accRole()

static HRESULT WINAPI Accessible_get_accRole ( IAccessible iface,
VARIANT  varID,
VARIANT pvarRole 
)
static

Definition at line 170 of file main.c.

172{
173 ok(0, "unexpected call\n");
174 return E_NOTIMPL;
175}

◆ Accessible_get_accSelection()

static HRESULT WINAPI Accessible_get_accSelection ( IAccessible iface,
VARIANT pvarID 
)
static

Definition at line 211 of file main.c.

213{
214 ok(0, "unexpected call\n");
215 return E_NOTIMPL;
216}

◆ Accessible_get_accState()

static HRESULT WINAPI Accessible_get_accState ( IAccessible iface,
VARIANT  varID,
VARIANT pvarState 
)
static

Definition at line 177 of file main.c.

179{
180 ok(0, "unexpected call\n");
181 return E_NOTIMPL;
182}

◆ Accessible_get_accValue()

static HRESULT WINAPI Accessible_get_accValue ( IAccessible iface,
VARIANT  varID,
BSTR pszValue 
)
static

Definition at line 156 of file main.c.

158{
159 ok(0, "unexpected call\n");
160 return E_NOTIMPL;
161}

◆ Accessible_GetIDsOfNames()

static HRESULT WINAPI Accessible_GetIDsOfNames ( IAccessible iface,
REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 108 of file main.c.

110{
111 ok(0, "unexpected call\n");
112 return E_NOTIMPL;
113}

◆ Accessible_GetTypeInfo()

static HRESULT WINAPI Accessible_GetTypeInfo ( IAccessible iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 101 of file main.c.

103{
104 ok(0, "unexpected call\n");
105 return E_NOTIMPL;
106}

◆ Accessible_GetTypeInfoCount()

static HRESULT WINAPI Accessible_GetTypeInfoCount ( IAccessible iface,
UINT pctinfo 
)
static

Definition at line 94 of file main.c.

96{
97 ok(0, "unexpected call\n");
98 return E_NOTIMPL;
99}

◆ Accessible_Invoke()

static HRESULT WINAPI Accessible_Invoke ( IAccessible iface,
DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pDispParams,
VARIANT pVarResult,
EXCEPINFO *  pExcepInfo,
UINT puArgErr 
)
static

Definition at line 115 of file main.c.

118{
119 ok(0, "unexpected call\n");
120 return E_NOTIMPL;
121}

◆ Accessible_put_accName()

static HRESULT WINAPI Accessible_put_accName ( IAccessible iface,
VARIANT  varID,
BSTR  pszName 
)
static

Definition at line 260 of file main.c.

262{
263 ok(0, "unexpected call\n");
264 return E_NOTIMPL;
265}

◆ Accessible_put_accValue()

static HRESULT WINAPI Accessible_put_accValue ( IAccessible iface,
VARIANT  varID,
BSTR  pszValue 
)
static

Definition at line 267 of file main.c.

269{
270 ok(0, "unexpected call\n");
271 return E_NOTIMPL;
272}

◆ Accessible_QueryInterface()

static HRESULT WINAPI Accessible_QueryInterface ( IAccessible iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 72 of file main.c.

74{
75 if(IsEqualIID(riid, &IID_IEnumVARIANT)) {
76 CHECK_EXPECT(Accessible_QI_IEnumVARIANT);
77 return E_NOINTERFACE;
78 }
79
80 ok(0, "unexpected QI call: %s\n", wine_dbgstr_guid(riid));
81 return E_NOTIMPL;
82}
REFIID riid
Definition: atlbase.h:39
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ Accessible_Release()

static ULONG WINAPI Accessible_Release ( IAccessible iface)
static

Definition at line 89 of file main.c.

90{
91 return 1;
92}

◆ DEFINE_EXPECT() [1/3]

DEFINE_EXPECT ( Accessible_get_accChild  )

◆ DEFINE_EXPECT() [2/3]

DEFINE_EXPECT ( Accessible_get_accChildCount  )

◆ DEFINE_EXPECT() [3/3]

DEFINE_EXPECT ( Accessible_QI_IEnumVARIANT  )

◆ HANDLE()

static HANDLE ( WINAPI pGetProcessHandleFromHwnd)
static

◆ init()

static BOOL init ( void  )
static

Definition at line 59 of file main.c.

60{
61 HMODULE oleacc = GetModuleHandleA("oleacc.dll");
62
63 pGetProcessHandleFromHwnd = (void*)GetProcAddress(oleacc, "GetProcessHandleFromHwnd");
64 if(!pGetProcessHandleFromHwnd) {
65 win_skip("GetProcessHandleFromHwnd not available\n");
66 return FALSE;
67 }
68
69 return TRUE;
70}
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define win_skip
Definition: test.h:160

◆ Object_AddRef()

static ULONG WINAPI Object_AddRef ( IUnknown iface)
static

Definition at line 496 of file main.c.

497{
499}
#define InterlockedIncrement
Definition: armddk.h:53
static int Object_ref
Definition: main.c:485

◆ Object_QueryInterface()

static HRESULT WINAPI Object_QueryInterface ( IUnknown iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 486 of file main.c.

487{
489 *ppv = iface;
490 IUnknown_AddRef(iface);
491 return S_OK;
492 }
493 return E_NOINTERFACE;
494}
const GUID IID_IUnknown
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ Object_Release()

static ULONG WINAPI Object_Release ( IUnknown iface)
static

Definition at line 501 of file main.c.

502{
504}
#define InterlockedDecrement
Definition: armddk.h:52

◆ register_window_class()

static BOOL register_window_class ( void  )
static

Definition at line 578 of file main.c.

579{
580 WNDCLASSA cls;
581
582 memset(&cls, 0, sizeof(cls));
584 cls.lpszClassName = "oleacc_test";
586
587 return RegisterClassA(&cls);
588}
static LRESULT WINAPI test_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: main.c:554
#define memset(x, y, z)
Definition: compat.h:39
HINSTANCE hInstance
Definition: winuser.h:3167
LPCSTR lpszClassName
Definition: winuser.h:3172
WNDPROC lpfnWndProc
Definition: winuser.h:3164
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( main  )

Definition at line 979 of file main.c.

980{
981 int argc;
982 char **argv;
983
984 if(!init())
985 return;
986
988
990 if(argc == 4 && !strcmp(argv[2], "ObjectFromLresult")) {
991 IUnknown *unk;
993 LRESULT lres;
994
995 lres = _strtoi64( argv[3], NULL, 16 );
996 hres = ObjectFromLresult(lres, &IID_IUnknown, 0, (void**)&unk);
997 ok(hres == S_OK, "hres = %x\n", hres);
998 IUnknown_Release(unk);
999
1001 return;
1002 }
1003
1004 if(!register_window_class()) {
1005 skip("can't register test window class\n");
1006 return;
1007 }
1008
1016
1019
1023}
static int argc
Definition: ServiceArgs.c:12
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define skip(...)
Definition: atltest.h:64
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT WINAPI ObjectFromLresult(LRESULT result, REFIID riid, WPARAM wParam, void **ppObject)
Definition: main.c:177
HRESULT hres
Definition: protocol.c:465
static void test_GetProcessHandleFromHwnd(void)
Definition: main.c:624
static void test_LresultFromObject(const char *name)
Definition: main.c:514
static BOOL register_window_class(void)
Definition: main.c:578
static void test_CAccPropServices(void)
Definition: main.c:967
static IAccessible Accessible
Definition: main.c:305
static void test_default_client_accessible_object(void)
Definition: main.c:727
static void test_getroletext(void)
Definition: main.c:307
static void test_AccessibleObjectFromWindow(void)
Definition: main.c:595
static void test_AccessibleChildren(IAccessible *acc)
Definition: main.c:642
static void unregister_window_class(void)
Definition: main.c:590
static void test_GetStateText(void)
Definition: main.c:419
#define argv
Definition: mplay32.c:18
@ COINIT_MULTITHREADED
Definition: objbase.h:279
int winetest_get_mainargs(char ***pargv)
__int64 _strtoi64(const char *nptr, char **endptr, int base)
Definition: strtoi64.c:90
LONG_PTR LRESULT
Definition: windef.h:209
static int init
Definition: wintirpc.c:33

◆ test_AccessibleChildren()

static void test_AccessibleChildren ( IAccessible acc)
static

Definition at line 642 of file main.c.

643{
644 VARIANT children[3];
645 LONG count;
646 HRESULT hr;
647
648 count = -1;
649 hr = AccessibleChildren(NULL, 0, 0, children, &count);
650 ok(hr == E_INVALIDARG, "AccessibleChildren returned %x\n", hr);
651 ok(count == -1, "count = %d\n", count);
652 hr = AccessibleChildren(acc, 0, 0, NULL, &count);
653 ok(hr == E_INVALIDARG, "AccessibleChildren returned %x\n", hr);
654 ok(count == -1, "count = %d\n", count);
655 hr = AccessibleChildren(acc, 0, 0, children, NULL);
656 ok(hr == E_INVALIDARG, "AccessibleChildren returned %x\n", hr);
657
658 if(acc == &Accessible) {
659 SET_EXPECT(Accessible_QI_IEnumVARIANT);
661 }
662 hr = AccessibleChildren(acc, 0, 0, children, &count);
663 ok(hr == S_OK, "AccessibleChildren returned %x\n", hr);
664 if(acc == &Accessible) {
665 CHECK_CALLED(Accessible_QI_IEnumVARIANT);
667 }
668 ok(!count, "count = %d\n", count);
669 count = -1;
670 if(acc == &Accessible) {
671 SET_EXPECT(Accessible_QI_IEnumVARIANT);
673 }
674 hr = AccessibleChildren(acc, 5, 0, children, &count);
675 ok(hr == S_OK, "AccessibleChildren returned %x\n", hr);
676 if(acc == &Accessible) {
677 CHECK_CALLED(Accessible_QI_IEnumVARIANT);
679 }
680 ok(!count, "count = %d\n", count);
681
682 memset(children, 0xfe, sizeof(children));
683 V_VT(children) = VT_DISPATCH;
684 if(acc == &Accessible) {
685 SET_EXPECT(Accessible_QI_IEnumVARIANT);
688 }
689 hr = AccessibleChildren(acc, 0, 1, children, &count);
690 ok(hr == S_OK, "AccessibleChildren returned %x\n", hr);
691 if(acc == &Accessible) {
692 CHECK_CALLED(Accessible_QI_IEnumVARIANT);
695
696 ok(V_VT(children) == VT_I4, "V_VT(children) = %d\n", V_VT(children));
697 ok(V_I4(children) == 1, "V_I4(children) = %d\n", V_I4(children));
698 }else {
699 ok(V_VT(children) == VT_DISPATCH, "V_VT(children) = %d\n", V_VT(children));
700 IDispatch_Release(V_DISPATCH(children));
701 }
702 ok(count == 1, "count = %d\n", count);
703
704 if(acc == &Accessible) {
705 SET_EXPECT(Accessible_QI_IEnumVARIANT);
708 }
709 hr = AccessibleChildren(acc, 0, 3, children, &count);
710 ok(hr == S_FALSE, "AccessibleChildren returned %x\n", hr);
711 if(acc == &Accessible) {
712 CHECK_CALLED(Accessible_QI_IEnumVARIANT);
715
716 ok(V_VT(children) == VT_I4, "V_VT(children) = %d\n", V_VT(children));
717 ok(V_I4(children) == 1, "V_I4(children) = %d\n", V_I4(children));
718 }else {
719 ok(V_VT(children) == VT_DISPATCH, "V_VT(children) = %d\n", V_VT(children));
720 IDispatch_Release(V_DISPATCH(children));
721 }
722 ok(count == 1, "count = %d\n", count);
723 ok(V_VT(children+1) == VT_EMPTY, "V_VT(children+1) = %d\n", V_VT(children+1));
724 ok(V_VT(children+2) == VT_EMPTY, "V_VT(children+2) = %d\n", V_VT(children+2));
725}
#define E_INVALIDARG
Definition: ddrawi.h:101
@ VT_EMPTY
Definition: compat.h:2295
@ VT_DISPATCH
Definition: compat.h:2304
HRESULT WINAPI AccessibleChildren(IAccessible *container, LONG start, LONG count, VARIANT *children, LONG *children_cnt)
Definition: main.c:601
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define SET_EXPECT(func)
Definition: main.c:32
#define CHECK_CALLED(func)
Definition: main.c:47
#define V_DISPATCH(A)
Definition: oleauto.h:239
long LONG
Definition: pedump.c:60
HRESULT hr
Definition: shlfolder.c:183
#define S_FALSE
Definition: winerror.h:2357

Referenced by START_TEST(), and test_default_client_accessible_object().

◆ test_AccessibleObjectFromWindow()

static void test_AccessibleObjectFromWindow ( void  )
static

Definition at line 595 of file main.c.

596{
597 IUnknown *unk;
598 HRESULT hr;
599 HWND hwnd;
600
602 ok(hr == E_INVALIDARG, "got %x\n", hr);
603
605 todo_wine ok(hr == S_OK, "got %x\n", hr);
606 if(hr == S_OK) IUnknown_Release(unk);
607
608 hwnd = CreateWindowA("oleacc_test", "test", WS_OVERLAPPEDWINDOW,
609 0, 0, 0, 0, NULL, NULL, NULL, NULL);
610 ok(hwnd != NULL, "CreateWindow failed\n");
611
613 ok(hr == E_UNEXPECTED, "got %x\n", hr);
614
615 ok(Object_ref == 1, "Object_ref = %d\n", Object_ref);
617 ok(hr == S_OK, "got %x\n", hr);
618 ok(Object_ref == 2, "Object_ref = %d\n", Object_ref);
619 IUnknown_Release(unk);
620
622}
HRESULT WINAPI AccessibleObjectFromWindow(HWND hwnd, DWORD dwObjectID, REFIID riid, void **ppvObject)
Definition: main.c:349
#define todo_wine
Definition: custom.c:79
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define OBJID_CURSOR
Definition: winable.h:24
#define OBJID_CLIENT
Definition: winable.h:19
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define E_UNEXPECTED
Definition: winerror.h:2456
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4315
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by START_TEST().

◆ test_CAccPropServices()

static void test_CAccPropServices ( void  )
static

Definition at line 967 of file main.c.

968{
969 IAccPropServices *acc_prop_services;
971
972 hres = CoCreateInstance(&CLSID_CAccPropServices, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
973 &IID_IAccPropServices, (void**)&acc_prop_services);
974 ok(hres == S_OK, "Could not create CAccPropServices instance: %08x\n", hres);
975
976 IAccPropServices_Release(acc_prop_services);
977}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325

Referenced by START_TEST().

◆ test_default_client_accessible_object()

static void test_default_client_accessible_object ( void  )
static

Definition at line 727 of file main.c.

728{
729 static const WCHAR testW[] = {'t','e','s','t',' ','t',' ','&','j','u','n','k',0};
730 static const WCHAR shortcutW[] = {'A','l','t','+','t',0};
731
732 IAccessible *acc;
733 IDispatch *disp;
734 IOleWindow *ow;
735 IEnumVARIANT *ev;
736 HWND chld, hwnd, hwnd2;
737 HRESULT hr;
738 VARIANT vid, v;
739 BSTR str;
740 POINT pt;
741 RECT rect;
743 ULONG fetched;
744
745 hwnd = CreateWindowA("oleacc_test", "test &t &junk", WS_OVERLAPPEDWINDOW,
746 0, 0, 100, 100, NULL, NULL, NULL, NULL);
747 ok(hwnd != NULL, "CreateWindow failed\n");
748 chld = CreateWindowA("static", "message", WS_CHILD | WS_VISIBLE,
749 0, 0, 50, 50, hwnd, NULL, NULL, NULL);
750 ok(chld != NULL, "CreateWindow failed\n");
751
752 hr = CreateStdAccessibleObject(NULL, OBJID_CLIENT, &IID_IAccessible, (void**)&acc);
753 ok(hr == E_FAIL, "got %x\n", hr);
754
755 hr = CreateStdAccessibleObject(hwnd, OBJID_CLIENT, &IID_IAccessible, (void**)&acc);
756 ok(hr == S_OK, "got %x\n", hr);
757
758 hr = IAccessible_QueryInterface(acc, &IID_IOleWindow, (void**)&ow);
759 ok(hr == S_OK, "got %x\n", hr);
760 hr = IOleWindow_GetWindow(ow, &hwnd2);
761 ok(hr == S_OK, "got %x\n", hr);
762 ok(hwnd == hwnd2, "hwnd2 = %p, expected %p\n", hwnd2, hwnd);
763 hr = WindowFromAccessibleObject(acc, &hwnd2);
764 ok(hr == S_OK, "got %x\n", hr);
765 ok(hwnd == hwnd2, "hwnd2 = %p, expected %p\n", hwnd2, hwnd);
766 IOleWindow_Release(ow);
767
768 hr = IAccessible_get_accChildCount(acc, &l);
769 ok(hr == S_OK, "got %x\n", hr);
770 ok(l == 1, "l = %d\n", l);
771
772 V_VT(&vid) = VT_I4;
773 V_I4(&vid) = CHILDID_SELF;
774 disp = (void*)0xdeadbeef;
775 hr = IAccessible_get_accChild(acc, vid, &disp);
776 ok(hr == E_INVALIDARG, "get_accChild returned %x\n", hr);
777 ok(disp == NULL, "disp = %p\n", disp);
778
779 V_I4(&vid) = 1;
780 disp = (void*)0xdeadbeef;
781 hr = IAccessible_get_accChild(acc, vid, &disp);
782 ok(hr == E_INVALIDARG, "get_accChild returned %x\n", hr);
783 ok(disp == NULL, "disp = %p\n", disp);
784
785 hr = IAccessible_QueryInterface(acc, &IID_IEnumVARIANT, (void**)&ev);
786 ok(hr == S_OK, "got %x\n", hr);
787
788 hr = IEnumVARIANT_Skip(ev, 100);
789 ok(hr == S_FALSE, "Skip returned %x\n", hr);
790
791 V_VT(&v) = VT_I4;
792 fetched = 1;
793 hr = IEnumVARIANT_Next(ev, 1, &v, &fetched);
794 ok(hr == S_FALSE, "got %x\n", hr);
795 ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v));
796 ok(fetched == 0, "fetched = %d\n", fetched);
797
798 hr = IEnumVARIANT_Reset(ev);
799 ok(hr == S_OK, "got %x\n", hr);
800
801 V_VT(&v) = VT_I4;
802 fetched = 2;
803 hr = IEnumVARIANT_Next(ev, 1, &v, &fetched);
804 ok(hr == S_OK, "got %x\n", hr);
805 ok(V_VT(&v) == VT_DISPATCH, "V_VT(&v) = %d\n", V_VT(&v));
806 IDispatch_Release(V_DISPATCH(&v));
807 ok(fetched == 1, "fetched = %d\n", fetched);
808 IEnumVARIANT_Release(ev);
809
811
812 V_VT(&vid) = VT_I4;
813 V_I4(&vid) = CHILDID_SELF;
814 hr = IAccessible_get_accName(acc, vid, &str);
815 ok(hr == S_OK, "got %x\n", hr);
816 ok(!lstrcmpW(str, testW), "name = %s\n", wine_dbgstr_w(str));
818
819 V_I4(&vid) = 1;
820 str = (void*)0xdeadbeef;
821 hr = IAccessible_get_accName(acc, vid, &str);
822 ok(hr == E_INVALIDARG, "got %x\n", hr);
823 ok(!str, "str != NULL\n");
824 V_I4(&vid) = CHILDID_SELF;
825
826 str = (void*)0xdeadbeef;
827 hr = IAccessible_get_accValue(acc, vid, &str);
828 ok(hr == S_FALSE, "got %x\n", hr);
829 ok(!str, "str != NULL\n");
830
831 str = (void*)0xdeadbeef;
832 hr = IAccessible_get_accDescription(acc, vid, &str);
833 ok(hr == S_FALSE, "got %x\n", hr);
834 ok(!str, "str != NULL\n");
835
836 V_VT(&v) = VT_DISPATCH;
837 V_DISPATCH(&v) = (void*)0xdeadbeef;
838 hr = IAccessible_get_accRole(acc, vid, &v);
839 ok(hr == S_OK, "got %x\n", hr);
840 ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v));
841 ok(V_I4(&v) == ROLE_SYSTEM_CLIENT, "V_I4(&v) = %d\n", V_I4(&v));
842
843 V_VT(&v) = VT_DISPATCH;
844 V_DISPATCH(&v) = (void*)0xdeadbeef;
845 hr = IAccessible_get_accState(acc, vid, &v);
846 ok(hr == S_OK, "got %x\n", hr);
847 ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v));
849 "V_I4(&v) = %x\n", V_I4(&v));
850
851 str = (void*)0xdeadbeef;
852 hr = IAccessible_get_accHelp(acc, vid, &str);
853 ok(hr == S_FALSE, "got %x\n", hr);
854 ok(!str, "str != NULL\n");
855
856 hr = IAccessible_get_accKeyboardShortcut(acc, vid, &str);
857 ok(hr == S_OK, "got %x\n", hr);
858 ok(!lstrcmpW(str, shortcutW), "str = %s\n", wine_dbgstr_w(str));
860
861 str = (void*)0xdeadbeef;
862 hr = IAccessible_get_accDefaultAction(acc, vid, &str);
863 ok(hr == S_FALSE, "got %x\n", hr);
864 ok(!str, "str != NULL\n");
865
866 pt.x = pt.y = 60;
867 ok(ClientToScreen(hwnd, &pt), "ClientToScreen failed\n");
868 hr = IAccessible_accHitTest(acc, pt.x, pt.y, &v);
869 ok(hr == S_OK, "got %x\n", hr);
870 ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v));
871 ok(V_I4(&v) == 0, "V_I4(&v) = %d\n", V_I4(&v));
872
873 pt.x = pt.y = 25;
874 ok(ClientToScreen(hwnd, &pt), "ClientToScreen failed\n");
875 hr = IAccessible_accHitTest(acc, pt.x, pt.y, &v);
876 ok(hr == S_OK, "got %x\n", hr);
877 ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v));
878 ok(V_I4(&v) == 0, "V_I4(&v) = %d\n", V_I4(&v));
879
881 pt.x = pt.y = 60;
882 ok(ClientToScreen(hwnd, &pt), "ClientToScreen failed\n");
883 hr = IAccessible_accHitTest(acc, pt.x, pt.y, &v);
884 ok(hr == S_OK, "got %x\n", hr);
885 ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v));
886 ok(V_I4(&v) == 0, "V_I4(&v) = %d\n", V_I4(&v));
887
888 pt.x = pt.y = 25;
889 ok(ClientToScreen(hwnd, &pt), "ClientToScreen failed\n");
890 hr = IAccessible_accHitTest(acc, pt.x, pt.y, &v);
891 ok(hr == S_OK, "got %x\n", hr);
892 ok(V_VT(&v) == VT_DISPATCH, "V_VT(&v) = %d\n", V_VT(&v));
893 ok(V_DISPATCH(&v) != NULL, "V_DISPATCH(&v) = %p\n", V_DISPATCH(&v));
894 VariantClear(&v);
895
896 ShowWindow(chld, FALSE);
897 pt.x = pt.y = 25;
898 ok(ClientToScreen(hwnd, &pt), "ClientToScreen failed\n");
899 hr = IAccessible_accHitTest(acc, pt.x, pt.y, &v);
900 ok(hr == S_OK, "got %x\n", hr);
901 ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v));
902 ok(V_I4(&v) == 0, "V_I4(&v) = %d\n", V_I4(&v));
903
904 hr = IAccessible_get_accParent(acc, &disp);
905 ok(hr == S_OK, "got %x\n", hr);
906 ok(disp != NULL, "disp == NULL\n");
907 IDispatch_Release(disp);
908
909 ok(GetClientRect(hwnd, &rect), "GetClientRect failed\n");
910 pt.x = rect.left;
911 pt.y = rect.top;
913 rect.left = pt.x;
914 rect.top = pt.y;
915 pt.x = rect.right;
916 pt.y = rect.bottom;
918 hr = IAccessible_accLocation(acc, &left, &top, &width, &height, vid);
919 ok(hr == S_OK, "got %x\n", hr);
920 ok(left == rect.left, "left = %d, expected %d\n", left, rect.left);
921 ok(top == rect.top, "top = %d, expected %d\n", top, rect.top);
922 ok(width == pt.x-rect.left, "width = %d, expected %d\n", width, pt.x-rect.left);
923 ok(height == pt.y-rect.top, "height = %d, expected %d\n", height, pt.y-rect.top);
924
926
927 hr = IAccessible_get_accChildCount(acc, &l);
928 ok(hr == S_OK, "got %x\n", hr);
929 ok(l == 0, "l = %d\n", l);
930
931 hr = IAccessible_get_accName(acc, vid, &str);
932 ok(hr == E_INVALIDARG, "got %x\n", hr);
933
934 hr = IAccessible_get_accValue(acc, vid, &str);
935 ok(hr == S_FALSE, "got %x\n", hr);
936
937 hr = IAccessible_get_accRole(acc, vid, &v);
938 ok(hr == S_OK, "got %x\n", hr);
939 ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v));
940 ok(V_I4(&v) == ROLE_SYSTEM_CLIENT, "V_I4(&v) = %d\n", V_I4(&v));
941
942 hr = IAccessible_get_accState(acc, vid, &v);
943 ok(hr == S_OK, "got %x\n", hr);
944 ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v));
945 ok(V_I4(&v) == STATE_SYSTEM_INVISIBLE, "V_I4(&v) = %x\n", V_I4(&v));
946
947 hr = IAccessible_accHitTest(acc, 200, 200, &v);
948 ok(hr == S_OK, "got %x\n", hr);
949 ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v));
950 ok(V_I4(&v) == 0, "V_I4(&v) = %d\n", V_I4(&v));
951
952 disp = (void*)0xdeadbeef;
953 hr = IAccessible_get_accParent(acc, &disp);
954 ok(hr == E_FAIL, "got %x\n", hr);
955 ok(disp == NULL, "disp = %p\n", disp);
956
957 hr = IAccessible_accLocation(acc, &left, &top, &width, &height, vid);
958 ok(hr == S_OK, "got %x\n", hr);
959 ok(left == 0, "left = %d\n", left);
960 ok(top == 0, "top = %d\n", top);
961 ok(width == 0, "width = %d\n", width);
962 ok(height == 0, "height = %d\n", height);
963
964 IAccessible_Release(acc);
965}
r l[0]
Definition: byte_order.h:168
#define E_FAIL
Definition: ddrawi.h:102
OLECHAR * BSTR
Definition: compat.h:2293
HRESULT WINAPI WindowFromAccessibleObject(IAccessible *acc, HWND *phwnd)
Definition: main.c:372
HRESULT WINAPI CreateStdAccessibleObject(HWND hwnd, LONG idObject, REFIID riidInterface, void **ppvObject)
Definition: main.c:154
#define pt(x, y)
Definition: drawing.c:79
const GLdouble * v
Definition: gl.h:2040
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
static const WCHAR testW[]
Definition: jsregexp.c:44
#define wine_dbgstr_w
Definition: kernel32.h:34
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
const GUID IID_IOleWindow
#define WS_CHILD
Definition: pedump.c:617
#define WS_VISIBLE
Definition: pedump.c:620
const WCHAR * str
& rect
Definition: startmenu.cpp:1413
uint32_t ULONG
Definition: typedefs.h:59
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
#define CHILDID_SELF
Definition: winable.h:14
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define STATE_SYSTEM_FOCUSABLE
Definition: winuser.h:2882
#define STATE_SYSTEM_INVISIBLE
Definition: winuser.h:2877
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ test_GetProcessHandleFromHwnd()

static void test_GetProcessHandleFromHwnd ( void  )
static

Definition at line 624 of file main.c.

625{
626 HANDLE proc;
627 HWND hwnd;
628
629 proc = pGetProcessHandleFromHwnd(NULL);
630 ok(!proc, "proc = %p\n", proc);
631
632 hwnd = CreateWindowA("static", "", 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
633 ok(hwnd != NULL, "CreateWindow failed\n");
634
635 proc = pGetProcessHandleFromHwnd(hwnd);
636 ok(proc != NULL, "proc == NULL\n");
638
640}
#define CloseHandle
Definition: compat.h:739
static HANDLE proc()
Definition: pdb.c:34

Referenced by START_TEST().

◆ test_getroletext()

static void test_getroletext ( void  )
static

Definition at line 307 of file main.c.

308{
309 INT ret, role;
310 CHAR buf[2], *buff;
311 WCHAR bufW[2], *buffW;
312
313 /* wrong role number */
314 ret = GetRoleTextA(-1, NULL, 0);
315 ok(ret == 0, "GetRoleTextA doesn't return zero on wrong role number, got %d\n", ret);
316 buf[0] = '*';
317 ret = GetRoleTextA(-1, buf, 2);
318 ok(ret == 0, "GetRoleTextA doesn't return zero on wrong role number, got %d\n", ret);
319 ok(buf[0] == 0, "GetRoleTextA doesn't return NULL char on wrong role number\n");
320 buf[0] = '*';
321 ret = GetRoleTextA(-1, buf, 0);
322 ok(ret == 0, "GetRoleTextA doesn't return zero on wrong role number, got %d\n", ret);
323 ok(buf[0] == '*', "GetRoleTextA modified buffer on wrong role number\n");
324
325 ret = GetRoleTextW(-1, NULL, 0);
326 ok(ret == 0, "GetRoleTextW doesn't return zero on wrong role number, got %d\n", ret);
327 bufW[0] = '*';
328 ret = GetRoleTextW(-1, bufW, 2);
329 ok(ret == 0, "GetRoleTextW doesn't return zero on wrong role number, got %d\n", ret);
330 ok(bufW[0] == '\0', "GetRoleTextW doesn't return NULL char on wrong role number\n");
331 bufW[0] = '*';
332 ret = GetRoleTextW(-1, bufW, 0);
333 ok(ret == 0, "GetRoleTextW doesn't return zero on wrong role number, got %d\n", ret);
334
335 /* zero role number - not documented */
336 ret = GetRoleTextA(0, NULL, 0);
337 ok(ret > 0, "GetRoleTextA doesn't return (>0) for zero role number, got %d\n", ret);
338 ret = GetRoleTextW(0, NULL, 0);
339 ok(ret > 0, "GetRoleTextW doesn't return (>0) for zero role number, got %d\n", ret);
340
341 /* NULL buffer, return length */
342 ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, NULL, 0);
343 ok(ret > 0, "GetRoleTextA doesn't return length on NULL buffer, got %d\n", ret);
344 ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, NULL, 1);
345 ok(ret > 0, "GetRoleTextA doesn't return length on NULL buffer, got %d\n", ret);
346 ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, NULL, 0);
347 ok(ret > 0, "GetRoleTextW doesn't return length on NULL buffer, got %d\n", ret);
348 ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, NULL, 1);
349 ok(ret > 0, "GetRoleTextW doesn't return length on NULL buffer, got %d\n", ret);
350
351 /* use a smaller buffer */
352 bufW[0] = '*';
353 ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, buf, 0);
354 ok(!ret, "GetRoleTextA doesn't return 0, got %d\n", ret);
355 ok(buf[0] == '*', "GetRoleTextA modified buffer\n");
356 buffW = NULL;
357 ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, (WCHAR*)&buffW, 0);
358 ok(ret, "GetRoleTextW doesn't return length\n");
359 ok(buffW != NULL, "GetRoleTextW doesn't modify buffer\n");
360 buf[0] = '*';
361 ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, buf, 1);
362 ok(ret == 0, "GetRoleTextA returned wrong length\n");
363 ok(buf[0] == '\0', "GetRoleTextA returned not zero-length buffer\n");
364 buf[0] = '*';
365 ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, buf, 2);
366 ok(!ret, "GetRoleTextA returned wrong length, got %d, expected 0\n", ret);
367 ok(!buf[0] || broken(buf[0]!='*') /* WinXP */,
368 "GetRoleTextA returned not zero-length buffer : (%c)\n", buf[0]);
369
370 bufW[0] = '*';
371 ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, bufW, 1);
372 ok(ret == 0, "GetRoleTextW returned wrong length, got %d, expected 1\n", ret);
373 ok(bufW[0] == '\0', "GetRoleTextW returned not zero-length buffer\n");
374 bufW[1] = '*';
375 ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, bufW, 2);
376 ok(ret == 1, "GetRoleTextW returned wrong length, got %d, expected 1\n", ret);
377 ok(bufW[1] == '\0', "GetRoleTextW returned not zero-length buffer\n");
378
379 /* use bigger buffer */
380 ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, NULL, 0);
381 buff = HeapAlloc(GetProcessHeap(), 0, 2*ret);
382 buff[2*ret-1] = '*';
383 ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, buff, 2*ret);
384 ok(buff[2*ret-1] == '*', "GetRoleTextA shouldn't modify this part of buffer\n");
386
387 ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, NULL, 0);
388 buffW = HeapAlloc(GetProcessHeap(), 0, 2*ret*sizeof(WCHAR));
389 buffW[2*ret-1] = '*';
390 ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, buffW, 2*ret);
391 ok(buffW[2*ret-1] == '*', "GetRoleTextW shouldn't modify this part of buffer\n");
392 HeapFree(GetProcessHeap(), 0, buffW);
393
394 /* check returned length for all roles */
395 for(role = 0; role <= ROLE_SYSTEM_OUTLINEBUTTON; role++){
396 CHAR buff2[100];
397 WCHAR buff2W[100];
398
399 /* NT4 and W2K don't clear the buffer on a nonexistent role in the A-call */
400 memset(buff2, 0, sizeof(buff2));
401
402 ret = GetRoleTextA(role, NULL, 0);
403 ok(ret > 0, "Expected the role to be present\n");
404
405 GetRoleTextA(role, buff2, sizeof(buff2));
406 ok(ret == lstrlenA(buff2),
407 "GetRoleTextA: returned length doesn't match returned buffer for role %d\n", role);
408
409 /* Win98 and WinMe don't clear the buffer on a nonexistent role in the W-call */
410 memset(buff2W, 0, sizeof(buff2W));
411
412 ret = GetRoleTextW(role, NULL, 0);
413 GetRoleTextW(role, buff2W, ARRAY_SIZE(buff2W));
414 ok(ret == lstrlenW(buff2W),
415 "GetRoleTextW: returned length doesn't match returned buffer for role %d\n", role);
416 }
417}
#define broken(x)
Definition: _sntprintf.h:21
#define ARRAY_SIZE(A)
Definition: main.h:33
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define lstrlenW
Definition: compat.h:750
UINT WINAPI GetRoleTextA(DWORD role, LPSTR lpRole, UINT rolemax)
Definition: main.c:491
UINT WINAPI GetRoleTextW(DWORD role, LPWSTR lpRole, UINT rolemax)
Definition: main.c:471
static unsigned char buff[32768]
Definition: fatten.c:17
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
int32_t INT
Definition: typedefs.h:58
int ret
char CHAR
Definition: xmlstorage.h:175

Referenced by START_TEST().

◆ test_GetStateText()

static void test_GetStateText ( void  )
static

Definition at line 419 of file main.c.

420{
421 WCHAR buf[1024], buf2[1024];
422 char bufa[1024];
423 void *ptr;
424 UINT ret, ret2;
425 int i;
426
427 ret2 = GetStateTextW(0, NULL, 1024);
428 ok(ret2, "GetStateText failed\n");
429
430 ptr = NULL;
431 ret = GetStateTextW(0, (WCHAR*)&ptr, 0);
432 ok(ret == ret2, "got %d, expected %d\n", ret, ret2);
433 ok(ptr != NULL, "ptr was not changed\n");
434
435 ret = GetStateTextW(0, buf, 1024);
436 ok(ret == ret2, "got %d, expected %d\n", ret, ret2);
437 ok(!memcmp(buf, ptr, ret*sizeof(WCHAR)), "got %s, expected %s\n",
439
440 ret = GetStateTextW(0, buf, 1);
441 ok(!ret, "got %d, expected 0\n", ret);
442 ok(!buf[0], "buf[0] = '%c'\n", buf[0]);
443
444 for(i=0; i<31; i++) {
445 ret = GetStateTextW(1<<i, buf, 1024);
446 ok(ret, "%d) GetStateText failed\n", i);
447 }
448 ret = GetStateTextW(1u<<31, buf, 1024);
449 ok(!ret, "31) GetStateText succeeded: %d\n", ret);
450
451 ret = GetStateTextW(2, buf, 1024);
452 ok(ret, "GetStateText failed\n");
453 ret2 = GetStateTextW(3, buf2, 1024);
454 ok(ret2, "GetStateText failed\n");
455 ok(ret == ret2, "got %d, expected %d\n", ret2, ret);
456 ok(!memcmp(buf, buf2, ret*sizeof(WCHAR)),
457 "GetStateText(2,...) returned different data than GetStateText(3,...)\n");
458
459 ret2 = GetStateTextA(0, NULL, 1024);
460 ok(ret2, "GetStateText failed\n");
461
462 ptr = NULL;
463 ret = GetStateTextA(0, (CHAR*)&ptr, 0);
464 ok(!ret, "got %d\n", ret);
465 ok(ptr == NULL, "ptr was changed\n");
466
467 ret = GetStateTextA(0, NULL, 0);
468 ok(ret == ret2, "got %d, expected %d\n", ret, ret2);
469
470 ret = GetStateTextA(0, bufa, 1024);
471 ok(ret == ret2, "got %d, expected %d\n", ret, ret2);
472
473 ret = GetStateTextA(0, bufa, 1);
474 ok(!ret, "got %d, expected 0\n", ret);
475 ok(!bufa[0], "bufa[0] = '%c'\n", bufa[0]);
476
477 for(i=0; i<31; i++) {
478 ret = GetStateTextA(1<<i, bufa, 1024);
479 ok(ret, "%d) GetStateText failed\n", i);
480 }
481 ret = GetStateTextA(1u<<31, bufa, 1024);
482 ok(!ret, "31) GetStateText succeeded: %d\n", ret);
483}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
const char * wine_dbgstr_wn(const WCHAR *str, int n)
Definition: compat.c:367
UINT WINAPI GetStateTextW(DWORD state_bit, WCHAR *state_str, UINT state_str_len)
Definition: main.c:539
UINT WINAPI GetStateTextA(DWORD state_bit, CHAR *state_str, UINT state_str_len)
Definition: main.c:569
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static PVOID ptr
Definition: dispmode.c:27
unsigned int UINT
Definition: ndis.h:50

Referenced by START_TEST().

◆ test_LresultFromObject()

static void test_LresultFromObject ( const char name)
static

Definition at line 514 of file main.c.

515{
518 char cmdline[MAX_PATH];
519 IUnknown *unk;
521 LRESULT lres;
522
523 lres = LresultFromObject(NULL, 0, 0);
524 ok(lres == E_INVALIDARG, "got %lx\n", lres);
525
526 hres = ObjectFromLresult(0, &IID_IUnknown, 0, (void**)&unk);
527 ok(hres == E_FAIL, "got %x\n", hres);
528 hres = ObjectFromLresult(0x10000, &IID_IUnknown, 0, (void**)&unk);
529 ok(hres == E_FAIL, "got %x\n", hres);
530
531 ok(Object_ref == 1, "Object_ref = %d\n", Object_ref);
533 ok(SUCCEEDED(lres), "got %lx\n", lres);
534 ok(Object_ref > 1, "Object_ref = %d\n", Object_ref);
535
536 hres = ObjectFromLresult(lres, &IID_IUnknown, 0, (void**)&unk);
537 ok(hres == S_OK, "hres = %x\n", hres);
538 ok(unk == &Object, "unk != &Object\n");
539 IUnknown_Release(unk);
540 ok(Object_ref == 1, "Object_ref = %d\n", Object_ref);
541
543 ok(SUCCEEDED(lres), "got %lx\n", lres);
544 ok(Object_ref > 1, "Object_ref = %d\n", Object_ref);
545
546 sprintf(cmdline, "\"%s\" main ObjectFromLresult %s", name, wine_dbgstr_longlong(lres));
547 memset(&startup, 0, sizeof(startup));
548 startup.cb = sizeof(startup);
551 ok(Object_ref == 1, "Object_ref = %d\n", Object_ref);
552}
static void startup(void)
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4741
LRESULT WINAPI LresultFromObject(REFIID riid, WPARAM wParam, LPUNKNOWN pAcc)
Definition: main.c:249
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define sprintf(buf, format,...)
Definition: sprintf.c:55
void winetest_wait_child_process(HANDLE process)
TCHAR * cmdline
Definition: stretchblt.cpp:32
Definition: name.c:39
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object

Referenced by START_TEST().

◆ test_window_proc()

static LRESULT WINAPI test_window_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 554 of file main.c.

555{
556 switch(msg) {
557 case WM_GETOBJECT:
558 if(lparam == OBJID_QUERYCLASSNAMEIDX) {
559 ok(!wparam, "wparam = %lx\n", wparam);
560 return 0;
561 }
562
563 ok(wparam==0xffffffff, "wparam = %lx\n", wparam);
565 return E_UNEXPECTED;
569 return 0;
570
571 ok(0, "unexpected (%ld)\n", lparam);
572 return 0;
573 }
574
576}
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define msg(x)
Definition: auth_time.c:54
unsigned long DWORD
Definition: ntddk_ex.h:95
#define OBJID_WINDOW
Definition: winable.h:15
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by register_window_class().

◆ unregister_window_class()

static void unregister_window_class ( void  )
static

Definition at line 590 of file main.c.

591{
592 UnregisterClassA("oleacc_test", NULL);
593}
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)

Referenced by START_TEST().

Variable Documentation

◆ Accessible

IAccessible Accessible = {&AccessibleVtbl}
static

Definition at line 305 of file main.c.

Referenced by START_TEST(), and test_AccessibleChildren().

◆ AccessibleVtbl

IAccessibleVtbl AccessibleVtbl
static
Initial value:
= {
}
static HRESULT WINAPI Accessible_accHitTest(IAccessible *iface, LONG xLeft, LONG yTop, VARIANT *pvarID)
Definition: main.c:246
static HRESULT WINAPI Accessible_get_accParent(IAccessible *iface, IDispatch **ppdispParent)
Definition: main.c:123
static HRESULT WINAPI Accessible_accLocation(IAccessible *iface, LONG *pxLeft, LONG *pyTop, LONG *pcxWidth, LONG *pcyHeight, VARIANT varID)
Definition: main.c:232
static HRESULT WINAPI Accessible_get_accRole(IAccessible *iface, VARIANT varID, VARIANT *pvarRole)
Definition: main.c:170
static HRESULT WINAPI Accessible_get_accState(IAccessible *iface, VARIANT varID, VARIANT *pvarState)
Definition: main.c:177
static HRESULT WINAPI Accessible_put_accName(IAccessible *iface, VARIANT varID, BSTR pszName)
Definition: main.c:260
static HRESULT WINAPI Accessible_get_accHelpTopic(IAccessible *iface, BSTR *pszHelpFile, VARIANT varID, LONG *pidTopic)
Definition: main.c:191
static HRESULT WINAPI Accessible_get_accValue(IAccessible *iface, VARIANT varID, BSTR *pszValue)
Definition: main.c:156
static ULONG WINAPI Accessible_Release(IAccessible *iface)
Definition: main.c:89
static HRESULT WINAPI Accessible_get_accKeyboardShortcut(IAccessible *iface, VARIANT varID, BSTR *pszKeyboardShortcut)
Definition: main.c:198
static HRESULT WINAPI Accessible_GetIDsOfNames(IAccessible *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: main.c:108
static HRESULT WINAPI Accessible_put_accValue(IAccessible *iface, VARIANT varID, BSTR pszValue)
Definition: main.c:267
static HRESULT WINAPI Accessible_get_accFocus(IAccessible *iface, VARIANT *pvarID)
Definition: main.c:205
static HRESULT WINAPI Accessible_get_accName(IAccessible *iface, VARIANT varID, BSTR *pszName)
Definition: main.c:149
static ULONG WINAPI Accessible_AddRef(IAccessible *iface)
Definition: main.c:84
static HRESULT WINAPI Accessible_GetTypeInfoCount(IAccessible *iface, UINT *pctinfo)
Definition: main.c:94
static HRESULT WINAPI Accessible_GetTypeInfo(IAccessible *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: main.c:101
static HRESULT WINAPI Accessible_QueryInterface(IAccessible *iface, REFIID riid, void **ppvObject)
Definition: main.c:72
static HRESULT WINAPI Accessible_accNavigate(IAccessible *iface, LONG navDir, VARIANT varStart, VARIANT *pvarEnd)
Definition: main.c:239
static HRESULT WINAPI Accessible_get_accHelp(IAccessible *iface, VARIANT varID, BSTR *pszHelp)
Definition: main.c:184
static HRESULT WINAPI Accessible_get_accDescription(IAccessible *iface, VARIANT varID, BSTR *pszDescription)
Definition: main.c:163
static HRESULT WINAPI Accessible_get_accSelection(IAccessible *iface, VARIANT *pvarID)
Definition: main.c:211
static HRESULT WINAPI Accessible_get_accDefaultAction(IAccessible *iface, VARIANT varID, BSTR *pszDefaultAction)
Definition: main.c:218
static HRESULT WINAPI Accessible_accSelect(IAccessible *iface, LONG flagsSelect, VARIANT varID)
Definition: main.c:225
static HRESULT WINAPI Accessible_accDoDefaultAction(IAccessible *iface, VARIANT varID)
Definition: main.c:253
static HRESULT WINAPI Accessible_Invoke(IAccessible *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: main.c:115

Definition at line 274 of file main.c.

◆ Object

IUnknown Object = {&ObjectVtbl}
static

Definition at line 512 of file main.c.

◆ Object_ref

int Object_ref = 1
static

◆ ObjectVtbl

IUnknownVtbl ObjectVtbl
static
Initial value:
= {
}
static ULONG WINAPI Object_AddRef(IUnknown *iface)
Definition: main.c:496
static ULONG WINAPI Object_Release(IUnknown *iface)
Definition: main.c:501
static HRESULT WINAPI Object_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: main.c:486

Definition at line 506 of file main.c.