Module: wine Branch: master Commit: 814ab9ee4635c73e88e27960d30ad023a4d9121c URL: http://source.winehq.org/git/wine.git/?a=commit;h=814ab9ee4635c73e88e27960d3...
Author: Piotr Caban piotr@codeweavers.com Date: Fri Jan 30 17:03:25 2015 +0100
shell32: Create trash test file in temp directory.
---
dlls/shell32/tests/recyclebin.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/dlls/shell32/tests/recyclebin.c b/dlls/shell32/tests/recyclebin.c index d449b7e..c798492 100644 --- a/dlls/shell32/tests/recyclebin.c +++ b/dlls/shell32/tests/recyclebin.c @@ -55,8 +55,7 @@ static void test_query_recyclebin(void) HRESULT hr; HANDLE file; SHFILEOPSTRUCTA shfo; - const CHAR name[] = "test.txt"; - CHAR buf[MAX_PATH + sizeof(name) + 1]; + CHAR temp_path[MAX_PATH-14], buf[MAX_PATH+1]; if(!pSHQueryRecycleBinA) { skip("SHQueryRecycleBinA does not exist\n"); @@ -67,18 +66,17 @@ static void test_query_recyclebin(void) skip("SHFileOperationA does not exist\n"); return; } - GetCurrentDirectoryA(MAX_PATH, buf); - strcat(buf,"\"); - strcat(buf,name); + ok(GetTempPathA(sizeof(temp_path), temp_path), "GetTempPath failed\n"); + ok(GetTempFileNameA(temp_path, "trash", 0, buf), "GetTempFileName failed\n"); buf[strlen(buf) + 1] = '\0'; hr = pSHQueryRecycleBinA(buf,&info1); ok(hr == S_OK, "SHQueryRecycleBinA failed with error 0x%x\n", hr); ok(info1.i64Size!=0xdeadbeef,"i64Size not set\n"); ok(info1.i64NumItems!=0xdeadbeef,"i64NumItems not set\n"); /*create and send a file to the recycle bin*/ - file = CreateFileA(name,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL); - ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n",name); - WriteFile(file,name,strlen(name),&written,NULL); + file = CreateFileA(buf,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL); + ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n",buf); + WriteFile(file,buf,strlen(buf),&written,NULL); CloseHandle(file); shfo.hwnd = NULL; shfo.wFunc = FO_DELETE;