oleacc: Implemented GetRoleText[A/W] with tests.
This commit is contained in:
parent
23787fc7d9
commit
e2399a969f
|
@ -24343,6 +24343,14 @@ ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
|
|||
dlls/oleacc/Makefile: dlls/oleacc/Makefile.in dlls/Makedll.rules"
|
||||
ac_config_files="$ac_config_files dlls/oleacc/Makefile"
|
||||
|
||||
ALL_MAKEFILES="$ALL_MAKEFILES \\
|
||||
dlls/oleacc/tests/Makefile"
|
||||
test "x$enable_oleacc_tests" != xno && ALL_TEST_DIRS="$ALL_TEST_DIRS \\
|
||||
oleacc/tests"
|
||||
ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
|
||||
dlls/oleacc/tests/Makefile: dlls/oleacc/tests/Makefile.in dlls/Maketest.rules"
|
||||
ac_config_files="$ac_config_files dlls/oleacc/tests/Makefile"
|
||||
|
||||
ALL_MAKEFILES="$ALL_MAKEFILES \\
|
||||
dlls/oleaut32/Makefile"
|
||||
test "x$enable_oleaut32" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\
|
||||
|
@ -26782,6 +26790,7 @@ do
|
|||
"dlls/ole32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/ole32/Makefile" ;;
|
||||
"dlls/ole32/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/ole32/tests/Makefile" ;;
|
||||
"dlls/oleacc/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/oleacc/Makefile" ;;
|
||||
"dlls/oleacc/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/oleacc/tests/Makefile" ;;
|
||||
"dlls/oleaut32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/oleaut32/Makefile" ;;
|
||||
"dlls/oleaut32/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/oleaut32/tests/Makefile" ;;
|
||||
"dlls/olecli32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/olecli32/Makefile" ;;
|
||||
|
|
|
@ -1952,6 +1952,7 @@ WINE_CONFIG_MAKEFILE([dlls/odbccp32/tests/Makefile],[dlls/Maketest.rules],[dlls]
|
|||
WINE_CONFIG_MAKEFILE([dlls/ole32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
|
||||
WINE_CONFIG_MAKEFILE([dlls/ole32/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS])
|
||||
WINE_CONFIG_MAKEFILE([dlls/oleacc/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
|
||||
WINE_CONFIG_MAKEFILE([dlls/oleacc/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS])
|
||||
WINE_CONFIG_MAKEFILE([dlls/oleaut32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
|
||||
WINE_CONFIG_MAKEFILE([dlls/oleaut32/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS])
|
||||
WINE_CONFIG_MAKEFILE([dlls/olecli32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
|
||||
|
|
|
@ -4,11 +4,13 @@ SRCDIR = @srcdir@
|
|||
VPATH = @srcdir@
|
||||
MODULE = oleacc.dll
|
||||
IMPORTLIB = oleacc
|
||||
IMPORTS = kernel32
|
||||
IMPORTS = user32 kernel32
|
||||
|
||||
C_SRCS = \
|
||||
main.c
|
||||
|
||||
RC_SRCS = oleacc.rc
|
||||
|
||||
@MAKE_DLL_RULES@
|
||||
|
||||
@DEPENDENCIES@ # everything below this line is overwritten by make depend
|
||||
|
|
|
@ -24,10 +24,13 @@
|
|||
#include "winuser.h"
|
||||
#include "ole2.h"
|
||||
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(oleacc);
|
||||
|
||||
static HINSTANCE oleacc_handle = 0;
|
||||
|
||||
HRESULT WINAPI CreateStdAccessibleObject( HWND hwnd, LONG idObject,
|
||||
REFIID riidInterface, void** ppvObject )
|
||||
{
|
||||
|
@ -50,6 +53,21 @@ HRESULT WINAPI AccessibleObjectFromWindow( HWND hwnd, DWORD dwObjectID,
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
|
||||
LPVOID lpvReserved)
|
||||
{
|
||||
TRACE("%p, %d, %p\n", hinstDLL, fdwReason, lpvReserved);
|
||||
|
||||
switch (fdwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
oleacc_handle = hinstDLL;
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HRESULT WINAPI DllRegisterServer(void)
|
||||
{
|
||||
FIXME("\n");
|
||||
|
@ -67,3 +85,59 @@ void WINAPI GetOleaccVersionInfo(DWORD* pVersion, DWORD* pBuild)
|
|||
*pVersion = MAKELONG(2,4); /* Windows XP version of oleacc: 4.2.5406.0 */
|
||||
*pBuild = MAKELONG(0,5406);
|
||||
}
|
||||
|
||||
UINT WINAPI GetRoleTextW(DWORD role, LPWSTR lpRole, UINT rolemax)
|
||||
{
|
||||
INT ret;
|
||||
WCHAR *resptr;
|
||||
|
||||
TRACE("%u %p %u\n", role, lpRole, rolemax);
|
||||
|
||||
/* return role text length */
|
||||
if(!lpRole)
|
||||
return LoadStringW(oleacc_handle, role, (LPWSTR)&resptr, 0);
|
||||
|
||||
ret = LoadStringW(oleacc_handle, role, lpRole, rolemax);
|
||||
if(!(ret > 0)){
|
||||
if(rolemax > 0) lpRole[0] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
UINT WINAPI GetRoleTextA(DWORD role, LPSTR lpRole, UINT rolemax)
|
||||
{
|
||||
UINT length;
|
||||
WCHAR *roletextW;
|
||||
|
||||
TRACE("%u %p %u\n", role, lpRole, rolemax);
|
||||
|
||||
length = GetRoleTextW(role, NULL, 0);
|
||||
if((length == 0) || (lpRole && !rolemax))
|
||||
return 0;
|
||||
|
||||
roletextW = HeapAlloc(GetProcessHeap(), 0, (length + 1)*sizeof(WCHAR));
|
||||
if(!roletextW)
|
||||
return 0;
|
||||
|
||||
GetRoleTextW(role, roletextW, length + 1);
|
||||
|
||||
length = WideCharToMultiByte( CP_ACP, 0, roletextW, -1, NULL, 0, NULL, NULL );
|
||||
|
||||
if(!lpRole){
|
||||
HeapFree(GetProcessHeap(), 0, roletextW);
|
||||
return length - 1;
|
||||
}
|
||||
|
||||
WideCharToMultiByte( CP_ACP, 0, roletextW, -1, lpRole, rolemax, NULL, NULL );
|
||||
|
||||
if(rolemax < length){
|
||||
lpRole[rolemax-1] = '\0';
|
||||
length = rolemax;
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, roletextW);
|
||||
|
||||
return length - 1;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Top level resource file for oleacc
|
||||
*
|
||||
* Copyright 2008 Nikolay Sivov
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "windef.h"
|
||||
#include "oleacc.h"
|
||||
|
||||
#include "oleacc_En.rc"
|
|
@ -8,8 +8,8 @@
|
|||
@ stdcall -private DllRegisterServer()
|
||||
@ stdcall -private DllUnregisterServer()
|
||||
@ stdcall GetOleaccVersionInfo(ptr ptr)
|
||||
@ stub GetRoleTextA
|
||||
@ stub GetRoleTextW
|
||||
@ stdcall GetRoleTextA(long ptr long)
|
||||
@ stdcall GetRoleTextW(long ptr long)
|
||||
@ stub GetStateTextA
|
||||
@ stub GetStateTextW
|
||||
@ stub IID_IAccessible
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* English resources for oleacc
|
||||
*
|
||||
* Copyright 2008 Nikolay Sivov
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
{
|
||||
0 "unknown object" /* undocumented */
|
||||
ROLE_SYSTEM_TITLEBAR "title bar"
|
||||
ROLE_SYSTEM_MENUBAR "menu bar"
|
||||
ROLE_SYSTEM_SCROLLBAR "scroll bar"
|
||||
ROLE_SYSTEM_GRIP "grip"
|
||||
ROLE_SYSTEM_SOUND "sound"
|
||||
ROLE_SYSTEM_CURSOR "cursor"
|
||||
ROLE_SYSTEM_CARET "caret"
|
||||
ROLE_SYSTEM_ALERT "alert"
|
||||
ROLE_SYSTEM_WINDOW "window"
|
||||
ROLE_SYSTEM_CLIENT "client"
|
||||
ROLE_SYSTEM_MENUPOPUP "popup menu"
|
||||
ROLE_SYSTEM_MENUITEM "menu item"
|
||||
ROLE_SYSTEM_TOOLTIP "tool tip"
|
||||
ROLE_SYSTEM_APPLICATION "application"
|
||||
ROLE_SYSTEM_DOCUMENT "document"
|
||||
ROLE_SYSTEM_PANE "pane"
|
||||
ROLE_SYSTEM_CHART "chart"
|
||||
ROLE_SYSTEM_DIALOG "dialog"
|
||||
ROLE_SYSTEM_BORDER "border"
|
||||
ROLE_SYSTEM_GROUPING "grouping"
|
||||
ROLE_SYSTEM_SEPARATOR "separator"
|
||||
ROLE_SYSTEM_TOOLBAR "tool bar"
|
||||
ROLE_SYSTEM_STATUSBAR "status bar"
|
||||
ROLE_SYSTEM_TABLE "table"
|
||||
ROLE_SYSTEM_COLUMNHEADER "column header"
|
||||
ROLE_SYSTEM_ROWHEADER "row header"
|
||||
ROLE_SYSTEM_COLUMN "column"
|
||||
ROLE_SYSTEM_ROW "row"
|
||||
ROLE_SYSTEM_CELL "cell"
|
||||
ROLE_SYSTEM_LINK "link"
|
||||
ROLE_SYSTEM_HELPBALLOON "help balloon"
|
||||
ROLE_SYSTEM_CHARACTER "character"
|
||||
ROLE_SYSTEM_LIST "list"
|
||||
ROLE_SYSTEM_LISTITEM "list item"
|
||||
ROLE_SYSTEM_OUTLINE "outline"
|
||||
ROLE_SYSTEM_OUTLINEITEM "outline item"
|
||||
ROLE_SYSTEM_PAGETAB "page tab"
|
||||
ROLE_SYSTEM_PROPERTYPAGE "property page"
|
||||
ROLE_SYSTEM_INDICATOR "indicator"
|
||||
ROLE_SYSTEM_GRAPHIC "graphic"
|
||||
ROLE_SYSTEM_STATICTEXT "static text"
|
||||
ROLE_SYSTEM_TEXT "text"
|
||||
ROLE_SYSTEM_PUSHBUTTON "push button"
|
||||
ROLE_SYSTEM_CHECKBUTTON "check button"
|
||||
ROLE_SYSTEM_RADIOBUTTON "radio button"
|
||||
ROLE_SYSTEM_COMBOBOX "combo box"
|
||||
ROLE_SYSTEM_DROPLIST "drop down"
|
||||
ROLE_SYSTEM_PROGRESSBAR "progress bar"
|
||||
ROLE_SYSTEM_DIAL "dial"
|
||||
ROLE_SYSTEM_HOTKEYFIELD "hot key field"
|
||||
ROLE_SYSTEM_SLIDER "slider"
|
||||
ROLE_SYSTEM_SPINBUTTON "spin box"
|
||||
ROLE_SYSTEM_DIAGRAM "diagram"
|
||||
ROLE_SYSTEM_ANIMATION "animation"
|
||||
ROLE_SYSTEM_EQUATION "equation"
|
||||
ROLE_SYSTEM_BUTTONDROPDOWN "drop down button"
|
||||
ROLE_SYSTEM_BUTTONMENU "menu button"
|
||||
ROLE_SYSTEM_BUTTONDROPDOWNGRID "grid drop down button"
|
||||
ROLE_SYSTEM_WHITESPACE "white space"
|
||||
ROLE_SYSTEM_PAGETABLIST "page tab list"
|
||||
ROLE_SYSTEM_CLOCK "clock"
|
||||
ROLE_SYSTEM_SPLITBUTTON "split button"
|
||||
ROLE_SYSTEM_IPADDRESS "IP address"
|
||||
ROLE_SYSTEM_OUTLINEBUTTON "outline button"
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
TOPSRCDIR = @top_srcdir@
|
||||
TOPOBJDIR = ../../..
|
||||
SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
TESTDLL = oleacc.dll
|
||||
IMPORTS = kernel32 oleacc
|
||||
|
||||
CTESTS = \
|
||||
main.c
|
||||
|
||||
@MAKE_TEST_RULES@
|
||||
|
||||
@DEPENDENCIES@ # everything below this line is overwritten by make depend
|
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
* oleacc tests
|
||||
*
|
||||
* Copyright 2008 Nikolay Sivov
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <oleacc.h>
|
||||
#include "wine/test.h"
|
||||
|
||||
static void test_getroletext(void)
|
||||
{
|
||||
INT ret, role;
|
||||
CHAR buf[2], *buff, buff2[100];
|
||||
WCHAR bufW[2], *buffW, buff2W[100];
|
||||
|
||||
/* wrong role number */
|
||||
ret = GetRoleTextA(-1, NULL, 0);
|
||||
ok(ret == 0, "GetRoleTextA doesn't return zero on wrong role number, got %d\n", ret);
|
||||
buf[0] = '*';
|
||||
ret = GetRoleTextA(-1, buf, 2);
|
||||
ok(ret == 0, "GetRoleTextA doesn't return zero on wrong role number, got %d\n", ret);
|
||||
ok(buf[0] == '*', "GetRoleTextA modified buffer on wrong role number\n");
|
||||
buf[0] = '*';
|
||||
ret = GetRoleTextA(-1, buf, 0);
|
||||
ok(ret == 0, "GetRoleTextA doesn't return zero on wrong role number, got %d\n", ret);
|
||||
ok(buf[0] == '*', "GetRoleTextA modified buffer on wrong role number\n");
|
||||
|
||||
ret = GetRoleTextW(-1, NULL, 0);
|
||||
ok(ret == 0, "GetRoleTextW doesn't return zero on wrong role number, got %d\n", ret);
|
||||
bufW[0] = '*';
|
||||
ret = GetRoleTextW(-1, bufW, 2);
|
||||
ok(ret == 0, "GetRoleTextW doesn't return zero on wrong role number, got %d\n", ret);
|
||||
ok(bufW[0] == '\0', "GetRoleTextW doesn't return NULL char on wrong role number\n");
|
||||
bufW[0] = '*';
|
||||
ret = GetRoleTextW(-1, bufW, 0);
|
||||
ok(ret == 0, "GetRoleTextW doesn't return zero on wrong role number, got %d\n", ret);
|
||||
/* don't know why this char */
|
||||
todo_wine ok(bufW[0] == 0x1e90, "GetRoleTextW returned wrong char, got %u\n", bufW[0]);
|
||||
|
||||
/* zero role number - not documented */
|
||||
ret = GetRoleTextA(0, NULL, 0);
|
||||
ok(ret > 0, "GetRoleTextA doesn't return (>0) for zero role number, got %d\n", ret);
|
||||
ret = GetRoleTextW(0, NULL, 0);
|
||||
ok(ret > 0, "GetRoleTextW doesn't return (>0) for zero role number, got %d\n", ret);
|
||||
|
||||
/* NULL buffer, return length */
|
||||
ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, NULL, 0);
|
||||
ok(ret > 0, "GetRoleTextA doesn't return length on NULL buffer, got %d\n", ret);
|
||||
ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, NULL, 1);
|
||||
ok(ret > 0, "GetRoleTextA doesn't return length on NULL buffer, got %d\n", ret);
|
||||
ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, NULL, 0);
|
||||
ok(ret > 0, "GetRoleTextW doesn't return length on NULL buffer, got %d\n", ret);
|
||||
ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, NULL, 1);
|
||||
ok(ret > 0, "GetRoleTextW doesn't return length on NULL buffer, got %d\n", ret);
|
||||
|
||||
/* use a smaller buffer */
|
||||
buf[0] = '*';
|
||||
ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, buf, 1);
|
||||
ok(ret == 0, "GetRoleTextA returned wrong length\n");
|
||||
ok(buf[0] == '\0', "GetRoleTextA returned not zero-length buffer\n");
|
||||
buf[1] = '*';
|
||||
ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, buf, 2);
|
||||
ok(ret == 1, "GetRoleTextA returned wrong length, got %d, expected 1\n", ret);
|
||||
ok(buf[1] == '\0', "GetRoleTextA returned not zero-length buffer\n");
|
||||
|
||||
bufW[0] = '*';
|
||||
ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, bufW, 1);
|
||||
ok(ret == 0, "GetRoleTextW returned wrong length, got %d, expected 1\n", ret);
|
||||
ok(bufW[0] == '\0', "GetRoleTextW returned not zero-length buffer\n");
|
||||
bufW[1] = '*';
|
||||
ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, bufW, 2);
|
||||
ok(ret == 1, "GetRoleTextW returned wrong length, got %d, expected 1\n", ret);
|
||||
ok(bufW[1] == '\0', "GetRoleTextW returned not zero-length buffer\n");
|
||||
|
||||
/* use bigger buffer */
|
||||
ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, NULL, 0);
|
||||
buff = HeapAlloc(GetProcessHeap(), 0, 2*ret);
|
||||
buff[2*ret-1] = '*';
|
||||
ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, buff, 2*ret);
|
||||
ok(buff[2*ret-1] == '*', "GetRoleTextA shouldn't modify this part of buffer\n");
|
||||
HeapFree(GetProcessHeap(), 0, buff);
|
||||
|
||||
ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, NULL, 0);
|
||||
buffW = HeapAlloc(GetProcessHeap(), 0, 2*ret*sizeof(WCHAR));
|
||||
buffW[2*ret-1] = '*';
|
||||
ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, buffW, 2*ret);
|
||||
ok(buffW[2*ret-1] == '*', "GetRoleTextW shouldn't modify this part of buffer\n");
|
||||
HeapFree(GetProcessHeap(), 0, buffW);
|
||||
|
||||
/* check returned length for all roles */
|
||||
for(role = 0; role <= ROLE_SYSTEM_OUTLINEBUTTON; role++){
|
||||
ret = GetRoleTextA(role, NULL, 0);
|
||||
GetRoleTextA(role, buff2, sizeof(buff2));
|
||||
ok(ret == lstrlenA(buff2),
|
||||
"GetRoleTextA: returned length doesn't match returned buffer for role %d\n", role);
|
||||
|
||||
ret = GetRoleTextW(role, NULL, 0);
|
||||
GetRoleTextW(role, buff2W, sizeof(buff2W)/sizeof(WCHAR));
|
||||
ok(ret == lstrlenW(buff2W),
|
||||
"GetRoleTextW: returned length doesn't match returned buffer for role %d\n", role);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(main)
|
||||
{
|
||||
test_getroletext();
|
||||
}
|
Loading…
Reference in New Issue