Need help writing test

Mikołaj Zalewski mikolaj at zalewski.pl
Sat Apr 25 05:47:54 CDT 2009


Igor Tarasov wrote:

>Hi!
>
>I've found few visual glitches in comctl32/toolbar, and now try to
>write this all down as conformance tests, but I have some problems. I
>see that there is bug, when I test it with control spy. But when I
>repeat it in testcase, it won't work. Here is how you can reproduce
>it:
>
>TB_SETBITMAPSIZE 20,20
>TB_SETBUTTONSIZE 30,30
>TB_SETBITMAPSIZE 10,10
>
>Now, if you do TB_SETBUTTONSIZE, you'll see the difference. builtin
>comctl will return 17,16. Native - 30,16. But when I write something
>like this:
>
>    rebuild_toolbar_with_buttons(&hToolbar);
>    himl = ImageList_LoadImage(GetModuleHandle(NULL),
>MAKEINTRESOURCE(IDB_BITMAP_80x15), 20, 2, CLR_NONE, IMAGE_BITMAP,
>LR_DEFAULTCOLOR);
>    ok(SendMessageA(hToolbar, TB_SETIMAGELIST, 0, (LRESULT)himl) == 0,
>"TB_SETIMAGELIST failed\n");
>    SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(20, 20));
>    SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELONG(30, 30));
>    ok(SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0) == MAKELONG(30,
>30), "Unexpected button size\n");
>    SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(10, 10));
>    compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0),
>MAKELONG(30, 16), "%x");
>
>This test fails, when I test it with native comctl32 (the size is
>17,16). Why could this happen or what am I doing wrong?
>  
>
  TB_SETBITMAPSIZE does some work in WM_PAINT. You could try add some 
UpdateWindow(hToolbar) calls after TB_SETBITMAPSIZE or TB_SETIMAGELIST - 
maybe this will change something? (of course, another possibility is 
that this behaviour is a side-effect of some other messages or some 
parameters. On Wine, you can use WINEDEBUG=+message to get the tree of 
messages that have been sent).

Mikołaj



More information about the wine-devel mailing list