Author: gadamopoulos Date: Wed May 10 10:06:02 2017 New Revision: 74517
URL: http://svn.reactos.org/svn/reactos?rev=74517&view=rev Log: [SHELL32_APITEST] -Add tests for Control_RunDLLW.
Added: trunk/rostests/apitests/shell32/Control_RunDLLW.cpp (with props) trunk/rostests/apitests/shell32/shell32_apitest.spec (with props) Modified: trunk/rostests/apitests/shell32/CMakeLists.txt trunk/rostests/apitests/shell32/testlist.c
Modified: trunk/rostests/apitests/shell32/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shell32/CMakeList... ============================================================================== --- trunk/rostests/apitests/shell32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/shell32/CMakeLists.txt [iso-8859-1] Wed May 10 10:06:02 2017 @@ -1,3 +1,5 @@ + +spec2def(shell32_apitest.exe shell32_apitest.spec)
set_cpp(WITH_RUNTIME)
@@ -5,6 +7,7 @@
add_executable(shell32_apitest AddCommas.c + Control_RunDLLW.cpp CFSFolder.cpp CMyComputer.cpp CShellDesktop.cpp @@ -13,7 +16,8 @@ ShellExecuteEx.cpp shelltest.cpp SHParseDisplayName.cpp - testlist.c) + testlist.c + ${CMAKE_CURRENT_BINARY_DIR}/shell32_apitest.def) target_link_libraries(shell32_apitest wine uuid ${PSEH_LIB}) set_module_type(shell32_apitest win32cui) add_importlibs(shell32_apitest user32 gdi32 shell32 ole32 oleaut32 advapi32 shlwapi msvcrt kernel32 ntdll)
Added: trunk/rostests/apitests/shell32/Control_RunDLLW.cpp URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shell32/Control_R... ============================================================================== --- trunk/rostests/apitests/shell32/Control_RunDLLW.cpp (added) +++ trunk/rostests/apitests/shell32/Control_RunDLLW.cpp [iso-8859-1] Wed May 10 10:06:02 2017 @@ -0,0 +1,160 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory + * PURPOSE: Test for Control_RunDLLW + * PROGRAMMER: Giannis Adamopoulos + */ + +#include "shelltest.h" +#include <cpl.h> +#define NDEBUG +#include <debug.h> + +extern "C" +void WINAPI Control_RunDLLW(HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdShow); + +int g_iParams; +int g_iClk; +WCHAR g_wstrParams[MAX_PATH]; + +extern "C" +LONG CALLBACK +CPlApplet(HWND hwndCPl, + UINT uMsg, + LPARAM lParam1, + LPARAM lParam2) +{ + INT i = (INT)lParam1; + + switch (uMsg) + { + case CPL_INIT: + return TRUE; + + case CPL_GETCOUNT: + return 2; + + case CPL_INQUIRE: + { + CPLINFO *CPlInfo = (CPLINFO*)lParam2; + CPlInfo->lData = 0; + CPlInfo->idIcon = CPL_DYNAMIC_RES ; + CPlInfo->idName = CPL_DYNAMIC_RES ; + CPlInfo->idInfo = CPL_DYNAMIC_RES ; + } + break; + case CPL_NEWINQUIRE: + { + LPNEWCPLINFOW pinfo = (LPNEWCPLINFOW)lParam2; + + memset(pinfo, 0, sizeof(NEWCPLINFOW)); + pinfo->dwSize = sizeof(NEWCPLINFOW); + pinfo->hIcon = LoadIcon(NULL, IDI_APPLICATION); + if (i == 0) + { + wcscpy(pinfo->szName, L"name0"); + wcscpy(pinfo->szInfo, L"info0"); + wcscpy(pinfo->szHelpFile, L"help0"); + } + else + { + wcscpy(pinfo->szName, L"name1"); + wcscpy(pinfo->szInfo, L"info1"); + wcscpy(pinfo->szHelpFile, L"help1"); + } + break; + } + case CPL_DBLCLK: + g_iClk = i; + break; + case CPL_STARTWPARMSW: + g_iParams = i; + ok(lParam2 != NULL, "Got NULL lParam2!\n"); + if (lParam2) + wcscpy(g_wstrParams, (LPCWSTR)lParam2); + break; + } + + return FALSE; +} + + +#define MSG_NOT_CALLED -1 + +struct param_test +{ + int srcLine; + LPCWSTR cmd; + INT iStartParams; /* MSG_NOT_CALLED when CPL_STARTWPARMS is not sent */ + LPCWSTR params; /* second param of CPL_STARTWPARMS */ + INT iClick; /* MSG_NOT_CALLED when CPL_DBLCLK is not sent */ +}; + +struct param_test tests[] = +{ + {__LINE__, L"", MSG_NOT_CALLED, L"", 0}, + {__LINE__, L",name0", MSG_NOT_CALLED, L"", 0}, + {__LINE__, L",name1", MSG_NOT_CALLED, L"", 1}, + {__LINE__, L",@0", MSG_NOT_CALLED, L"", 0}, + {__LINE__, L",@1", MSG_NOT_CALLED, L"", 1}, + {__LINE__, L",0", MSG_NOT_CALLED, L"", MSG_NOT_CALLED}, + {__LINE__, L",1", MSG_NOT_CALLED, L"", MSG_NOT_CALLED}, + {__LINE__, L",@name0", MSG_NOT_CALLED, L"", 0}, + {__LINE__, L",@name1", MSG_NOT_CALLED, L"", 0}, + {__LINE__, L" name0", MSG_NOT_CALLED, L"", 0}, + {__LINE__, L" name1", MSG_NOT_CALLED, L"", 1}, + {__LINE__, L" @0", MSG_NOT_CALLED, L"", 0}, + {__LINE__, L" @1", MSG_NOT_CALLED, L"", 1}, + {__LINE__, L" 0", MSG_NOT_CALLED, L"", MSG_NOT_CALLED}, + {__LINE__, L" 1", MSG_NOT_CALLED, L"", MSG_NOT_CALLED}, + {__LINE__, L" @name0", MSG_NOT_CALLED, L"", 0}, + {__LINE__, L" @name1", MSG_NOT_CALLED, L"", 0}, + {__LINE__, L""name0"", MSG_NOT_CALLED, L"", MSG_NOT_CALLED}, + {__LINE__, L""name1"", MSG_NOT_CALLED, L"", MSG_NOT_CALLED}, + {__LINE__, L","name0"", MSG_NOT_CALLED, L"", 0}, + {__LINE__, L","name1"", MSG_NOT_CALLED, L"", 1}, + {__LINE__, L"",name0"", MSG_NOT_CALLED, L"", MSG_NOT_CALLED}, + {__LINE__, L"",name1"", MSG_NOT_CALLED, L"", MSG_NOT_CALLED}, + {__LINE__, L",name0,@1", 0, L"@1", 0}, + {__LINE__, L",name1,@0", 1, L"@0", 1}, + {__LINE__, L",name0, ", 0, L" ", 0}, + {__LINE__, L",name1, ", 1, L" ", 1}, + {__LINE__, L",@0,@1", 0, L"@1", 0}, + {__LINE__, L",@1,@0", 1, L"@0", 1}, + {__LINE__, L","@0",@1", 0, L"@1", 0}, + {__LINE__, L","@1",@0", 1, L"@0", 1}, + {__LINE__, L","@0","@1"", 0, L""@1"", 0}, + {__LINE__, L","@1","@0"", 1, L""@0"", 1}, + {__LINE__, L","@0",@1,2,3,4,5", 0, L"@1,2,3,4,5", 0}, + {__LINE__, L","@1",@0,2,3,4,5", 1, L"@0,2,3,4,5", 1}, + {__LINE__, L","@0",@1,2,"3",4,5", 0, L"@1,2,"3",4,5", 0}, + {__LINE__, L","@1",@0,2,"3",4,5", 1, L"@0,2,"3",4,5", 1}, + {__LINE__, L","@0", @1 , 2 , 3 , 4 , 5", 0, L" @1 , 2 , 3 , 4 , 5", 0}, + {__LINE__, L","@1", @0 , 2 , 3 , 4 , 5", 1, L" @0 , 2 , 3 , 4 , 5", 1}, + {__LINE__, L","@0", @1 , 2 , /3 , 4 , 5", 0, L" @1 , 2 , /3 , 4 , 5", 0}, + {__LINE__, L","@1", @0 , 2 , /3 , 4 , 5", 1, L" @0 , 2 , /3 , 4 , 5", 1}, + {__LINE__, L","@0", @1 , 2 , /3 , 4 , 5", 0, L" @1 , 2 , /3 , 4 , 5", 0}, + {__LINE__, L","@1", @0 , 2 , /3 , 4 , 5", 1, L" @0 , 2 , /3 , 4 , 5", 1}, + +}; + +START_TEST(Control_RunDLLW) +{ + WCHAR finename[MAX_PATH]; + WCHAR buffer[MAX_PATH]; + + GetModuleFileNameW(NULL, finename, MAX_PATH); + + for (UINT i = 0; i < _countof(tests); i++) + { + swprintf(buffer, L"%s%s", finename, tests[i].cmd); + + g_iClk = MSG_NOT_CALLED; + g_iParams = MSG_NOT_CALLED; + g_wstrParams[0] = 0; + Control_RunDLLW( GetDesktopWindow (), 0, buffer, 0); + ok (tests[i].iClick == g_iClk, "%d, CPL_DBLCLK: expected %d got %d\n", tests[i].srcLine, tests[i].iClick, g_iClk); + ok (tests[i].iStartParams == g_iParams, "%d, CPL_STARTWPARMSW: expected %d got %d\n", tests[i].srcLine, tests[i].iStartParams, g_iParams); + ok (wcscmp(tests[i].params, g_wstrParams) == 0, "%d, CPL_STARTWPARMSW: expected %S got %S\n", tests[i].srcLine, tests[i].params, g_wstrParams); + } +}
Propchange: trunk/rostests/apitests/shell32/Control_RunDLLW.cpp ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/rostests/apitests/shell32/shell32_apitest.spec URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shell32/shell32_a... ============================================================================== --- trunk/rostests/apitests/shell32/shell32_apitest.spec (added) +++ trunk/rostests/apitests/shell32/shell32_apitest.spec [iso-8859-1] Wed May 10 10:06:02 2017 @@ -0,0 +1 @@ +@ stdcall CPlApplet(ptr long ptr ptr)
Propchange: trunk/rostests/apitests/shell32/shell32_apitest.spec ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/rostests/apitests/shell32/testlist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shell32/testlist.... ============================================================================== --- trunk/rostests/apitests/shell32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/shell32/testlist.c [iso-8859-1] Wed May 10 10:06:02 2017 @@ -4,6 +4,7 @@ #include <wine/test.h>
extern void func_AddCommas(void); +extern void func_Control_RunDLLW(void); extern void func_CFSFolder(void); extern void func_CMyComputer(void); extern void func_CShellDesktop(void); @@ -15,6 +16,7 @@ const struct test winetest_testlist[] = { { "AddCommas", func_AddCommas }, + { "Control_RunDLLW", func_Control_RunDLLW }, { "CFSFolder", func_CFSFolder }, { "CMyComputer", func_CMyComputer }, { "CShellDesktop", func_CShellDesktop },