[PATCH resend] tapi/tests: add initial tests for lineInitialize

Nikolay Sivov nsivov at codeweavers.com
Sat Nov 16 11:58:44 CST 2019


On 11/16/19 2:56 PM, Vijay Kiran Kamuju wrote:
> On Sat, Nov 16, 2019 at 9:07 AM Nikolay Sivov <nsivov at codeweavers.com> wrote:
>> On 11/15/19 6:35 PM, Vijay Kiran Kamuju wrote:
>>> diff --git a/dlls/tapi32/tests/Makefile.in b/dlls/tapi32/tests/Makefile.in
>>> new file mode 100644
>>> index 0000000000..4193f0808e
>>> --- /dev/null
>>> +++ b/dlls/tapi32/tests/Makefile.in
>>> @@ -0,0 +1,5 @@
>>> +TESTDLL = tapi32.dll
>>> +IMPORTS = tapi32
>>> +
>>> +C_SRCS = \
>>> +     line.c
>>> diff --git a/dlls/tapi32/tests/line.c b/dlls/tapi32/tests/line.c
>> I wouldn't expect that much activity that we need to split tests in
>> several files. I think it's better to have one single
>> /tapi32/tests/tapi32.c.

>>> new file mode 100644
>>> index 0000000000..e94b68ba30
>>> --- /dev/null
>>> +++ b/dlls/tapi32/tests/line.c
>>> @@ -0,0 +1,63 @@
>>> +/*
>>> + * TAPI32 API tests
>>> + *
>>> + * Copyright 2019 Vijay Kiran Kamuju
>>> + *
>>> + * 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 <stdarg.h>
>>> +
>>> +#include "tapi.h"
>>> +
>>> +#include "wine/test.h"
>>> +
>>> +static void CALLBACK line_callback(DWORD hDev, DWORD dwMsg, DWORD_PTR dwInst, DWORD_PTR param1, DWORD_PTR param2, DWORD_PTR param3)
>>> +{
>>> +   ok(1, "Received notification (%d, %d, %ld, %ld, %ld %ld)\n", hDev, dwMsg, dwInst, param1, param2, param3);
>>> +}
>> This one does not test anything. If you expect certain arguments you can
>> test that, or use CHECK_EXPECT() approach we have in some tests.
>>
>>> +
>>> +static void test_lineInitialize(void)
>>> +{
>>> +    ULONG ret;
>>> +    DWORD dev;
>>> +    HLINEAPP lnApp;
>>> +
>>> +    ret = lineInitialize(NULL, NULL, NULL, NULL, NULL);
>>> +    todo_wine ok(ret == LINEERR_INVALPOINTER, "Expected return value LINEERR_INVALPOINTER, got %x.\n", ret);
>>> +
>>> +    ret = lineInitialize(&lnApp, NULL, NULL, NULL, NULL);
>>> +    todo_wine ok(ret == LINEERR_INVALPOINTER, "Expected return value LINEERR_INVALPOINTER, got %x.\n", ret);
>>> +
>>> +    ret = lineInitialize(&lnApp, GetModuleHandleA(NULL), NULL, NULL, NULL);
>>> +    todo_wine ok(ret == LINEERR_INVALPOINTER, "Expected return value LINEERR_INVALPOINTER, got %x.\n", ret);
>>> +
>>> +    ret = lineInitialize(&lnApp, GetModuleHandleA(NULL), (LINECALLBACK) line_callback, NULL, NULL);
>>> +    todo_wine ok(ret == LINEERR_INVALPOINTER, "Expected return value LINEERR_INVALPOINTER, got %x.\n", ret);
>>> +
>>> +    ret = lineInitialize(&lnApp, GetModuleHandleA(NULL), (LINECALLBACK) line_callback, NULL, &dev);
>>> +    ok(!ret, "unexpected return valuei, got %u.\n", ret);
>> You need to fix LINECALLBACK definition too, so you can get rid of casts.
> I am not sure how to do this, but I am sending this without the casts.
> As I checked other tests, which are without casts
> Eg: ws2_32/tests/sock.c

I'm talking about definition in public header.

>
>>> +
>>> +    ret = lineShutdown(NULL);
>>> +    todo_wine ok(ret == LINEERR_INVALAPPHANDLE, "Expected return value LINEERR_INVALAPPHANDLE, got %x.\n", ret);
>>> +
>>> +    ret = lineShutdown(lnApp);
>>> +    ok(!ret, "unexpected return valuei, got %u.\n", ret);
>>> +}
>>> +
>>> +START_TEST(line)
>>> +{
>>> +   test_lineInitialize();
>>> +}
>> Somehow this is mixing 3 vs 4 spaces for indentation.
> All other changes are done.




More information about the wine-devel mailing list