[COMCTL32_APITESTS] -Add toolbar tests for TB_SETBUTTONSIZE, TB_SETPADDING, TB_GETBUTTONSIZE, TB_GETMETRICS.

svn path=/trunk/; revision=75462
This commit is contained in:
Giannis Adamopoulos
2017-07-31 13:04:09 +00:00
parent 26c43d8081
commit 6aa52a76c8

View File

@@ -62,6 +62,141 @@ void TestVersionMessage()
DestroyWindow(hwnd);
}
void TestSetButtonSize()
{
HWND hwnd;
LRESULT bsize;
hwnd = CreateWindowExW(0, TOOLBARCLASSNAMEW, L"Test", 0, 0, 0, 0, 0, 0, 0, 0, NULL);
ok(hwnd != NULL, "CreateWindowEx failed\n");
bsize = SendMessageW(hwnd, TB_GETBUTTONSIZE, 0, 0);
ok(bsize == 0x160017, "Expected 0x160017 got %lx\n", bsize);
SendMessageW(hwnd, TB_SETBUTTONSIZE, 0, MAKELONG(0, 0));
bsize = SendMessageW(hwnd, TB_GETBUTTONSIZE, 0, 0);
ok(bsize == 0x160018, "Expected 0x160018 got %lx\n", bsize);
SendMessageW(hwnd, TB_SETBUTTONSIZE, 0, 0x10001);
bsize = SendMessageW(hwnd, TB_GETBUTTONSIZE, 0, 0);
ok(bsize == 0x160017, "Expected 0x160017 got %lx\n", bsize);
SendMessageW(hwnd, TB_SETBUTTONSIZE, 0, 0x100001);
bsize = SendMessageW(hwnd, TB_GETBUTTONSIZE, 0, 0);
ok(bsize == 0x160017, "Expected 0x160017 got %lx\n", bsize);
SendMessageW(hwnd, TB_SETBUTTONSIZE, 0, 0x160017);
bsize = SendMessageW(hwnd, TB_GETBUTTONSIZE, 0, 0);
ok(bsize == 0x160017, "Expected 0x160017 got %lx\n", bsize);
SendMessageW(hwnd, TB_SETBUTTONSIZE, 0, 0x170017);
bsize = SendMessageW(hwnd, TB_GETBUTTONSIZE, 0, 0);
ok(bsize == 0x170017, "Expected 0x170017 got %lx\n", bsize);
DestroyWindow(hwnd);
}
void TestPadding()
{
HWND hwnd;
LRESULT bsize;
hwnd = CreateWindowExW(0, TOOLBARCLASSNAMEW, L"Test", 0, 0, 0, 0, 0, 0, 0, 0, NULL);
ok(hwnd != NULL, "CreateWindowEx failed\n");
bsize = SendMessageW(hwnd, TB_GETPADDING, 0, 0);
ok(bsize == 0x60007, "Expected 0x60007 got %lx\n", bsize);
SendMessageW(hwnd, TB_SETPADDING, 0, 0x10001);
SendMessageW(hwnd, TB_SETBITMAPSIZE, 0, 0x10001);
SendMessageW(hwnd, TB_SETBUTTONSIZE, 0, 0x10001);
bsize = SendMessageW(hwnd, TB_GETPADDING, 0, 0);
ok(bsize == 0x10001, "Expected 0x10001 got %lx\n", bsize);
bsize = SendMessageW(hwnd, TB_GETBUTTONSIZE, 0, 0);
ok(bsize == 0x20002, "Expected 0x20002 got %lx\n", bsize);
#if 0 /* Luna specific */
SetWindowTheme(hwnd, L"TaskBand", NULL);
bsize = SendMessageW(hwnd, TB_GETBUTTONSIZE, 0, 0);
ok(bsize == 0x20002, "Expected 0x20002 got %lx\n", bsize);
bsize = SendMessageW(hwnd, TB_GETPADDING, 0, 0);
ok(bsize == 0x10001, "Expected 0x10001 got %lx\n", bsize);
SendMessageW(hwnd, TB_SETBUTTONSIZE, 0, 0x10001);
bsize = SendMessageW(hwnd, TB_GETBUTTONSIZE, 0, 0);
ok(bsize == 0x160006, "Expected 0x160006 got %lx\n", bsize);
bsize = SendMessageW(hwnd, TB_GETPADDING, 0, 0);
ok(bsize == 0x10001, "Expected 0x10001 got %lx\n", bsize);
SendMessageW(hwnd, TB_SETPADDING, 0, 0x10001);
SendMessageW(hwnd, TB_SETBITMAPSIZE, 0, 0x10001);
SendMessageW(hwnd, TB_SETBUTTONSIZE, 0, 0x10001);
bsize = SendMessageW(hwnd, TB_GETPADDING, 0, 0);
ok(bsize == 0x10001, "Expected 0x10001 got %lx\n", bsize);
bsize = SendMessageW(hwnd, TB_GETBUTTONSIZE, 0, 0);
ok(bsize == 0x160006, "Expected 0x160006 got %lx\n", bsize);
SendMessageW(hwnd, TB_SETBITMAPSIZE, 0, 0x10001);
SendMessageW(hwnd, TB_SETPADDING, 0, 0x20002);
SendMessageW(hwnd, TB_SETBUTTONSIZE, 0, 0x10001);
bsize = SendMessageW(hwnd, TB_GETBUTTONSIZE, 0, 0);
ok(bsize == 0x170007, "Expected 0x170007 got %lx\n", bsize);
SendMessageW(hwnd, TB_SETBITMAPSIZE, 0, 0x20002);
SendMessageW(hwnd, TB_SETPADDING, 0, 0x20002);
SendMessageW(hwnd, TB_SETBUTTONSIZE, 0, 0x10001);
bsize = SendMessageW(hwnd, TB_GETBUTTONSIZE, 0, 0);
ok(bsize == 0x170008, "Expected 0x170008 got %lx\n", bsize);
SendMessageW(hwnd, TB_SETBITMAPSIZE, 0, 0x100010);
SendMessageW(hwnd, TB_SETPADDING, 0, 0x20002);
SendMessageW(hwnd, TB_SETBUTTONSIZE, 0, 0x10001);
bsize = SendMessageW(hwnd, TB_GETBUTTONSIZE, 0, 0);
/* With a big enough image size the button size is bitmap size + pading + theme content margins */
ok(bsize == 0x1a0016, "Expected 0x1a0016 got %lx\n", bsize);
#endif
DestroyWindow(hwnd);
}
void TestButtonSpacing()
{
HWND hwnd;
TBMETRICS metrics;
LRESULT lres;
hwnd = CreateWindowExW(0, TOOLBARCLASSNAMEW, L"Test", 0, 0, 0, 0, 0, 0, 0, 0, NULL);
ok(hwnd != NULL, "CreateWindowEx failed\n");
memset(&metrics, 0, sizeof(metrics));
lres = SendMessageW(hwnd, TB_GETMETRICS, 0, (LPARAM)&metrics);
ok (lres == 0, "Got %d result\n", (int)lres);
ok (metrics.dwMask == 0, "Got %lu\n", metrics.dwMask);
ok (metrics.cxPad == 0, "Got %d\n", metrics.cxPad);
metrics.cbSize = sizeof(metrics);
metrics.dwMask = TBMF_PAD|TBMF_BARPAD|TBMF_BUTTONSPACING;
lres = SendMessageW(hwnd, TB_GETMETRICS, 0, (LPARAM)&metrics);
ok (lres == 0, "Got %lu result\n", lres);
ok (metrics.dwMask == (TBMF_PAD|TBMF_BARPAD|TBMF_BUTTONSPACING), "Got %lu\n", metrics.dwMask);
ok (metrics.cxPad == 7, "Got %d\n", metrics.cxPad);
ok (metrics.cyPad == 6, "Got %d\n", metrics.cyPad);
ok (metrics.cxButtonSpacing == 0, "Got %d\n", metrics.cxButtonSpacing);
ok (metrics.cyButtonSpacing == 0, "Got %d\n", metrics.cyButtonSpacing);
}
void TestV5VersionMessage()
{
HWND hwnd;
@@ -107,6 +242,9 @@ START_TEST(toolbar)
LoadLibraryW(L"comctl32.dll");
TestVersionMessage();
TestSetButtonSize();
TestPadding();
TestButtonSpacing();
hV5ActCtx = _CreateV5ActCtx();
ok (hV5ActCtx != INVALID_HANDLE_VALUE, "CreateActCtxW failed\n");