comctl32/tests: Use a function instead of a macro for CheckSize test
EG Galano
eg.galano at gmail.com
Tue Feb 8 17:45:22 CST 2011
This fixes the warnings:
comctl32/tests/tab.c:525: warning: logical `&&' with non-zero constant
will always evaluate as true
comctl32/tests/tab.c:545: warning: logical `&&' with non-zero constant
will always evaluate as true
comctl32/tests/tab.c:568: warning: logical `&&' with non-zero constant
will always evaluate as true
comctl32/tests/tab.c:1015: warning: logical `&&' with non-zero
constant will always evaluate as true
for me on Debian gcc 4.3.2
I ran it through the full winetestbot:
https://testbot.winehq.org/JobDetails.pl?Key=9048
-------------- next part --------------
From bbe766dcd3bb53972f82d286de9245c560b569a7 Mon Sep 17 00:00:00 2001
From: E.G. Galano <eg.galano at gmail.com>
Date: Tue, 8 Feb 2011 15:17:13 -0800
Subject: [PATCH] comctl32/tests: Use an inline function instead of a macro
---
dlls/comctl32/tests/tab.c | 40 +++++++++++++++++++++-------------------
1 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/dlls/comctl32/tests/tab.c b/dlls/comctl32/tests/tab.c
index 03c4390..3c6ba58 100644
--- a/dlls/comctl32/tests/tab.c
+++ b/dlls/comctl32/tests/tab.c
@@ -45,21 +45,7 @@
SendMessage (hwnd, TCM_SETITEMSIZE, 0,\
(LPARAM) MAKELPARAM((SetWidth >= 0) ? SetWidth:0, (SetHeight >= 0) ? SetHeight:0));\
if (winetest_interactive) RedrawWindow (hwnd, NULL, 0, RDW_UPDATENOW);\
- CheckSize(hwnd, ExpWidth, ExpHeight, Msg);
-
-#define CheckSize(hwnd,width,height,msg)\
- SendMessage (hwnd, TCM_GETITEMRECT, 0, (LPARAM) &rTab);\
- if ((width >= 0) && (height < 0))\
- ok (width == rTab.right - rTab.left, "%s: Expected width [%d] got [%d]\n",\
- msg, (int)width, rTab.right - rTab.left);\
- else if ((height >= 0) && (width < 0))\
- ok (height == rTab.bottom - rTab.top, "%s: Expected height [%d] got [%d]\n",\
- msg, (int)height, rTab.bottom - rTab.top);\
- else\
- ok ((width == rTab.right - rTab.left) &&\
- (height == rTab.bottom - rTab.top ),\
- "%s: Expected [%d,%d] got [%d,%d]\n", msg, (int)width, (int)height,\
- rTab.right - rTab.left, rTab.bottom - rTab.top);
+ CheckSize(hwnd, ExpWidth, ExpHeight, Msg, rTab);
static HFONT hFont;
static DRAWITEMSTRUCT g_drawitem;
@@ -313,6 +299,22 @@ create_tabcontrol (DWORD style, DWORD mask)
return handle;
}
+static inline void CheckSize(HWND hwnd, INT width, INT height, LPCSTR msg, RECT rTab)
+{
+ SendMessage (hwnd, TCM_GETITEMRECT, 0, (LPARAM) &rTab);
+ if ((width >= 0) && (height < 0))
+ ok (width == rTab.right - rTab.left, "%s: Expected width [%d] got [%d]\n",
+ msg, (int)width, rTab.right - rTab.left);
+ else if ((height >= 0) && (width < 0))
+ ok (height == rTab.bottom - rTab.top, "%s: Expected height [%d] got [%d]\n",
+ msg, (int)height, rTab.bottom - rTab.top);
+ else
+ ok ((width == rTab.right - rTab.left) &&
+ (height == rTab.bottom - rTab.top ),
+ "%s: Expected [%d,%d] got [%d,%d]\n", msg, (int)width, (int)height,
+ rTab.right - rTab.left, rTab.bottom - rTab.top);
+}
+
static LRESULT WINAPI parentWindowProcess(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static LONG defwndproc_counter = 0;
@@ -522,7 +524,7 @@ static void test_tab(INT nMinTabWidth)
ReleaseDC(hwTab, hdc);
trace (" TCS_FIXEDWIDTH tabs no icon...\n");
- CheckSize(hwTab, dpi, -1, "default width");
+ CheckSize(hwTab, dpi, -1, "default width", rTab);
TabCheckSetSize(hwTab, 50, 20, 50, 20, "set size");
TabCheckSetSize(hwTab, 0, 1, 0, 1, "min size");
@@ -542,7 +544,7 @@ static void test_tab(INT nMinTabWidth)
dpi = GetDeviceCaps(hdc, LOGPIXELSX);
ReleaseDC(hwTab, hdc);
trace (" TCS_FIXEDWIDTH buttons no icon...\n");
- CheckSize(hwTab, dpi, -1, "default width");
+ CheckSize(hwTab, dpi, -1, "default width", rTab);
TabCheckSetSize(hwTab, 20, 20, 20, 20, "set size 1");
TabCheckSetSize(hwTab, 10, 50, 10, 50, "set size 2");
TabCheckSetSize(hwTab, 0, 1, 0, 1, "min size");
@@ -565,7 +567,7 @@ static void test_tab(INT nMinTabWidth)
dpi = GetDeviceCaps(hdc, LOGPIXELSX);
ReleaseDC(hwTab, hdc);
trace (" TCS_FIXEDWIDTH | TCS_BOTTOM tabs...\n");
- CheckSize(hwTab, dpi, -1, "no icon, default width");
+ CheckSize(hwTab, dpi, -1, "no icon, default width", rTab);
TabCheckSetSize(hwTab, 20, 20, 20, 20, "no icon, set size 1");
TabCheckSetSize(hwTab, 10, 50, 10, 50, "no icon, set size 2");
@@ -1012,7 +1014,7 @@ static void test_misc(HWND parent_wnd, INT nTabs)
hdc = GetDC(hTab);
dpi = GetDeviceCaps(hdc, LOGPIXELSX);
ReleaseDC(hTab, hdc);
- CheckSize(hTab, dpi, -1 , "Default Width");
+ CheckSize(hTab, dpi, -1 , "Default Width", rTab);
ok_sequence(sequences, TAB_SEQ_INDEX, get_item_rect_seq, "Get itemRect test sequence", FALSE);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Get itemRect test parent sequence", FALSE);
--
1.7.2.2
More information about the wine-patches
mailing list