2003-05-16 01:58:48 +02:00
|
|
|
/*
|
|
|
|
* Unit tests for DPA functions
|
|
|
|
*
|
|
|
|
* Copyright 2003 Uwe Bonnes
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
2003-05-16 01:58:48 +02:00
|
|
|
#include "winbase.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "winnls.h"
|
2003-05-16 01:58:48 +02:00
|
|
|
#include "commctrl.h"
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
2004-01-19 22:47:35 +01:00
|
|
|
static HDPA (WINAPI *pDPA_Create)(int);
|
|
|
|
|
2003-05-16 01:58:48 +02:00
|
|
|
static INT CALLBACK dpa_strcmp(LPVOID pvstr1, LPVOID pvstr2, LPARAM flags)
|
|
|
|
{
|
|
|
|
LPCSTR str1 = (LPCSTR)pvstr1;
|
|
|
|
LPCSTR str2 = (LPCSTR)pvstr2;
|
2004-01-19 22:47:35 +01:00
|
|
|
|
2003-05-16 01:58:48 +02:00
|
|
|
return lstrcmpA (str1, str2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DPA_test()
|
|
|
|
{
|
|
|
|
HDPA dpa_ret;
|
|
|
|
INT int_ret;
|
|
|
|
CHAR test_str0[]="test0";
|
2004-01-19 22:47:35 +01:00
|
|
|
|
|
|
|
if (!pDPA_Create)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dpa_ret = pDPA_Create(0);
|
|
|
|
ok((dpa_ret !=0), "DPA_Create failed\n");
|
2003-05-16 01:58:48 +02:00
|
|
|
int_ret = DPA_Search(dpa_ret,test_str0,0, dpa_strcmp,0, DPAS_SORTED);
|
2004-01-19 22:47:35 +01:00
|
|
|
ok((int_ret == -1), "DPA_Search found invalid item\n");
|
2003-05-16 01:58:48 +02:00
|
|
|
int_ret = DPA_Search(dpa_ret,test_str0,0, dpa_strcmp,0, DPAS_SORTED|DPAS_INSERTBEFORE);
|
2004-01-19 22:47:35 +01:00
|
|
|
ok((int_ret == 0), "DPA_Search proposed bad item\n");
|
2003-05-16 01:58:48 +02:00
|
|
|
int_ret = DPA_Search(dpa_ret,test_str0,0, dpa_strcmp,0, DPAS_SORTED|DPAS_INSERTAFTER);
|
2004-01-19 22:47:35 +01:00
|
|
|
ok((int_ret == 0), "DPA_Search proposed bad item\n");
|
2003-05-16 01:58:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
START_TEST(dpa)
|
|
|
|
{
|
2004-01-19 22:47:35 +01:00
|
|
|
HMODULE hdll;
|
|
|
|
|
|
|
|
hdll=GetModuleHandleA("comctl32.dll");
|
|
|
|
pDPA_Create=(void*)GetProcAddress(hdll,(LPCSTR)328);
|
|
|
|
|
2003-05-16 01:58:48 +02:00
|
|
|
DPA_test();
|
|
|
|
}
|