Author: gadamopoulos
Date: Mon Feb 6 16:33:25 2017
New Revision: 73725
URL:
http://svn.reactos.org/svn/reactos?rev=73725&view=rev
Log:
[USER32_APITEST] -Add tests for global classes and versioned classes for RegisterClassEx.
Added:
trunk/rostests/apitests/user32/RegisterClassEx.c (with props)
trunk/rostests/apitests/user32/verclasstest1.manifest (with props)
trunk/rostests/apitests/user32/verclasstest2.manifest (with props)
Modified:
trunk/rostests/apitests/user32/CMakeLists.txt
trunk/rostests/apitests/user32/testlist.c
Modified: trunk/rostests/apitests/user32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/CMakeList…
==============================================================================
--- trunk/rostests/apitests/user32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/CMakeLists.txt [iso-8859-1] Mon Feb 6 16:33:25 2017
@@ -22,6 +22,7 @@
LookupIconIdFromDirectoryEx.c
NextDlgItem.c
RealGetWindowClass.c
+ RegisterClassEx.c
RegisterHotKey.c
ScrollDC.c
ScrollWindowEx.c
@@ -43,3 +44,6 @@
set_module_type(user32_apitest win32cui)
add_importlibs(user32_apitest advapi32 gdi32 user32 msvcrt kernel32 ntdll)
add_rostests_file(TARGET user32_apitest)
+
+add_rostests_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/verclasstest1.manifest")
+add_rostests_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/verclasstest2.manifest")
Added: trunk/rostests/apitests/user32/RegisterClassEx.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/RegisterC…
==============================================================================
--- trunk/rostests/apitests/user32/RegisterClassEx.c (added)
+++ trunk/rostests/apitests/user32/RegisterClassEx.c [iso-8859-1] Mon Feb 6 16:33:25
2017
@@ -0,0 +1,193 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPL - See COPYING in the top level directory
+ * PURPOSE: Test for RegisterClassEx
+ * PROGRAMMERS: Giannis Adamopoulos
+ */
+
+#include <apitest.h>
+#define WIN32_NO_STATUS
+#include <ndk/rtlfuncs.h>
+
+#include <wingdi.h>
+#include <winuser.h>
+#include "helper.h"
+#include <undocuser.h>
+
+static ATOM _RegisterClass(LPCWSTR lpwszClassName, HINSTANCE hInstance, UINT style,
WNDPROC lpfnWndProc)
+{
+ WNDCLASSEXW wcex = {sizeof(WNDCLASSEXW), style, lpfnWndProc};
+ wcex.lpszClassName = lpwszClassName;
+ wcex.hInstance = hInstance;
+ return RegisterClassExW(&wcex);
+}
+
+static ATOM _GetClassAtom(LPCWSTR lpwszClassName, HINSTANCE hInstance)
+{
+ WNDCLASSEXW wcex = {sizeof(WNDCLASSEXW)};
+ return (ATOM)GetClassInfoEx(hInstance, lpwszClassName, &wcex);
+}
+
+static WNDPROC _GetWndproc(LPCWSTR lpwszClassName, HINSTANCE hInstance)
+{
+ WNDCLASSEXW wcex = {sizeof(WNDCLASSEXW)};
+ GetClassInfoEx(hInstance, lpwszClassName, &wcex);
+ return wcex.lpfnWndProc;
+}
+
+HANDLE _CreateActCtxFromFile(LPCWSTR FileName)
+{
+ ACTCTXW ActCtx = {sizeof(ACTCTX)};
+ WCHAR buffer[MAX_PATH] , *separator;
+
+ ok (GetModuleFileNameW(NULL, buffer, MAX_PATH), "GetModuleFileName
failed\n");
+ separator = wcsrchr(buffer, L'\\');
+ if (separator)
+ wcscpy(separator + 1, FileName);
+
+ ActCtx.lpSource = buffer;
+
+ return CreateActCtxW(&ActCtx);
+}
+
+VOID TestGlobalClasses(VOID)
+{
+ HMODULE hmod = GetModuleHandle(NULL);
+ ATOM a,b,c,d,e;
+
+ a = _GetClassAtom(L"TestClass1", hmod);
+ b = _RegisterClass(L"TestClass1", hmod, 0, DefWindowProcW);
+ c = _GetClassAtom(L"TestClass1", hmod);
+ UnregisterClass(L"TestClass1", hmod);
+ d = _GetClassAtom(L"TestClass1", hmod);
+ ok( a == 0, "\n");
+ ok( b != 0, "\n");
+ ok( c != 0, "\n");
+ ok( d == 0, "\n");
+ ok (b == c, "\n");
+
+ a = _GetClassAtom(L"TestClass2", hmod);
+ b = _RegisterClass(L"TestClass2", hmod, CS_GLOBALCLASS, DefWindowProcW);
+ c = _GetClassAtom(L"TestClass2", hmod);
+ UnregisterClass(L"TestClass2", hmod);
+ d = _GetClassAtom(L"TestClass2", hmod);
+ ok( a == 0, "\n");
+ ok( b != 0, "\n");
+ ok( c != 0, "\n");
+ ok( d == 0, "\n");
+ ok (b == c, "\n");
+
+ a = _RegisterClass(L"TestClass3", hmod, 0, DefWindowProcW);
+ b = _RegisterClass(L"TestClass3", hmod, 0, DefWindowProcW);
+ c = _RegisterClass(L"TestClass3", hmod, CS_GLOBALCLASS, DefWindowProcW);
+ UnregisterClass(L"TestClass3", hmod);
+ d = _GetClassAtom(L"TestClass3", hmod);
+ ok( a != 0, "\n");
+ ok( b == 0, "\n");
+ ok( c == 0, "\n");
+ ok( d == 0, "\n");
+
+ a = _RegisterClass(L"TestClass4", hmod, CS_GLOBALCLASS, DefWindowProcW);
+ b = _RegisterClass(L"TestClass4", hmod, 0, DefWindowProcW);
+ c = _RegisterClass(L"TestClass4", hmod, 0, DefWindowProcW);
+ UnregisterClass(L"TestClass4", hmod);
+ d = _GetClassAtom(L"TestClass4", hmod);
+ UnregisterClass(L"TestClass4", hmod);
+ e = _GetClassAtom(L"TestClass4", hmod);
+ ok( a != 0, "\n");
+ ok( b != 0, "\n");
+ ok( c == 0, "\n");
+ ok( d != 0, "\n");
+ ok( e == 0, "\n");
+
+ a = _GetClassAtom(L"ComboBox", hmod);
+ b = _RegisterClass(L"ComboBox", hmod, 0, DefWindowProcW);
+ c = _RegisterClass(L"ComboBox", hmod, CS_GLOBALCLASS, DefWindowProcW);
+ UnregisterClass(L"ComboBox", hmod);
+ d = _GetClassAtom(L"ComboBox", hmod);
+ UnregisterClass(L"TestClass4", hmod);
+ e = _GetClassAtom(L"TestClass4", hmod);
+ ok( a != 0, "\n");
+ ok( b != 0, "\n");
+ ok( c == 0, "\n");
+ ok( d != 0, "\n");
+ ok( e == 0, "\n");
+
+ a = _GetClassAtom(L"ScrollBar", hmod);
+ UnregisterClass(L"ScrollBar", hmod);
+ b = _GetClassAtom(L"ScrollBar", hmod);
+ ok( a != 0, "\n");
+ ok( b == 0, "\n");
+
+ a = _GetClassAtom(L"ListBox", (HMODULE)0xdead);
+ UnregisterClass(L"ListBox", (HMODULE)0xdead);
+ b = _GetClassAtom(L"ListBox", (HMODULE)0xdead);
+ ok( a != 0, "\n");
+ ok( b == 0, "\n");
+
+ a = _RegisterClass(L"TestClass5", (HMODULE)0xdead, CS_GLOBALCLASS,
DefWindowProcW);
+ b = _GetClassAtom(L"TestClass5", hmod);
+ UnregisterClass(L"TestClass5", hmod);
+ c = _GetClassAtom(L"TestClass5", (HMODULE)0xdead);
+ d = _GetClassAtom(L"TestClass5", hmod);
+ ok( a != 0, "\n");
+ ok( b != 0, "\n");
+ ok( c == 0, "\n");
+ ok( d == 0, "\n");
+}
+
+VOID TestVersionedClasses(VOID)
+{
+ HMODULE hmod = GetModuleHandle(NULL);
+ HANDLE h1, h2;
+ ULONG_PTR cookie1;
+ ATOM a,b,c;
+ WNDPROC proc1,proc2,proc3, proc4;
+
+ h1 = _CreateActCtxFromFile(L"verclasstest1.manifest");
+ h2 = _CreateActCtxFromFile(L"verclasstest2.manifest");
+ if (h1 == INVALID_HANDLE_VALUE || h2 == INVALID_HANDLE_VALUE)
+ {
+ skip("Loading manifests failed. Skipping TestVersionedClasses\n");
+ return;
+ }
+
+ a = _RegisterClass(L"VersionTestClass1", hmod, 0, DefWindowProcA);
+ proc1 = _GetWndproc(L"VersionTestClass1", hmod);
+ b = _RegisterClass(L"VersionTestClass1", hmod, 0, DefWindowProcW);
+ ActivateActCtx(h1, &cookie1);
+ proc2 = _GetWndproc(L"VersionTestClass1", hmod);
+ c = _RegisterClass(L"VersionTestClass1", hmod, 0, DefWindowProcW);
+ proc3 = _GetWndproc(L"VersionTestClass1", hmod);
+ DeactivateActCtx(0, cookie1);
+ proc4 = _GetWndproc(L"VersionTestClass1", hmod);
+ ok( a != 0, "\n");
+ ok( b == 0, "\n");
+ ok( c != 0, "\n");
+ ok( a == c, "\n");
+ ok (proc1 == DefWindowProcA, "\n");
+ ok (proc2 == NULL, "\n");
+ ok (proc3 == DefWindowProcW, "\n");
+ ok (proc4 == DefWindowProcA, "\n");
+
+ a = _GetClassAtom(L"Button", hmod);
+ b = _RegisterClass(L"Button", hmod, CS_GLOBALCLASS, DefWindowProcA);
+ proc1 = _GetWndproc(L"Button", (HMODULE)0xdead);
+ ActivateActCtx(h2, &cookie1);
+ c = _RegisterClass(L"Button", hmod, CS_GLOBALCLASS, DefWindowProcA);
+ proc2 = _GetWndproc(L"Button", (HMODULE)0xdead);
+ ok( a != 0, "\n");
+ ok( b == 0, "\n");
+ ok( c != 0, "\n");
+ ok( a == c, "\n");
+ ok( proc1 != NULL, "\n");
+ ok( proc2 != NULL, "\n");
+ ok( proc1 != proc2, "\n");
+ ok( proc2 == DefWindowProcA, "\n");
+}
+
+START_TEST(RegisterClassEx)
+{
+ TestGlobalClasses();
+ TestVersionedClasses();
+}
Propchange: trunk/rostests/apitests/user32/RegisterClassEx.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/apitests/user32/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/testlist.…
==============================================================================
--- trunk/rostests/apitests/user32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/testlist.c [iso-8859-1] Mon Feb 6 16:33:25 2017
@@ -25,6 +25,7 @@
extern void func_NextDlgItem(void);
extern void func_RealGetWindowClass(void);
extern void func_RegisterHotKey(void);
+extern void func_RegisterClassEx(void);
extern void func_ScrollDC(void);
extern void func_ScrollWindowEx(void);
extern void func_SendMessageTimeout(void);
@@ -62,6 +63,7 @@
{ "NextDlgItem", func_NextDlgItem },
{ "RealGetWindowClass", func_RealGetWindowClass },
{ "RegisterHotKey", func_RegisterHotKey },
+ { "RegisterClassEx", func_RegisterClassEx },
{ "ScrollDC", func_ScrollDC },
{ "ScrollWindowEx", func_ScrollWindowEx },
{ "SendMessageTimeout", func_SendMessageTimeout },
Added: trunk/rostests/apitests/user32/verclasstest1.manifest
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/verclasst…
==============================================================================
--- trunk/rostests/apitests/user32/verclasstest1.manifest (added)
+++ trunk/rostests/apitests/user32/verclasstest1.manifest [iso-8859-1] Mon Feb 6 16:33:25
2017
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
+ <assemblyIdentity type="win32" name="verclasstest1"
version="2.2.2.2" processorArchitecture="x86"/>
+ <file name="user32_apitest.dll">
+ <windowClass>VersionTestClass1</windowClass>
+ <windowClass>VersionTestClass2</windowClass>
+ <windowClass>VersionTestClass4</windowClass>
+ </file>
+</assembly>
Propchange: trunk/rostests/apitests/user32/verclasstest1.manifest
------------------------------------------------------------------------------
svn:eol-style = CRLF
Added: trunk/rostests/apitests/user32/verclasstest2.manifest
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/verclasst…
==============================================================================
--- trunk/rostests/apitests/user32/verclasstest2.manifest (added)
+++ trunk/rostests/apitests/user32/verclasstest2.manifest [iso-8859-1] Mon Feb 6 16:33:25
2017
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
+ <assemblyIdentity type="win32" name="verclasstest2"
version="3.3.3.3" processorArchitecture="x86"
publicKeyToken="6595b64144ccf1df"/>
+ <file name="user32_apitest.exe">
+ <windowClass>VersionTestClass1</windowClass>
+ <windowClass>VersionTestClass2</windowClass>
+ <windowClass>VersionTestClass3</windowClass>
+ <windowClass>Button</windowClass>
+ </file>
+</assembly>
Propchange: trunk/rostests/apitests/user32/verclasstest2.manifest
------------------------------------------------------------------------------
svn:eol-style = CRLF