comctl32/tests: Use inline function in expect*() macros to handle integral conversion.

depending on the files, these macros can be called with:
- UINT/UINT, DWORD/DWORD pairs, but also UINT/DWORD or DWORD/UINT pairs...
- wrapping inside an inline function allows the compiler to take care of
  the integral conversions

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2022-02-24 11:26:53 +01:00 committed by Alexandre Julliard
parent 330261b9b4
commit 2596bd57c6
9 changed files with 61 additions and 13 deletions

View File

@ -32,7 +32,11 @@
#include "wine/test.h"
#include "v6util.h"
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
#define expect(expected,got) expect_(__LINE__, expected, got)
static inline void expect_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %d, got %d\n", expected, got);
}
typedef struct _STREAMDATA
{

View File

@ -2032,8 +2032,11 @@ static void test_margins_font_change(void)
}
#define edit_pos_ok(exp, got, txt) \
ok(exp == got, "wrong " #txt " expected %d got %d\n", exp, got);
#define edit_pos_ok(expected, got, txt) edit_pos_ok_(__LINE__, expected, got, #txt)
static inline void edit_pos_ok_(unsigned line, DWORD expected, DWORD got, const char* txt)
{
ok_(__FILE__, line)(expected == got, "wrong %s expected %d got %d\n", txt, expected, got);
}
#define check_pos(hwEdit, set_height, test_top, test_height, test_left) \
do { \

View File

@ -56,7 +56,11 @@ static HWND hWndHeader;
#define compare(val, exp, fmt) ok((val) == (exp), #val " value: " fmt ", expected: " fmt "\n", (val), (exp))
#define expect(expected, got) ok(expected == got, "expected %d, got %d\n", expected,got)
#define expect(expected,got) expect_(__LINE__, expected, got)
static inline void expect_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %d, got %d\n", expected, got);
}
#define NUM_MSG_SEQUENCES 2
#define PARENT_SEQ_INDEX 0

View File

@ -46,9 +46,19 @@ enum seq_index {
#define LISTVIEW_ID 0
#define HEADER_ID 1
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
#define expect2(expected1, expected2, got1, got2) ok(expected1 == got1 && expected2 == got2, \
"expected (%d,%d), got (%d,%d)\n", expected1, expected2, got1, got2)
#define expect(expected,got) expect_(__LINE__, expected, got)
static inline void expect_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %d, got %d\n", expected, got);
}
#define expect2(expected1, expected2, got1, got2) expect2_(__LINE__, expected1, expected2, got1, got2)
static inline void expect2_(unsigned line, DWORD expected1, DWORD expected2, DWORD got1, DWORD got2)
{
ok_(__FILE__, line)(expected1 == got1 && expected2 == got2,
"expected (%d,%d), got (%d,%d)\n",
expected1, expected2, got1, got2);
}
static HWND hwndparent, hwndparentW;
/* prevents edit box creation, LVN_BEGINLABELEDIT return value */

View File

@ -32,8 +32,17 @@
#include <windows.h>
#include "msg.h"
#define expect(expected, got) ok(expected == got, "Expected %d, got %d\n", expected, got);
#define expect_hex(expected, got) ok(expected == got, "Expected %x, got %x\n", expected, got);
#define expect(expected,got) expect_(__LINE__, expected, got)
static inline void expect_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %d, got %d\n", expected, got);
}
#define expect_hex(expected,got) expect_hex_(__LINE__, expected, got)
static inline void expect_hex_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %x, got %x\n", expected, got);
}
#define expect_d(expected, got) ok(abs((expected) - (got)) <= 2, "Expected %d, got %d\n", expected, got);
#define NUM_MSG_SEQUENCES 2

View File

@ -34,7 +34,12 @@
#define PARENT_SEQ_INDEX 0
#define TAB_SEQ_INDEX 1
#define expect(expected, got) ok ( expected == got, "Expected %d, got %d\n", expected, got)
#define expect(expected,got) expect_(__LINE__, expected, got)
static inline void expect_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %d, got %d\n", expected, got);
}
#define expect_str(expected, got)\
ok ( strcmp(expected, got) == 0, "Expected '%s', got '%s'\n", expected, got)

View File

@ -25,7 +25,12 @@
#include "msg.h"
#include "v6util.h"
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
#define expect(expected,got) expect_(__LINE__, expected, got)
static inline void expect_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %d, got %d\n", expected, got);
}
#define NUM_MSG_SEQUENCE 2
#define PARENT_SEQ_INDEX 0
#define TRACKBAR_SEQ_INDEX 1

View File

@ -57,7 +57,11 @@ static BOOL g_v6;
#define PARENT_SEQ_INDEX 1
#define PARENT_CD_SEQ_INDEX 2
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
#define expect(expected,got) expect_(__LINE__, expected, got)
static inline void expect_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %d, got %d\n", expected, got);
}
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
static struct msg_sequence *item_sequence[1];

View File

@ -50,7 +50,11 @@
#include "wine/test.h"
#include "msg.h"
#define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT))
#define expect(expected,got) expect_(__LINE__, expected, got)
static inline void expect_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %d, got %d\n", expected, got);
}
#define NUM_MSG_SEQUENCES 3
#define PARENT_SEQ_INDEX 0