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
2384756b
Commit
2384756b
authored
Nov 07, 2006
by
Paul Vriens
Committed by
Alexandre Julliard
Nov 08, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: Beginning of some string related tests.
parent
e80000e6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
128 additions
and
0 deletions
+128
-0
Makefile.in
dlls/comctl32/tests/Makefile.in
+1
-0
string.c
dlls/comctl32/tests/string.c
+127
-0
No files found.
dlls/comctl32/tests/Makefile.in
View file @
2384756b
...
@@ -15,6 +15,7 @@ CTESTS = \
...
@@ -15,6 +15,7 @@ CTESTS = \
mru.c
\
mru.c
\
progress.c
\
progress.c
\
propsheet.c
\
propsheet.c
\
string.c
\
subclass.c
\
subclass.c
\
tab.c
\
tab.c
\
toolbar.c
\
toolbar.c
\
...
...
dlls/comctl32/tests/string.c
0 → 100644
View file @
2384756b
/*
* String tests
*
* Copyright 2006 Paul Vriens
*
* 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 <stdio.h>
#include <windows.h>
#include "wine/test.h"
static
INT
(
WINAPI
*
pStr_GetPtrA
)(
LPCSTR
,
LPSTR
,
INT
);
static
BOOL
(
WINAPI
*
pStr_SetPtrA
)(
LPSTR
,
LPCSTR
);
static
INT
(
WINAPI
*
pStr_GetPtrW
)(
LPCWSTR
,
LPWSTR
,
INT
);
static
BOOL
(
WINAPI
*
pStr_SetPtrW
)(
LPWSTR
,
LPCWSTR
);
static
HMODULE
hComctl32
=
0
;
#define COMCTL32_GET_PROC(ordinal, func) \
p ## func = (void*)GetProcAddress(hComctl32, (LPSTR)ordinal); \
if(!p ## func) { \
trace("GetProcAddress(%d)(%s) failed\n", ordinal, #func); \
FreeLibrary(hComctl32); \
}
static
BOOL
InitFunctionPtrs
(
void
)
{
hComctl32
=
LoadLibraryA
(
"comctl32.dll"
);
if
(
!
hComctl32
)
{
trace
(
"Could not load comctl32.dll
\n
"
);
return
FALSE
;
}
COMCTL32_GET_PROC
(
233
,
Str_GetPtrA
)
COMCTL32_GET_PROC
(
234
,
Str_SetPtrA
)
COMCTL32_GET_PROC
(
235
,
Str_GetPtrW
)
COMCTL32_GET_PROC
(
236
,
Str_SetPtrW
)
return
TRUE
;
}
static
void
test_GetPtrAW
(
void
)
{
if
(
pStr_GetPtrA
)
{
static
const
char
source
[]
=
"Just a source string"
;
static
const
char
desttest
[]
=
"Just a destination string"
;
static
char
dest
[
MAX_PATH
];
int
sourcelen
;
int
destsize
=
MAX_PATH
;
int
count
=
-
1
;
sourcelen
=
strlen
(
source
)
+
1
;
count
=
pStr_GetPtrA
(
NULL
,
NULL
,
0
);
ok
(
count
==
0
,
"Expected count to be 0, it was %d
\n
"
,
count
);
if
(
0
)
{
/* Crashes on W98, NT4, W2K, XP, W2K3
* Our implementation also crashes and we should probably leave
* it like that.
*/
count
=
-
1
;
count
=
pStr_GetPtrA
(
NULL
,
NULL
,
destsize
);
trace
(
"count : %d
\n
"
,
count
);
}
count
=
0
;
count
=
pStr_GetPtrA
(
source
,
NULL
,
0
);
ok
(
count
==
sourcelen
,
"Expected count to be %d, it was %d
\n
"
,
sourcelen
,
count
);
count
=
0
;
strcpy
(
dest
,
desttest
);
count
=
pStr_GetPtrA
(
source
,
dest
,
0
);
ok
(
count
==
sourcelen
,
"Expected count to be %d, it was %d
\n
"
,
sourcelen
,
count
);
ok
(
!
lstrcmp
(
dest
,
desttest
),
"Expected destination to not have changed
\n
"
);
count
=
0
;
count
=
pStr_GetPtrA
(
source
,
NULL
,
destsize
);
ok
(
count
==
sourcelen
,
"Expected count to be %d, it was %d
\n
"
,
sourcelen
,
count
);
count
=
0
;
count
=
pStr_GetPtrA
(
source
,
dest
,
destsize
);
ok
(
count
==
sourcelen
,
"Expected count to be %d, it was %d
\n
"
,
sourcelen
,
count
);
ok
(
!
lstrcmp
(
source
,
dest
),
"Expected source and destination to be the same
\n
"
);
count
=
-
1
;
strcpy
(
dest
,
desttest
);
count
=
pStr_GetPtrA
(
NULL
,
dest
,
destsize
);
ok
(
count
==
0
,
"Expected count to be 0, it was %d
\n
"
,
count
);
ok
(
dest
[
0
]
==
'\0'
,
"Expected destination to be cut-off and 0 terminated
\n
"
);
count
=
0
;
destsize
=
15
;
count
=
pStr_GetPtrA
(
source
,
dest
,
destsize
);
ok
(
count
==
15
,
"Expected count to be 15, it was %d
\n
"
,
count
);
ok
(
!
memcmp
(
source
,
dest
,
14
),
"Expected first part of source and destination to be the same
\n
"
);
ok
(
dest
[
14
]
==
'\0'
,
"Expected destination to be cut-off and 0 terminated
\n
"
);
}
}
START_TEST
(
string
)
{
if
(
!
InitFunctionPtrs
())
return
;
test_GetPtrAW
();
FreeLibrary
(
hComctl32
);
}
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