Zhiyi Zhang : user32/tests: Test button styles.
Alexandre Julliard
julliard at winehq.org
Wed May 6 15:34:28 CDT 2020
Module: wine
Branch: master
Commit: 18cf85a3fc713452fc398f5ac6a349f70ef39eab
URL: https://source.winehq.org/git/wine.git/?a=commit;h=18cf85a3fc713452fc398f5ac6a349f70ef39eab
Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date: Wed May 6 16:47:38 2020 +0800
user32/tests: Test button styles.
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/tests/msg.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 93ab7b4a27..f84525a0bf 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -31,6 +31,7 @@
#include "winuser.h"
#include "winnls.h"
#include "dbt.h"
+#include "commctrl.h"
#include "wine/test.h"
@@ -17881,6 +17882,37 @@ static void test_invalid_window(void)
ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError());
}
+static void test_button_style(void)
+{
+ DWORD type, expected_type;
+ HWND button;
+ LRESULT ret;
+ DWORD i, j;
+
+ for (i = BS_PUSHBUTTON; i <= BS_DEFCOMMANDLINK; ++i)
+ {
+ button = CreateWindowA(WC_BUTTONA, "test", i, 0, 0, 50, 50, NULL, 0, 0, NULL);
+ ok(button != NULL, "Expected button not null.\n");
+
+ type = GetWindowLongW(button, GWL_STYLE) & BS_TYPEMASK;
+ expected_type = (i == BS_USERBUTTON ? BS_PUSHBUTTON : i);
+ ok(type == expected_type, "Expected type %#x, got %#x.\n", expected_type, type);
+
+ for (j = BS_PUSHBUTTON; j <= BS_DEFCOMMANDLINK; ++j)
+ {
+ ret = SendMessageA(button, BM_SETSTYLE, j, FALSE);
+ ok(ret == 0, "Expected %#x, got %#lx.\n", 0, ret);
+
+ type = GetWindowLongW(button, GWL_STYLE) & BS_TYPEMASK;
+ expected_type = j;
+
+ ok(type == expected_type, "Original type %#x, expected new type %#x, got %#x.\n", i,
+ expected_type, type);
+ }
+ DestroyWindow(button);
+ }
+}
+
START_TEST(msg)
{
char **test_argv;
@@ -17964,6 +17996,7 @@ START_TEST(msg)
test_mdi_messages();
test_button_messages();
test_button_bm_get_set_image();
+ test_button_style();
test_autoradio_BM_CLICK();
test_autoradio_kbd_move();
test_static_messages();
More information about the wine-cvs
mailing list