Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4b130aa0
Commit
4b130aa0
authored
Mar 02, 2008
by
Christopher Berner
Committed by
Alexandre Julliard
Mar 03, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Conformance tests for LoadStringW and LoadStringA.
parent
e42eaaaf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
1 deletion
+54
-1
resource.c
dlls/user32/tests/resource.c
+53
-1
resource.rc
dlls/user32/tests/resource.rc
+1
-0
No files found.
dlls/user32/tests/resource.c
View file @
4b130aa0
...
...
@@ -31,6 +31,50 @@ static void init_function_pointers(void)
pPrivateExtractIconsA
=
(
void
*
)
GetProcAddress
(
hmod
,
"PrivateExtractIconsA"
);
}
static
void
test_LoadStringW
(
void
)
{
HINSTANCE
hInst
=
GetModuleHandle
(
NULL
);
WCHAR
copiedstringw
[
128
],
returnedstringw
[
128
],
*
resourcepointer
=
NULL
;
char
copiedstring
[
128
],
returnedstring
[
128
];
int
length1
,
length2
,
retvalue
;
/* Check that the string which is returned by LoadStringW matches
the string at the pointer returned by LoadStringW when called with buflen = 0 */
length1
=
LoadStringW
(
hInst
,
2
,
(
WCHAR
*
)
&
resourcepointer
,
0
);
/* get pointer to resource. */
length2
=
LoadStringW
(
hInst
,
2
,
returnedstringw
,
sizeof
(
returnedstringw
)
/
sizeof
(
WCHAR
));
/* get resource string */
ok
(
length2
>
0
,
"LoadStringW failed to load resource 2, ret %d, err %d
\n
"
,
length2
,
GetLastError
());
todo_wine
{
ok
(
length1
==
length2
,
"LoadStringW returned different values dependent on buflen. ret1 %d, ret2 %d
\n
"
,
length1
,
length2
);
ok
(
length1
>
0
&&
resourcepointer
!=
NULL
,
"LoadStringW failed to get pointer to resource 2, ret %d, err %d
\n
"
,
length1
,
GetLastError
());
}
/* Copy the resource since it is not '\0' terminated, and add '\0' to the end */
if
(
resourcepointer
!=
NULL
)
/* Check that the resource pointer was loaded to avoid access violation */
{
memcpy
(
copiedstringw
,
resourcepointer
,
length1
*
sizeof
(
WCHAR
));
copiedstringw
[
length1
]
=
'\0'
;
/* check that strings match */
WideCharToMultiByte
(
CP_ACP
,
0
,
returnedstringw
,
-
1
,
returnedstring
,
128
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
copiedstringw
,
-
1
,
copiedstring
,
128
,
NULL
,
NULL
);
ok
(
!
memcmp
(
copiedstringw
,
returnedstringw
,
(
length2
+
1
)
*
sizeof
(
WCHAR
)),
"strings don't match: returnedstring = %s, copiedstring = %s
\n
"
,
returnedstring
,
copiedstring
);
}
todo_wine
{
/* check that calling LoadStringW with buffer = NULL returns zero */
retvalue
=
LoadStringW
(
hInst
,
2
,
NULL
,
0
);
ok
(
!
retvalue
,
"LoadStringW returned a non-zero value when called with buffer = NULL, retvalue = %d"
,
retvalue
);
/* check again, with a different buflen value, that calling LoadStringW with buffer = NULL returns zero */
retvalue
=
LoadStringW
(
hInst
,
2
,
NULL
,
128
);
ok
(
!
retvalue
,
"LoadStringW returned a non-zero value when called with buffer = NULL, retvalue = %d"
,
retvalue
);
}
}
static
void
test_LoadStringA
(
void
)
{
HINSTANCE
hInst
=
GetModuleHandle
(
NULL
);
...
...
@@ -74,6 +118,13 @@ static void test_LoadStringA (void)
"LoadString failed: ret %d err %d
\n
"
,
ret
,
GetLastError
());
ok
(
LoadStringA
(
hInst
,
MAKELONG
(
65534
,
0xffff
),
buf
,
sizeof
(
buf
))
==
ret
,
"LoadString failed: ret %d err %d
\n
"
,
ret
,
GetLastError
());
ret
=
LoadStringA
(
hInst
,
0
,
buf
,
0
);
todo_wine
{
ok
(
ret
==
-
1
,
"LoadStringA did not return -1 when called with buflen = 0, got %d, err %d
\n
"
,
ret
,
GetLastError
());
}
}
static
void
test_accel1
(
void
)
...
...
@@ -316,7 +367,8 @@ static void test_LoadImage(void)
START_TEST
(
resource
)
{
init_function_pointers
();
test_LoadStringA
();
test_LoadStringA
();
test_LoadStringW
();
test_accel1
();
test_accel2
();
test_PrivateExtractIcons
();
...
...
dlls/user32/tests/resource.rc
View file @
4b130aa0
...
...
@@ -41,6 +41,7 @@ STRINGTABLE
{
0 "String resource"
1 "Another string resource"
2 L"This is a wide string resource"
65534 "Test high id"
}
...
...
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