mirror of
https://github.com/reactos/wine.git
synced 2024-11-24 12:20:07 +00:00
Added stringtable regression test.
This commit is contained in:
parent
8196e2d0d0
commit
331e09c22c
@ -1652,6 +1652,7 @@ dlls/secur32/tests/Makefile
|
||||
dlls/sensapi/Makefile
|
||||
dlls/serialui/Makefile
|
||||
dlls/setupapi/Makefile
|
||||
dlls/setupapi/tests/Makefile
|
||||
dlls/shdocvw/Makefile
|
||||
dlls/shell32/Makefile
|
||||
dlls/shell32/tests/Makefile
|
||||
|
3
dlls/setupapi/tests/.cvsignore
Normal file
3
dlls/setupapi/tests/.cvsignore
Normal file
@ -0,0 +1,3 @@
|
||||
Makefile
|
||||
stringtable.ok
|
||||
testlist.c
|
13
dlls/setupapi/tests/Makefile.in
Normal file
13
dlls/setupapi/tests/Makefile.in
Normal file
@ -0,0 +1,13 @@
|
||||
TOPSRCDIR = @top_srcdir@
|
||||
TOPOBJDIR = ../../..
|
||||
SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
TESTDLL = setupapi.dll
|
||||
IMPORTS = setupapi kernel32
|
||||
|
||||
CTESTS = \
|
||||
stringtable.c
|
||||
|
||||
@MAKE_TEST_RULES@
|
||||
|
||||
### Dependencies:
|
151
dlls/setupapi/tests/stringtable.c
Normal file
151
dlls/setupapi/tests/stringtable.c
Normal file
@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Unit test suite for StringTable functions
|
||||
*
|
||||
* Copyright 2005 Steven Edwards for ReactOS
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/*
|
||||
* TODO:
|
||||
* Add case sensitivity test for StringTableAddString/StringTableLookupString
|
||||
* Add test for StringTableStringFromIdEx
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "winreg.h"
|
||||
#include "setupapi.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
|
||||
static DWORD (WINAPI *pStringTableAddString)(HSTRING_TABLE, LPWSTR, DWORD);
|
||||
static VOID (WINAPI *pStringTableDestroy)(HSTRING_TABLE);
|
||||
static HSTRING_TABLE (WINAPI *pStringTableDuplicate)(HSTRING_TABLE hStringTable);
|
||||
static HSTRING_TABLE (WINAPI *pStringTableInitialize)(VOID);
|
||||
static DWORD (WINAPI *pStringTableLookUpString)(HSTRING_TABLE, LPWSTR, DWORD);
|
||||
static LPWSTR (WINAPI *pStringTableStringFromId)(HSTRING_TABLE, DWORD);
|
||||
#if 0
|
||||
static BOOL (WINAPI *pStringTableStringFromIdEx)(HSTRING_TABLE, DWORD, LPWSTR, LPDWORD);
|
||||
static VOID (WINAPI *pStringTableTrim)(HSTRING_TABLE);
|
||||
#endif
|
||||
|
||||
HMODULE hdll;
|
||||
static WCHAR string[] = {'s','t','r','i','n','g',0};
|
||||
HANDLE table, table2; /* Handles pointing to our tables */
|
||||
|
||||
static void load_it_up(void)
|
||||
{
|
||||
hdll = LoadLibraryA("setupapi.dll");
|
||||
if (!hdll)
|
||||
return;
|
||||
|
||||
pStringTableInitialize = (void*)GetProcAddress(hdll, "StringTableInitialize");
|
||||
if (!pStringTableInitialize)
|
||||
pStringTableInitialize = (void*)GetProcAddress(hdll, "pSetupStringTableInitialize");
|
||||
|
||||
pStringTableAddString = (void*)GetProcAddress(hdll, "StringTableAddString");
|
||||
if (!pStringTableAddString)
|
||||
pStringTableAddString = (void*)GetProcAddress(hdll, "pSetupStringTableAddString");
|
||||
|
||||
pStringTableDuplicate = (void*)GetProcAddress(hdll, "StringTableDuplicate");
|
||||
if (!pStringTableDuplicate)
|
||||
pStringTableDuplicate = (void*)GetProcAddress(hdll, "pSetupStringTableDuplicate");
|
||||
|
||||
pStringTableDestroy = (void*)GetProcAddress(hdll, "StringTableDestroy");
|
||||
if (!pStringTableDestroy)
|
||||
pStringTableDestroy = (void*)GetProcAddress(hdll, "pSetupStringTableDestroy");
|
||||
|
||||
pStringTableLookUpString = (void*)GetProcAddress(hdll, "StringTableLookUpString");
|
||||
if (!pStringTableLookUpString)
|
||||
pStringTableLookUpString = (void*)GetProcAddress(hdll, "pSetupStringTableLookUpString");
|
||||
|
||||
pStringTableStringFromId = (void*)GetProcAddress(hdll, "StringTableStringFromId");
|
||||
if (!pStringTableStringFromId)
|
||||
pStringTableStringFromId = (void*)GetProcAddress(hdll, "pSetupStringTableStringFromId");
|
||||
}
|
||||
|
||||
static void test_StringTableInitialize(void)
|
||||
{
|
||||
table=pStringTableInitialize();
|
||||
ok(table!=NULL,"Failed to Initialize String Table\n");
|
||||
}
|
||||
|
||||
static void test_StringTableAddString(void)
|
||||
{
|
||||
DWORD retval;
|
||||
|
||||
retval=pStringTableAddString(table,string,0);
|
||||
ok(retval!=-1,"Failed to add string to String Table\n");
|
||||
}
|
||||
|
||||
static void test_StringTableDuplicate(void)
|
||||
{
|
||||
table2=pStringTableDuplicate(table);
|
||||
ok(table2!=NULL,"Failed to duplicate String Table\n");
|
||||
}
|
||||
|
||||
static void test_StringTableLookUpString(void)
|
||||
{
|
||||
DWORD retval, retval2;
|
||||
|
||||
retval=pStringTableLookUpString(table,string,0);
|
||||
ok(retval!=-1,"Failed find string in String Table 1\n");
|
||||
|
||||
retval2=pStringTableLookUpString(table2,string,0);
|
||||
ok(retval2!=-1,"Failed find string in String Table 2\n");
|
||||
}
|
||||
|
||||
static void test_StringTableStringFromId(void)
|
||||
{
|
||||
WCHAR *string2, *string3;
|
||||
int result;
|
||||
|
||||
/* correct */
|
||||
string2=pStringTableStringFromId(table,pStringTableLookUpString(table,string,0));
|
||||
ok(string2!=NULL,"Failed to look up string by ID from String Table\n");
|
||||
|
||||
result=lstrcmpiW(string, string2);
|
||||
ok(result==0,"String %p does not match requested StringID %p\n",string,string2);
|
||||
|
||||
string3=pStringTableStringFromId(table,0);
|
||||
ok(string3!=NULL,"Failed to look up string by ID from String Table\n");
|
||||
|
||||
todo_wine {
|
||||
result=lstrcmpiW(string, string3);
|
||||
ok(result!=0,"String %p does not match requested StringID %p\n",string,string2);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(stringtable)
|
||||
{
|
||||
load_it_up();
|
||||
|
||||
test_StringTableInitialize();
|
||||
test_StringTableAddString();
|
||||
test_StringTableDuplicate();
|
||||
test_StringTableLookUpString();
|
||||
test_StringTableStringFromId();
|
||||
|
||||
/* assume we can always distroy */
|
||||
pStringTableDestroy(table);
|
||||
pStringTableDestroy(table2);
|
||||
|
||||
FreeLibrary(hdll);
|
||||
}
|
Loading…
Reference in New Issue
Block a user