* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+/* make sure the structures work with a comctl32 v5.x */
+#define _WIN32_WINNT 0x500
+#define _WIN32_IE 0x500
+
#include <assert.h>
#include <stdarg.h>
#define expect_eq(expr, value, type, format) { type ret = expr; ok((value) == ret, #expr " expected " format " got " format "\n", (value), (ret)); }
+static INT CALLBACK is_font_installed_proc(const LOGFONT *elf, const TEXTMETRIC *ntm, DWORD type, LPARAM lParam)
+{
+ return 0;
+}
+
+static BOOL is_font_installed(const char *name)
+{
+ HDC hdc = GetDC(0);
+ BOOL ret = FALSE;
+
+ if(!EnumFontFamiliesA(hdc, name, is_font_installed_proc, 0))
+ ret = TRUE;
+
+ ReleaseDC(0, hdc);
+ return ret;
+}
+
static void rebuild_rebar(HWND *hRebar)
{
if (*hRebar)
{ {328, 0, 511, 20}, 0x00, 183}, { {511, 0, 672, 20}, 0x00, 161},
{ { 0, 20, 672, 40}, 0x00, 200},
}, },
+ { {0, 0, 672, 56}, 56, 2, {28, 28, }, 5, {
+ { { 0, 0, 114, 28}, 0x00, 40}, { {114, 0, 328, 28}, 0x00, 214},
+ { {328, 0, 511, 28}, 0x00, 183}, { {511, 0, 672, 28}, 0x00, 161},
+ { { 0, 28, 672, 56}, 0x00, 200},
+ }, },
+ { {0, 0, 672, 40}, 40, 2, {20, 20, }, 5, {
+ { { 0, 0, 114, 20}, 0x00, 40}, { {114, 0, 328, 20}, 0x00, 214},
+ { {328, 0, 511, 20}, 0x00, 183}, { {511, 0, 672, 20}, 0x00, 161},
+ { { 0, 20, 672, 40}, 0x00, 200},
+ }, },
+ { {0, 0, 672, 56}, 56, 2, {28, 28, }, 5, {
+ { { 0, 0, 114, 28}, 0x00, 40}, { {114, 0, 328, 28}, 0x00, 214},
+ { {328, 0, 511, 28}, 0x00, 183}, { {511, 0, 672, 28}, 0x00, 161},
+ { { 0, 28, 672, 56}, 0x00, 200},
+ }, },
{ {0, 0, 672, 0}, 0, 0, {0, }, 0, {{{0, 0, 0, 0}, 0, 0},
}, },
{ {0, 0, 672, 65}, 65, 1, {65, }, 3, {
SendMessage(hRebar, RB_INSERTBAND, -1, (LPARAM)&rbi);
}
-static void layout_test()
+static void layout_test(void)
{
HWND hRebar = NULL;
REBARBANDINFO rbi;
+ HIMAGELIST himl;
+ REBARINFO ri;
rebuild_rebar(&hRebar);
check_sizes();
SendMessageA(hRebar, RB_MINIMIZEBAND, 0, 0);
check_sizes();
+ /* an image will increase the band height */
+ himl = ImageList_LoadImage(LoadLibrary("comctl32"), MAKEINTRESOURCE(121), 24, 2, CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR);
+ ri.cbSize = sizeof(ri);
+ ri.fMask = RBIM_IMAGELIST;
+ ri.himl = himl;
+ ok(SendMessage(hRebar, RB_SETBARINFO, 0, (LPARAM)&ri), "RB_SETBARINFO failed\n");
+ rbi.fMask = RBBIM_IMAGE;
+ rbi.iImage = 1;
+ SendMessage(hRebar, RB_SETBANDINFO, 1, (LPARAM)&rbi);
+ check_sizes();
+
+ /* after removing it everything is back to normal*/
+ rbi.iImage = -1;
+ SendMessage(hRebar, RB_SETBANDINFO, 1, (LPARAM)&rbi);
+ check_sizes();
+
+ /* Only -1 means that the image is not present. Other invalid values increase the height */
+ rbi.iImage = -2;
+ SendMessage(hRebar, RB_SETBANDINFO, 1, (LPARAM)&rbi);
+ check_sizes();
+
/* VARHEIGHT resizing test on a horizontal rebar */
rebuild_rebar(&hRebar);
SetWindowLong(hRebar, GWL_STYLE, GetWindowLong(hRebar, GWL_STYLE) | RBS_AUTOSIZE);
RECT r;
BOOL notify;
GetWindowRect(hRebar, &r);
- MapWindowPoints(HWND_DESKTOP, hMainWnd, (LPPOINT)&r, 2);
+ MapWindowPoints(HWND_DESKTOP, hMainWnd, &r, 2);
if (height_change_notify_rect.top != -1)
{
RECT rcClient;
#endif
-static void resize_test()
+static void resize_test(void)
{
DWORD dwStyles[] = {CCS_TOP, CCS_TOP | CCS_NODIVIDER, CCS_BOTTOM, CCS_BOTTOM | CCS_NODIVIDER, CCS_VERT, CCS_RIGHT,
CCS_NOPARENTALIGN, CCS_NOPARENTALIGN | CCS_NODIVIDER, CCS_NORESIZE, CCS_NOMOVEY, CCS_NOMOVEY | CCS_VERT,
}
}
-static void expect_band_content(UINT uBand, UINT fStyle, COLORREF clrFore,
+static void expect_band_content(UINT uBand, INT fStyle, COLORREF clrFore,
COLORREF clrBack, LPCSTR lpText, int iImage, HWND hwndChild,
- UINT cxMinChild, UINT cyMinChild, UINT cx, HBITMAP hbmBack, UINT wID,
- UINT cyChild, UINT cyMaxChild, UINT cyIntegral, UINT cxIdeal, LPARAM lParam,
- UINT cxHeader)
+ INT cxMinChild, INT cyMinChild, INT cx, HBITMAP hbmBack, INT wID,
+ INT cyChild, INT cyMaxChild, INT cyIntegral, INT cxIdeal, LPARAM lParam,
+ INT cxHeader)
{
CHAR buf[MAX_PATH] = "abc";
REBARBANDINFO rb;
ok(SendMessageA(hRebar, RB_GETBANDINFOA, uBand, (LPARAM)&rb), "RB_GETBANDINFO failed\n");
expect_eq(rb.fStyle, fStyle, int, "%x");
todo_wine expect_eq(rb.clrFore, clrFore, COLORREF, "%x");
- todo_wine expect_eq(rb.clrBack, clrBack, int, "%x");
+ todo_wine expect_eq(rb.clrBack, clrBack, unsigned, "%x");
expect_eq(strcmp(rb.lpText, lpText), 0, int, "%d");
expect_eq(rb.iImage, iImage, int, "%x");
expect_eq(rb.hwndChild, hwndChild, HWND, "%p");
expect_eq(rb.cxHeader, cxHeader, int, "%d");
}
-static void bandinfo_test()
+static void bandinfo_test(void)
{
REBARBANDINFOA rb;
CHAR szABC[] = "ABC";
START_TEST(rebar)
{
- INITCOMMONCONTROLSEX icc;
+ HMODULE hComctl32;
+ BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
+ INITCOMMONCONTROLSEX iccex;
WNDCLASSA wc;
MSG msg;
RECT rc;
- icc.dwSize = sizeof(icc);
- icc.dwICC = ICC_COOL_CLASSES;
- InitCommonControlsEx(&icc);
+ /* LoadLibrary is needed. This file has no references to functions in comctl32 */
+ hComctl32 = LoadLibraryA("comctl32.dll");
+ pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
+ if (!pInitCommonControlsEx)
+ {
+ skip("InitCommonControlsEx() is missing. Skipping the tests\n");
+ return;
+ }
+ iccex.dwSize = sizeof(iccex);
+ iccex.dwICC = ICC_COOL_CLASSES;
+ pInitCommonControlsEx(&iccex);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandleA(NULL);
wc.hIcon = NULL;
- wc.hCursor = LoadCursorA(NULL, MAKEINTRESOURCEA(IDC_IBEAM));
+ wc.hCursor = LoadCursorA(NULL, IDC_IBEAM);
wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
wc.lpszMenuName = NULL;
wc.lpszClassName = "MyTestWnd";
wc.lpfnWndProc = MyWndProc;
RegisterClassA(&wc);
hMainWnd = CreateWindowExA(0, "MyTestWnd", "Blah", WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT, CW_USEDEFAULT, 680, 226+GetSystemMetrics(SM_CYCAPTION)+2*GetSystemMetrics(SM_CYSIZEFRAME),
+ CW_USEDEFAULT, CW_USEDEFAULT, 672+2*GetSystemMetrics(SM_CXSIZEFRAME),
+ 226+GetSystemMetrics(SM_CYCAPTION)+2*GetSystemMetrics(SM_CYSIZEFRAME),
NULL, NULL, GetModuleHandleA(NULL), 0);
GetClientRect(hMainWnd, &rc);
ShowWindow(hMainWnd, SW_SHOW);
bandinfo_test();
- layout_test();
- resize_test();
+
+ if(is_font_installed("System") && is_font_installed("Tahoma"))
+ {
+ layout_test();
+ resize_test();
+ } else
+ skip("Missing System or Tahoma font\n");
+
PostQuitMessage(0);
while(GetMessageA(&msg,0,0,0)) {
TranslateMessage(&msg);
DispatchMessageA(&msg);
}
DestroyWindow(hMainWnd);
+
+ FreeLibrary(hComctl32);
}