Nikolay Sivov : user32/tests: Add some tests for GetClassName() and versioned classes.
Alexandre Julliard
julliard at winehq.org
Fri Feb 2 12:24:38 CST 2018
Module: wine
Branch: master
Commit: be8534d3879de918f7297335ea66f5719dac00f1
URL: https://source.winehq.org/git/wine.git/?a=commit;h=be8534d3879de918f7297335ea66f5719dac00f1
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Feb 2 14:31:40 2018 +0300
user32/tests: Add some tests for GetClassName() and versioned classes.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/tests/class.c | 40 +++++++++++++++++++++++++++++++++++-----
1 file changed, 35 insertions(+), 5 deletions(-)
diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c
index 88e4bfc..13d7b9d 100644
--- a/dlls/user32/tests/class.c
+++ b/dlls/user32/tests/class.c
@@ -1211,12 +1211,15 @@ static void test_actctx_classes(void)
"<windowClass>MyTestClass</windowClass>"
"</file>"
"</assembly>";
+ static const char *testclass = "MyTestClass";
WNDCLASSA wc;
ULONG_PTR cookie;
HANDLE context;
BOOL ret;
ATOM class;
HINSTANCE hinst;
+ char buff[64];
+ HWND hwnd;
create_manifest_file("main.manifest", main_manifest);
context = create_test_actctx("main.manifest");
@@ -1228,29 +1231,56 @@ static void test_actctx_classes(void)
memset(&wc, 0, sizeof(wc));
wc.lpfnWndProc = ClassTest_WndProc;
wc.hIcon = LoadIconW(0, (LPCWSTR)IDI_APPLICATION);
- wc.lpszClassName = "MyTestClass";
+ wc.lpszClassName = testclass;
hinst = GetModuleHandleW(0);
- ret = GetClassInfoA(hinst, "MyTestClass", &wc);
+ ret = GetClassInfoA(hinst, testclass, &wc);
ok(!ret, "Expected failure.\n");
class = RegisterClassA(&wc);
ok(class != 0, "Failed to register class.\n");
/* Class info is available by versioned and regular names. */
- ret = GetClassInfoA(hinst, "MyTestClass", &wc);
+ ret = GetClassInfoA(hinst, testclass, &wc);
ok(ret, "Failed to get class info.\n");
+ hwnd = CreateWindowExA(0, testclass, "test", 0, 0, 0, 0, 0, 0, 0, hinst, 0);
+ ok(hwnd != NULL, "Failed to create a window.\n");
+
+ ret = GetClassNameA(hwnd, buff, sizeof(buff));
+ ok(ret, "Failed to get class name.\n");
+todo_wine
+ ok(!strcmp(buff, testclass), "Unexpected class name.\n");
+
ret = GetClassInfoA(hinst, "4.3.2.1!MyTestClass", &wc);
ok(ret, "Failed to get class info.\n");
- ret = UnregisterClassA("MyTestClass", hinst);
- ok(ret, "Failed to unregister class.\n");
+ ret = UnregisterClassA(testclass, hinst);
+ ok(!ret, "Failed to unregister class.\n");
ret = DeactivateActCtx(0, cookie);
ok(ret, "Failed to deactivate context.\n");
+ ret = GetClassInfoA(hinst, testclass, &wc);
+ ok(!ret, "Unexpected ret val %d.\n", ret);
+
+ ret = GetClassInfoA(hinst, "4.3.2.1!MyTestClass", &wc);
+ ok(ret, "Failed to get class info.\n");
+
+ ret = GetClassNameA(hwnd, buff, sizeof(buff));
+ ok(ret, "Failed to get class name.\n");
+todo_wine
+ ok(!strcmp(buff, testclass), "Unexpected class name.\n");
+
+ DestroyWindow(hwnd);
+
+ ret = UnregisterClassA("MyTestClass", hinst);
+ ok(!ret, "Unexpected ret value %d.\n", ret);
+
+ ret = UnregisterClassA("4.3.2.1!MyTestClass", hinst);
+ ok(ret, "Failed to unregister class.\n");
+
/* Register versioned class without active context. */
wc.lpszClassName = "4.3.2.1!MyTestClass";
class = RegisterClassA(&wc);
More information about the wine-cvs
mailing list