[COMCTL32] -Test BCM_SETTEXTMARGIN, BCM_SETIMAGELIST, BCM_GETIMAGELIST and BCM_GETTEX...
authorGiannis Adamopoulos <gadamopoulos@reactos.org>
Sat, 25 Feb 2017 22:12:08 +0000 (22:12 +0000)
committerGiannis Adamopoulos <gadamopoulos@reactos.org>
Sat, 25 Feb 2017 22:12:08 +0000 (22:12 +0000)
svn path=/trunk/; revision=73912

rostests/apitests/CMakeLists.txt
rostests/apitests/comctl32/CMakeLists.txt [new file with mode: 0644]
rostests/apitests/comctl32/button.c [new file with mode: 0644]
rostests/apitests/comctl32/comctl32_apitest.rc [new file with mode: 0644]
rostests/apitests/comctl32/testlist.c [new file with mode: 0644]

index e43ca4f..f240b57 100644 (file)
@@ -6,6 +6,7 @@ add_subdirectory(appshim)
 add_subdirectory(atl)
 add_subdirectory(browseui)
 add_subdirectory(com)
+add_subdirectory(comctl32)
 add_subdirectory(crt)
 add_subdirectory(dbghelp)
 add_subdirectory(dciman32)
diff --git a/rostests/apitests/comctl32/CMakeLists.txt b/rostests/apitests/comctl32/CMakeLists.txt
new file mode 100644 (file)
index 0000000..addee1b
--- /dev/null
@@ -0,0 +1,6 @@
+
+add_executable(comctl32_apitest button.c testlist.c comctl32_apitest.rc)
+target_link_libraries(comctl32_apitest wine)
+set_module_type(comctl32_apitest win32cui)
+add_importlibs(comctl32_apitest user32 msvcrt kernel32 ntdll)
+add_rostests_file(TARGET comctl32_apitest)
diff --git a/rostests/apitests/comctl32/button.c b/rostests/apitests/comctl32/button.c
new file mode 100644 (file)
index 0000000..2352c3c
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * PROJECT:         ReactOS api tests
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * PURPOSE:         Test for Button window class v6
+ * PROGRAMMERS:     Giannis Adamopoulos
+ */
+
+#include "wine/test.h"
+#include <windows.h>
+#include <commctrl.h>
+
+#define ok_rect(rc, l,r,t,b) ok((rc.left == (l)) && (rc.right == (r)) && (rc.top == (t)) && (rc.bottom == (b)), "Wrong rect. expected %d, %d, %d, %d got %ld, %ld, %ld, %ld\n", l,t,r,b, rc.left, rc.top, rc.right, rc.bottom)
+
+void Test_TextMargin()
+{
+    RECT rc;
+    BOOL ret;
+    HWND hwnd1;
+    
+    hwnd1 = CreateWindowW(L"Button", L"Test1", 0, 10, 10, 100, 100, 0, NULL, NULL, NULL);
+    ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
+    
+    ret = SendMessageW(hwnd1, BCM_GETTEXTMARGIN, 0, (LPARAM)&rc);
+    ok (ret == TRUE, "Expected BCM_GETTEXTMARGIN to succeed\n");
+    ok_rect(rc, 1, 1, 1, 1);
+    
+    SetRect(&rc, 0,0,0,0);
+    ret = SendMessageW(hwnd1, BCM_SETTEXTMARGIN, 0, (LPARAM)&rc);
+    ok (ret == TRUE, "Expected BCM_SETTEXTMARGIN to succeed\n");
+    
+    ret = SendMessageW(hwnd1, BCM_GETTEXTMARGIN, 0, (LPARAM)&rc);
+    ok (ret == TRUE, "Expected BCM_GETTEXTMARGIN to succeed\n");
+    ok_rect(rc, 0, 0, 0, 0);
+    
+    SetRect(&rc, -1,-1,-1,-1);
+    ret = SendMessageW(hwnd1, BCM_SETTEXTMARGIN, 0, (LPARAM)&rc);
+    ok (ret == TRUE, "Expected BCM_SETTEXTMARGIN to succeed\n");
+    
+    ret = SendMessageW(hwnd1, BCM_GETTEXTMARGIN, 0, (LPARAM)&rc);
+    ok (ret == TRUE, "Expected BCM_GETTEXTMARGIN to succeed\n");
+    ok_rect(rc, -1, -1, -1, -1);
+
+    SetRect(&rc, 1000,1000,1000,1000);
+    ret = SendMessageW(hwnd1, BCM_SETTEXTMARGIN, 0, (LPARAM)&rc);
+    ok (ret == TRUE, "Expected BCM_SETTEXTMARGIN to succeed\n");
+    
+    ret = SendMessageW(hwnd1, BCM_GETTEXTMARGIN, 0, (LPARAM)&rc);
+    ok (ret == TRUE, "Expected BCM_GETTEXTMARGIN to succeed\n");
+    ok_rect(rc, 1000, 1000, 1000, 1000);
+    
+    DestroyWindow(hwnd1);
+}
+
+void Test_Imagelist()
+{
+    HWND hwnd1;
+    BOOL ret;
+    BUTTON_IMAGELIST imlData;
+
+    hwnd1 = CreateWindowW(L"Button", L"Test2", 0, 10, 10, 100, 100, 0, NULL, NULL, NULL);
+    ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
+
+    ret = SendMessageW(hwnd1, BCM_GETIMAGELIST, 0, (LPARAM)&imlData);
+    ok (ret == TRUE, "Expected BCM_GETIMAGELIST to succeed\n");
+    ok (imlData.himl == 0, "Expected 0 himl\n");
+    ok (imlData.uAlign == 0, "Expected 0 uAlign\n");
+    ok_rect(imlData.margin, 0, 0, 0, 0);
+    
+    SetRect(&imlData.margin, 0,0,0,1);
+    ret = SendMessageW(hwnd1, BCM_SETIMAGELIST, 0, (LPARAM)&imlData);
+    ok (ret == FALSE, "Expected BCM_SETIMAGELIST to fail\n"); /* This works in win10 */
+
+    imlData.himl = (HIMAGELIST)0xdead;
+    ret = SendMessageW(hwnd1, BCM_SETIMAGELIST, 0, (LPARAM)&imlData);
+    ok (ret == TRUE, "Expected BCM_SETIMAGELIST to fail\n"); /* This works in win10 */
+    
+    ret = SendMessageW(hwnd1, BCM_GETIMAGELIST, 0, (LPARAM)&imlData);
+    ok (ret == TRUE, "Expected BCM_GETIMAGELIST to succeed\n");
+    ok (imlData.himl == (HIMAGELIST)0xdead, "Expected 0 himl\n");
+    ok (imlData.uAlign == 0, "Expected 0 uAlign\n");
+    ok_rect(imlData.margin, 0, 0, 0, 1);
+}
+
+START_TEST(button)
+{
+    LoadLibraryW(L"comctl32.dll"); /* same as statically linking to comctl32 and doing InitCommonControls */
+    Test_TextMargin();
+    Test_Imagelist();
+}
+
diff --git a/rostests/apitests/comctl32/comctl32_apitest.rc b/rostests/apitests/comctl32/comctl32_apitest.rc
new file mode 100644 (file)
index 0000000..375af3a
--- /dev/null
@@ -0,0 +1,7 @@
+#include <windef.h>
+#include <winuser.h>
+#include <dlgs.h>
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+
+#include <reactos/manifest_exe.rc>
diff --git a/rostests/apitests/comctl32/testlist.c b/rostests/apitests/comctl32/testlist.c
new file mode 100644 (file)
index 0000000..ba97026
--- /dev/null
@@ -0,0 +1,10 @@
+#define STANDALONE
+#include <apitest.h>
+
+extern void func_button(void);
+
+const struct test winetest_testlist[] =
+{
+    { "button", func_button },
+    { 0, 0 }
+};