How do I actually write a testcase for a 16-bit API ?

Alex Villací­s Lasso a_villacis at palosanto.com
Tue Jun 9 12:34:14 CDT 2009


Dmitry Timoshkov escribió:
> "Alex Villací­s Lasso" <a_villacis at palosanto.com> wrote:
>
>> I recently filed http://bugs.winehq.org/show_bug.cgi?id=18734 in 
>> which I showed that DlgDirList is behaving incorrectly for 16-bit 
>> apps. I also included a test program compiled with the Watcom C 
>> compiler, as well as a patch. Then a comment appeared saying that it 
>> should be possible to create a testcase for this API.
>
> By creating a test I meant to have a test for 32-bit behaviour first,
> then compare it with 16-bit one.
>
The 32-bit test is already in place in current git, and shows that the 
behavior is compliant for 32-bit apps. It is at 
dlls/user32/tests/listbox.c. Lines 1189 through 1219 show that 
DDL_DRIVES alone implies DDL_EXCLUSIVE. Lines 1231 through 1263 show 
that DDL_DRIVES|DDL_DIRECTORY does *not* imply DDL_EXCLUSIVE.

I am taking issue with lines 617 through 619 of dlls/user32/dialog16.c:
----------------
/**************************************************************************
 *              DlgDirList   (USER.100)
 */
INT16 WINAPI DlgDirList16( HWND16 hDlg, LPSTR spec, INT16 idLBox,
                           INT16 idStatic, UINT16 attrib )
{
    /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE
     * be set automatically (this is different in Win32, and
     * DIALOG_DlgDirList sends Win32 messages to the control,
     * so do it here) */
    if (attrib & DDL_DRIVES) attrib |= DDL_EXCLUSIVE;
    return DlgDirListA( WIN_Handle32(hDlg), spec, idLBox, idStatic, 
attrib );
}
----------------

If a 16-bit test were placed in the testsuite, it would show that the 
current implementation (attrib & DDL_DRIVES) is incorrect, as 
demonstrated by my test program. It should be attrib == DDL_DRIVES 
instead. The program so far shows that the flag behavior is identical 
for 16-bit and 32-bit calls.

-- 
perl -e '$x=2.3;printf("%.0f + %.0f = %.0f\n",$x,$x,$x+$x);'




More information about the wine-devel mailing list