comctl32: toolbar: Add some tests for TB_ADDBITMAP.
This commit is contained in:
parent
545d0e70cf
commit
80664defa8
|
@ -22,7 +22,11 @@ CTESTS = \
|
||||||
treeview.c \
|
treeview.c \
|
||||||
updown.c
|
updown.c
|
||||||
|
|
||||||
RC_SRCS = propsheet.rc
|
RC_SRCS = rsrc.rc
|
||||||
|
RC_BINSRC = rsrc.rc
|
||||||
|
RC_BINARIES = \
|
||||||
|
bmp128x15.bmp \
|
||||||
|
bmp80x15.bmp
|
||||||
|
|
||||||
@MAKE_TEST_RULES@
|
@MAKE_TEST_RULES@
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* Resources for the unit test suite for property sheet control.
|
/*
|
||||||
|
* Resource IDs
|
||||||
*
|
*
|
||||||
* Copyright 2006 Huw Davies
|
* Copyright 2006 Mikolaj Zalewski
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -17,13 +18,10 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "windef.h"
|
#ifndef __WINE_COMCTL32_TEST_RESOURCES_H
|
||||||
#include "winuser.h"
|
#define __WINE_COMCTL32_TEST_RESOURCES_H
|
||||||
|
|
||||||
PROP_PAGE1 DIALOG LOADONCALL MOVEABLE DISCARDABLE 5, 43, 227, 215
|
#define IDB_BITMAP_128x15 10
|
||||||
STYLE WS_POPUP | WS_CAPTION | WS_CLIPSIBLINGS | WS_VISIBLE
|
#define IDB_BITMAP_80x15 11
|
||||||
CAPTION "Page1"
|
|
||||||
FONT 8, "MS Shell Dlg"
|
#endif /* __WINE_COMCTL32_TEST_RESOURCES_H */
|
||||||
{
|
|
||||||
LTEXT "Test", -1, 10, 6, 100, 8
|
|
||||||
}
|
|
|
@ -0,0 +1,154 @@
|
||||||
|
/* Resources for the common control unit test suite.
|
||||||
|
*
|
||||||
|
* Copyright 2006 Huw Davies
|
||||||
|
* Copyright 2006 Mikolaj Zalewski
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "windef.h"
|
||||||
|
#include "winuser.h"
|
||||||
|
#include "resources.h"
|
||||||
|
|
||||||
|
PROP_PAGE1 DIALOG LOADONCALL MOVEABLE DISCARDABLE 5, 43, 227, 215
|
||||||
|
STYLE WS_POPUP | WS_CAPTION | WS_CLIPSIBLINGS | WS_VISIBLE
|
||||||
|
CAPTION "Page1"
|
||||||
|
FONT 8, "MS Shell Dlg"
|
||||||
|
{
|
||||||
|
LTEXT "Test", -1, 10, 6, 100, 8
|
||||||
|
}
|
||||||
|
|
||||||
|
/* BINRES bmp128x15.bmp */
|
||||||
|
IDB_BITMAP_128x15 BITMAP bmp128x15.bmp
|
||||||
|
/* {
|
||||||
|
'42 4D 36 04 00 00 00 00 00 00 76 00 00 00 28 00'
|
||||||
|
'00 00 80 00 00 00 0F 00 00 00 01 00 04 00 00 00'
|
||||||
|
'00 00 C0 03 00 00 00 00 00 00 00 00 00 00 10 00'
|
||||||
|
'00 00 10 00 00 00 00 00 00 00 00 00 80 00 00 80'
|
||||||
|
'00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80'
|
||||||
|
'00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF'
|
||||||
|
'00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF'
|
||||||
|
'00 00 FF FF FF 00 FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF'
|
||||||
|
} */
|
||||||
|
|
||||||
|
/* BINRES bmp80x15.bmp */
|
||||||
|
IDB_BITMAP_80x15 BITMAP bmp80x15.bmp
|
||||||
|
/* {
|
||||||
|
'42 4D CE 02 00 00 00 00 00 00 76 00 00 00 28 00'
|
||||||
|
'00 00 50 00 00 00 0F 00 00 00 01 00 04 00 00 00'
|
||||||
|
'00 00 58 02 00 00 00 00 00 00 00 00 00 00 10 00'
|
||||||
|
'00 00 10 00 00 00 00 00 00 00 00 00 80 00 00 80'
|
||||||
|
'00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80'
|
||||||
|
'00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF'
|
||||||
|
'00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF'
|
||||||
|
'00 00 FF FF FF 00 FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
|
||||||
|
} */
|
|
@ -28,8 +28,12 @@
|
||||||
#include "winreg.h"
|
#include "winreg.h"
|
||||||
#include "commctrl.h"
|
#include "commctrl.h"
|
||||||
|
|
||||||
|
#include "resources.h"
|
||||||
|
|
||||||
#include "wine/test.h"
|
#include "wine/test.h"
|
||||||
|
|
||||||
|
HWND hMainWnd;
|
||||||
|
|
||||||
static void MakeButton(TBBUTTON *p, int idCommand, int fsStyle, int nString) {
|
static void MakeButton(TBBUTTON *p, int idCommand, int fsStyle, int nString) {
|
||||||
p->iBitmap = -2;
|
p->iBitmap = -2;
|
||||||
p->idCommand = idCommand;
|
p->idCommand = idCommand;
|
||||||
|
@ -40,19 +44,20 @@ static void MakeButton(TBBUTTON *p, int idCommand, int fsStyle, int nString) {
|
||||||
|
|
||||||
static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch(msg) {
|
return DefWindowProcA(hWnd, msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
case WM_CREATE:
|
static void basic_test(void)
|
||||||
{
|
{
|
||||||
TBBUTTON buttons[9];
|
TBBUTTON buttons[9];
|
||||||
int i;
|
|
||||||
HWND hToolbar;
|
HWND hToolbar;
|
||||||
|
int i;
|
||||||
for (i=0; i<9; i++)
|
for (i=0; i<9; i++)
|
||||||
MakeButton(buttons+i, 1000+i, TBSTYLE_CHECKGROUP, 0);
|
MakeButton(buttons+i, 1000+i, TBSTYLE_CHECKGROUP, 0);
|
||||||
MakeButton(buttons+3, 1003, TBSTYLE_SEP|TBSTYLE_GROUP, 0);
|
MakeButton(buttons+3, 1003, TBSTYLE_SEP|TBSTYLE_GROUP, 0);
|
||||||
MakeButton(buttons+6, 1006, TBSTYLE_SEP, 0);
|
MakeButton(buttons+6, 1006, TBSTYLE_SEP, 0);
|
||||||
|
|
||||||
hToolbar = CreateToolbarEx(hWnd,
|
hToolbar = CreateToolbarEx(hMainWnd,
|
||||||
WS_VISIBLE | WS_CLIPCHILDREN | CCS_TOP |
|
WS_VISIBLE | WS_CLIPCHILDREN | CCS_TOP |
|
||||||
WS_CHILD | TBSTYLE_LIST,
|
WS_CHILD | TBSTYLE_LIST,
|
||||||
100,
|
100,
|
||||||
|
@ -60,7 +65,6 @@ static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
|
||||||
buttons, sizeof(buttons)/sizeof(buttons[0]),
|
buttons, sizeof(buttons)/sizeof(buttons[0]),
|
||||||
0, 0, 20, 16, sizeof(TBBUTTON));
|
0, 0, 20, 16, sizeof(TBBUTTON));
|
||||||
ok(hToolbar != NULL, "Toolbar creation\n");
|
ok(hToolbar != NULL, "Toolbar creation\n");
|
||||||
|
|
||||||
SendMessage(hToolbar, TB_ADDSTRINGA, 0, (LPARAM)"test\000");
|
SendMessage(hToolbar, TB_ADDSTRINGA, 0, (LPARAM)"test\000");
|
||||||
|
|
||||||
/* test for exclusion working inside a separator-separated :-) group */
|
/* test for exclusion working inside a separator-separated :-) group */
|
||||||
|
@ -92,17 +96,151 @@ static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
|
||||||
ok(SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1000, 0), "A1 pressed\n");
|
ok(SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1000, 0), "A1 pressed\n");
|
||||||
ok(!SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1007, 0), "B2 not pressed\n");
|
ok(!SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1007, 0), "B2 not pressed\n");
|
||||||
ok(SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1008, 0), "B3 pressed\n");
|
ok(SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1008, 0), "B3 pressed\n");
|
||||||
PostMessage(hWnd, WM_CLOSE, 0, 0);
|
DestroyWindow(hToolbar);
|
||||||
return 0;
|
}
|
||||||
}
|
|
||||||
case WM_DESTROY:
|
|
||||||
PostQuitMessage(0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
static void rebuild_toolbar(HWND *hToolbar)
|
||||||
return DefWindowProcA(hWnd, msg, wParam, lParam);
|
{
|
||||||
}
|
if (*hToolbar != NULL)
|
||||||
return 0L;
|
DestroyWindow(*hToolbar);
|
||||||
|
*hToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
|
||||||
|
hMainWnd, (HMENU)5, GetModuleHandle(NULL), NULL);
|
||||||
|
ok(*hToolbar != NULL, "Toolbar creation problem\n");
|
||||||
|
ok(SendMessage(*hToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0) == 0, "TB_BUTTONSTRUCTSIZE failed\n");
|
||||||
|
ok(SendMessage(*hToolbar, TB_AUTOSIZE, 0, 0) == 0, "TB_AUTOSIZE failed\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHECK_IMAGELIST(count, dx, dy) { \
|
||||||
|
int cx, cy; \
|
||||||
|
HIMAGELIST himl = (HIMAGELIST)SendMessageA(hToolbar, TB_GETIMAGELIST, 0, 0); \
|
||||||
|
ok(himl != NULL, "No image list\n"); \
|
||||||
|
if (himl != NULL) {\
|
||||||
|
ok(ImageList_GetImageCount(himl) == count, "Images count mismatch - %d vs %d\n", count, ImageList_GetImageCount(himl)); \
|
||||||
|
ImageList_GetIconSize(himl, &cx, &cy); \
|
||||||
|
ok(cx == dx && cy == cy, "Icon size mismatch - %dx%d vs %dx%d\n", dx, dy, cx, cy); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHECK_IMAGELIST_TODO_COUNT(count, dx, dy) { \
|
||||||
|
int cx, cy; \
|
||||||
|
HIMAGELIST himl = (HIMAGELIST)SendMessageA(hToolbar, TB_GETIMAGELIST, 0, 0); \
|
||||||
|
ok(himl != NULL, "No image list\n"); \
|
||||||
|
if (himl != NULL) {\
|
||||||
|
todo_wine ok(ImageList_GetImageCount(himl) == count, "Images count mismatch - %d vs %d\n", count, ImageList_GetImageCount(himl)); \
|
||||||
|
ImageList_GetIconSize(himl, &cx, &cy); \
|
||||||
|
ok(cx == dx && cy == cy, "Icon size mismatch - %dx%d vs %dx%d\n", dx, dy, cx, cy); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHECK_IMAGELIST_TODO_COUNT_SIZE(count, dx, dy) { \
|
||||||
|
int cx, cy; \
|
||||||
|
HIMAGELIST himl = (HIMAGELIST)SendMessageA(hToolbar, TB_GETIMAGELIST, 0, 0); \
|
||||||
|
ok(himl != NULL, "No image list\n"); \
|
||||||
|
if (himl != NULL) {\
|
||||||
|
todo_wine ok(ImageList_GetImageCount(himl) == count, "Images count mismatch - %d vs %d\n", count, ImageList_GetImageCount(himl)); \
|
||||||
|
ImageList_GetIconSize(himl, &cx, &cy); \
|
||||||
|
todo_wine ok(cx == dx && cy == cy, "Icon size mismatch - %dx%d vs %dx%d\n", dx, dy, cx, cy); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_add_bitmap(void)
|
||||||
|
{
|
||||||
|
HWND hToolbar = NULL;
|
||||||
|
TBADDBITMAP bmp128;
|
||||||
|
TBADDBITMAP bmp80;
|
||||||
|
TBADDBITMAP stdsmall;
|
||||||
|
INT ret;
|
||||||
|
|
||||||
|
/* empty 128x15 bitmap */
|
||||||
|
bmp128.hInst = GetModuleHandle(NULL);
|
||||||
|
bmp128.nID = IDB_BITMAP_128x15;
|
||||||
|
|
||||||
|
/* empty 80x15 bitmap */
|
||||||
|
bmp80.hInst = GetModuleHandle(NULL);
|
||||||
|
bmp80.nID = IDB_BITMAP_80x15;
|
||||||
|
|
||||||
|
/* standard bitmap - 240x15 pixels */
|
||||||
|
stdsmall.hInst = HINST_COMMCTRL;
|
||||||
|
stdsmall.nID = IDB_STD_SMALL_COLOR;
|
||||||
|
|
||||||
|
rebuild_toolbar(&hToolbar);
|
||||||
|
ok(SendMessageA(hToolbar, TB_ADDBITMAP, 8, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
|
||||||
|
CHECK_IMAGELIST(8, 16, 15);
|
||||||
|
|
||||||
|
/* adding more bitmaps */
|
||||||
|
ok(SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp80) == 8, "TB_ADDBITMAP - unexpected return\n");
|
||||||
|
CHECK_IMAGELIST(13, 16, 15);
|
||||||
|
/* adding the same bitmap will simply return the index of the already loaded block */
|
||||||
|
ret = SendMessageA(hToolbar, TB_ADDBITMAP, 8, (LPARAM)&bmp128);
|
||||||
|
todo_wine ok(ret == 0, "TB_ADDBITMAP - unexpected return %d\n", ret);
|
||||||
|
CHECK_IMAGELIST_TODO_COUNT(13, 16, 15);
|
||||||
|
ret = SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp80);
|
||||||
|
todo_wine ok(ret == 8, "TB_ADDBITMAP - unexpected return %d\n", ret);
|
||||||
|
CHECK_IMAGELIST_TODO_COUNT(13, 16, 15);
|
||||||
|
/* even if we increase the wParam */
|
||||||
|
ret = SendMessageA(hToolbar, TB_ADDBITMAP, 55, (LPARAM)&bmp80);
|
||||||
|
todo_wine ok(ret == 8, "TB_ADDBITMAP - unexpected return %d\n", ret);
|
||||||
|
CHECK_IMAGELIST_TODO_COUNT(13, 16, 15);
|
||||||
|
|
||||||
|
/* when the wParam is smaller than the bitmaps count but non-zero, all the bitmaps will be added*/
|
||||||
|
rebuild_toolbar(&hToolbar);
|
||||||
|
ok(SendMessageA(hToolbar, TB_ADDBITMAP, 3, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
|
||||||
|
CHECK_IMAGELIST(8, 16, 15);
|
||||||
|
ret = SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp80);
|
||||||
|
todo_wine ok(ret == 3, "TB_ADDBITMAP - unexpected return %d\n", ret);
|
||||||
|
/* the returned value is misleading - id 8 is the id of the first icon from bmp80 */
|
||||||
|
CHECK_IMAGELIST(13, 16, 15);
|
||||||
|
|
||||||
|
/* the same for negative wParam */
|
||||||
|
rebuild_toolbar(&hToolbar);
|
||||||
|
ret = SendMessageA(hToolbar, TB_ADDBITMAP, -143, (LPARAM)&bmp128);
|
||||||
|
todo_wine ok(ret == 0, "TB_ADDBITMAP - unexpected return %d\n", ret);
|
||||||
|
todo_wine CHECK_IMAGELIST(8, 16, 15);
|
||||||
|
ret = SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&bmp80);
|
||||||
|
todo_wine ok(ret == -143, "TB_ADDBITMAP - unexpected return %d\n", ret);
|
||||||
|
CHECK_IMAGELIST_TODO_COUNT(13, 16, 15);
|
||||||
|
|
||||||
|
/* for zero only one bitmap will be added */
|
||||||
|
rebuild_toolbar(&hToolbar);
|
||||||
|
ret = SendMessageA(hToolbar, TB_ADDBITMAP, 0, (LPARAM)&bmp80);
|
||||||
|
todo_wine ok(ret == 0, "TB_ADDBITMAP - unexpected return %d\n", ret);
|
||||||
|
todo_wine CHECK_IMAGELIST(1, 16, 15);
|
||||||
|
|
||||||
|
/* if wParam is larger than the amount of icons, the list is grown */
|
||||||
|
rebuild_toolbar(&hToolbar);
|
||||||
|
ok(SendMessageA(hToolbar, TB_ADDBITMAP, 100, (LPARAM)&bmp80) == 0, "TB_ADDBITMAP - unexpected return\n");
|
||||||
|
CHECK_IMAGELIST_TODO_COUNT(100, 16, 15);
|
||||||
|
ret = SendMessageA(hToolbar, TB_ADDBITMAP, 100, (LPARAM)&bmp128);
|
||||||
|
todo_wine ok(ret == 100, "TB_ADDBITMAP - unexpected return %d\n", ret);
|
||||||
|
CHECK_IMAGELIST_TODO_COUNT(200, 16, 15);
|
||||||
|
|
||||||
|
/* adding built-in items - the wParam is ignored */
|
||||||
|
rebuild_toolbar(&hToolbar);
|
||||||
|
ok(SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp80) == 0, "TB_ADDBITMAP - unexpected return\n");
|
||||||
|
CHECK_IMAGELIST(5, 16, 15);
|
||||||
|
ok(SendMessageA(hToolbar, TB_ADDBITMAP, 0, (LPARAM)&stdsmall) == 5, "TB_ADDBITMAP - unexpected return\n");
|
||||||
|
CHECK_IMAGELIST(20, 16, 15);
|
||||||
|
ok(SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp128) == 20, "TB_ADDBITMAP - unexpected return\n");
|
||||||
|
CHECK_IMAGELIST(28, 16, 15);
|
||||||
|
|
||||||
|
/* when we increase the bitmap size, less icons will be created */
|
||||||
|
rebuild_toolbar(&hToolbar);
|
||||||
|
ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(20, 20)) == TRUE, "TB_SETBITMAPSIZE failed\n");
|
||||||
|
ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
|
||||||
|
CHECK_IMAGELIST(6, 20, 20);
|
||||||
|
ret = SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&bmp80);
|
||||||
|
todo_wine ok(ret == 1, "TB_ADDBITMAP - unexpected return %d\n", ret);
|
||||||
|
CHECK_IMAGELIST(10, 20, 20);
|
||||||
|
/* the icons can be resized - an UpdateWindow is needed as this probably happens during WM_PAINT */
|
||||||
|
ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(8, 8)) == TRUE, "TB_SETBITMAPSIZE failed\n");
|
||||||
|
UpdateWindow(hToolbar);
|
||||||
|
CHECK_IMAGELIST_TODO_COUNT_SIZE(26, 8, 8);
|
||||||
|
/* loading a standard bitmaps automatically resizes the icons */
|
||||||
|
todo_wine ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&stdsmall) == 2, "TB_ADDBITMAP - unexpected return\n");
|
||||||
|
UpdateWindow(hToolbar);
|
||||||
|
CHECK_IMAGELIST_TODO_COUNT_SIZE(28, 16, 15);
|
||||||
|
|
||||||
|
DestroyWindow(hToolbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(toolbar)
|
START_TEST(toolbar)
|
||||||
|
@ -110,7 +248,6 @@ START_TEST(toolbar)
|
||||||
WNDCLASSA wc;
|
WNDCLASSA wc;
|
||||||
MSG msg;
|
MSG msg;
|
||||||
RECT rc;
|
RECT rc;
|
||||||
HWND hMainWnd;
|
|
||||||
|
|
||||||
InitCommonControls();
|
InitCommonControls();
|
||||||
|
|
||||||
|
@ -129,9 +266,15 @@ START_TEST(toolbar)
|
||||||
hMainWnd = CreateWindowExA(0, "MyTestWnd", "Blah", WS_OVERLAPPEDWINDOW,
|
hMainWnd = CreateWindowExA(0, "MyTestWnd", "Blah", WS_OVERLAPPEDWINDOW,
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT, 680, 260, NULL, NULL, GetModuleHandleA(NULL), 0);
|
CW_USEDEFAULT, CW_USEDEFAULT, 680, 260, NULL, NULL, GetModuleHandleA(NULL), 0);
|
||||||
GetClientRect(hMainWnd, &rc);
|
GetClientRect(hMainWnd, &rc);
|
||||||
|
ShowWindow(hMainWnd, SW_SHOW);
|
||||||
|
|
||||||
|
basic_test();
|
||||||
|
test_add_bitmap();
|
||||||
|
|
||||||
|
PostQuitMessage(0);
|
||||||
while(GetMessageA(&msg,0,0,0)) {
|
while(GetMessageA(&msg,0,0,0)) {
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessageA(&msg);
|
DispatchMessageA(&msg);
|
||||||
}
|
}
|
||||||
|
DestroyWindow(hMainWnd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue