[PATCH] Conformance tests for LoadStringW
Christopher Berner
raccoonone at procyongames.com
Mon Jan 21 01:47:59 CST 2008
---
dlls/user32/tests/resource.c | 28 ++++++++++++++++++++++++++++
dlls/user32/tests/resource.rc | 1 +
2 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/dlls/user32/tests/resource.c b/dlls/user32/tests/resource.c
index 59f86ef..8c6057f 100644
--- a/dlls/user32/tests/resource.c
+++ b/dlls/user32/tests/resource.c
@@ -31,6 +31,33 @@ static void init_function_pointers(void)
pPrivateExtractIconsA = (void*)GetProcAddress(hmod, "PrivateExtractIconsA");
}
+static void test_LoadStringW(void)
+{
+ HINSTANCE hInst = GetModuleHandle(NULL);
+ WCHAR copiedstring[128], returnedstring[128], *resourcepointer = NULL;
+ int strlen, strlen2;
+
+ /* Check that the string which is returned by LoadStringW matches
+ the string at the pointer returned by Load StringW when called with buflen = 0 */
+ strlen = LoadStringW(hInst, 2, (WCHAR *) &resourcepointer, 0); /* get pointer to resource. */
+ ok(strlen > 0, "LoadStringW failed to get pointer to resource 2, ret %d, err %d \n", strlen, GetLastError());
+
+ strlen2 = LoadStringW(hInst, 2, returnedstring, sizeof(returnedstring) /sizeof(WCHAR));
+ ok(strlen == strlen2, "LoadStringW returned different values dependent on buflen. ret1 %d, ret2 %d \n",
+ strlen, strlen2);
+ ok(strlen2 > 0, "LoadStringW failed to load resource 2, ret %d, err %d \n", strlen2, GetLastError());
+
+ if(resourcepointer != NULL)
+ {
+ memcpy(copiedstring, resourcepointer, strlen * sizeof(WCHAR));
+ copiedstring[strlen] = '\0';
+ }
+ /* check that strings match */
+ ok(!memcmp(copiedstring, returnedstring, (strlen + 1)*sizeof(WCHAR)),
+ "LoadStringW returned a string that does not match the string pointed to by the pointer it returned. \
+ returnedstring = %ls, copiedstring = %ls", returnedstring, copiedstring);
+}
+
static void test_LoadStringA (void)
{
HINSTANCE hInst = GetModuleHandle (NULL);
@@ -317,6 +344,7 @@ START_TEST(resource)
{
init_function_pointers();
test_LoadStringA ();
+ test_LoadStringW();
test_accel1();
test_accel2();
test_PrivateExtractIcons();
diff --git a/dlls/user32/tests/resource.rc b/dlls/user32/tests/resource.rc
index 31ec68f..f01c6f5 100644
--- a/dlls/user32/tests/resource.rc
+++ b/dlls/user32/tests/resource.rc
@@ -41,6 +41,7 @@ STRINGTABLE
{
0 "String resource"
1 "Another string resource"
+ 2 L"This is a wide string resource"
65534 "Test high id"
}
--
1.5.2.5
--------------070503040800000808040002--
More information about the wine-patches
mailing list