Jacek Caban : atlthunk/tests: Add tests.

Alexandre Julliard julliard at winehq.org
Tue Feb 19 15:29:33 CST 2019


Module: wine
Branch: master
Commit: 2f9922903ee79b2c56c413c84e3507aa5cfb22ef
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2f9922903ee79b2c56c413c84e3507aa5cfb22ef

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Feb 18 22:06:22 2019 +0100

atlthunk/tests: Add tests.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 configure                       |  1 +
 configure.ac                    |  1 +
 dlls/atlthunk/tests/Makefile.in |  6 ++++
 dlls/atlthunk/tests/atlthunk.c  | 62 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 70 insertions(+)

diff --git a/configure b/configure
index b86e260..f3739a4 100755
--- a/configure
+++ b/configure
@@ -19359,6 +19359,7 @@ wine_fn_config_makefile dlls/atl80 enable_atl80
 wine_fn_config_makefile dlls/atl80/tests enable_tests
 wine_fn_config_makefile dlls/atl90 enable_atl90
 wine_fn_config_makefile dlls/atlthunk enable_atlthunk
+wine_fn_config_makefile dlls/atlthunk/tests enable_tests
 wine_fn_config_makefile dlls/atmlib enable_atmlib
 wine_fn_config_makefile dlls/authz enable_authz
 wine_fn_config_makefile dlls/avicap32 enable_avicap32
diff --git a/configure.ac b/configure.ac
index da14848..f7eb42b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3094,6 +3094,7 @@ WINE_CONFIG_MAKEFILE(dlls/atl80)
 WINE_CONFIG_MAKEFILE(dlls/atl80/tests)
 WINE_CONFIG_MAKEFILE(dlls/atl90)
 WINE_CONFIG_MAKEFILE(dlls/atlthunk)
+WINE_CONFIG_MAKEFILE(dlls/atlthunk/tests)
 WINE_CONFIG_MAKEFILE(dlls/atmlib)
 WINE_CONFIG_MAKEFILE(dlls/authz)
 WINE_CONFIG_MAKEFILE(dlls/avicap32)
diff --git a/dlls/atlthunk/tests/Makefile.in b/dlls/atlthunk/tests/Makefile.in
new file mode 100644
index 0000000..9da3a96
--- /dev/null
+++ b/dlls/atlthunk/tests/Makefile.in
@@ -0,0 +1,6 @@
+TESTDLL   = atlthunk.dll
+IMPORTS   = atlthunk
+
+
+C_SRCS = \
+	atlthunk.c
diff --git a/dlls/atlthunk/tests/atlthunk.c b/dlls/atlthunk/tests/atlthunk.c
new file mode 100644
index 0000000..b316ae1
--- /dev/null
+++ b/dlls/atlthunk/tests/atlthunk.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2019 Jacek Caban for CodeWeavers
+ *
+ * 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 "windows.h"
+#include "atlthunk.h"
+#include "wine/test.h"
+
+static LRESULT WINAPI test_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+    ok(msg == 1, "msg = %u\n", msg);
+    ok(wparam == 2, "wparam = %lu\n", wparam);
+    ok(lparam == 3, "lparam = %lu\n", lparam);
+    return (LRESULT)hwnd | 0x1000;
+}
+
+static void test_thunk_proc(void)
+{
+    AtlThunkData_t *thunks[513];
+    WNDPROC thunk_proc;
+    LRESULT res;
+    int i;
+
+    for(i=0; i < ARRAY_SIZE(thunks); i++)
+    {
+        thunks[i] = AtlThunk_AllocateData();
+        ok(thunks[i] != NULL, "thunk = NULL\n");
+
+        AtlThunk_InitData(thunks[i], test_proc, i);
+    }
+
+    for(i=0; i < ARRAY_SIZE(thunks); i++)
+    {
+        thunk_proc = AtlThunk_DataToCode(thunks[i]);
+        ok(thunk_proc != NULL, "thunk_proc = NULL\n");
+
+        res = thunk_proc((HWND)0x1234, 1, 2, 3);
+        ok(res == (i | 0x1000), "res = %lu\n", res);
+    }
+
+    for(i=0; i < ARRAY_SIZE(thunks); i++)
+        AtlThunk_FreeData(thunks[i]);
+}
+
+START_TEST(atlthunk)
+{
+    test_thunk_proc();
+}




More information about the wine-cvs mailing list