From: Vijay Kiran Kamuju Subject: [PATCH 3/4] setupapi/tests: Add tests for cabinet name passed to SPFILENOTIFY_FILEEXTRACTED. Message-Id: Date: Thu, 2 Jul 2020 17:40:34 +0200 Signed-off-by: Vijay Kiran Kamuju From 7ac2bff704866fe5ec5bcef6a42edf5b89905568 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Tue, 2 May 2017 01:15:03 +0200 Subject: [PATCH 3/4] setupapi/tests: Add tests for cabinet name passed to SPFILENOTIFY_FILEEXTRACTED. Signed-off-by: Vijay Kiran Kamuju --- dlls/setupapi/tests/setupcab.c | 56 +++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/dlls/setupapi/tests/setupcab.c b/dlls/setupapi/tests/setupcab.c index 384e04c467..de9aab83b7 100644 --- a/dlls/setupapi/tests/setupcab.c +++ b/dlls/setupapi/tests/setupcab.c @@ -303,6 +303,7 @@ struct contextA { int count; const char *cabinet; + const char *target; }; static UINT CALLBACK simple_callbackA(PVOID Context, UINT Notification, @@ -339,8 +340,9 @@ todo_wine ok(!strcmp(ctx->cabinet, cabinet_file), "[%d] Expected cabinet \"%s\", got \"%s\"\n", index, ctx->cabinet, cabinet_file); - index++; - return FILEOP_SKIP; + + strcpy(info->FullTargetName, ctx->target); + return FILEOP_DOIT; } else { @@ -348,6 +350,24 @@ todo_wine return FILEOP_ABORT; } } + case SPFILENOTIFY_FILEEXTRACTED: + { + FILEPATHS_A *info = (FILEPATHS_A *)Param1; + +todo_wine + ok(!strcmp(ctx->cabinet, info->Source), + "[%d] Expected cabinet \"%s\", got \"%s\"\n", + index, ctx->cabinet, info->Source); + ok(!strcmp(ctx->target, info->Target), + "[%d] Expected target \"%s\", got \"%s\"\n", + index, ctx->target, info->Target); + ok(info->Win32Error == 0, + "[%d] Expected Win32Error 0, got %u\n", + index, info->Win32Error); + + index++; + return NO_ERROR; + } default: return NO_ERROR; } @@ -357,20 +377,24 @@ static void test_simple_enumerationA(void) { BOOL ret; char source[MAX_PATH], temp[MAX_PATH]; + char target[MAX_PATH]; struct contextA ctx; GetTempPathA(sizeof(temp), temp); GetTempFileNameA(temp, "doc", 0, source); + GetTempFileNameA(temp, "doc", 0, target); create_source_fileA(source, comp_cab_zip_multi, sizeof(comp_cab_zip_multi)); ctx.count = 0; ctx.cabinet = source; + ctx.target = target; ret = SetupIterateCabinetA(source, 0, simple_callbackA, &ctx); ok(ret == 1, "Expected SetupIterateCabinetA to return 1, got %d\n", ret); ok(ctx.count == ARRAY_SIZE(expected_files), "Unexpectedly enumerated %d files\n", ctx.count); DeleteFileA(source); + DeleteFileA(target); } static const WCHAR tristramW[] = {'t','r','i','s','t','r','a','m',0}; @@ -382,6 +406,7 @@ struct contextW { int count; const WCHAR *cabinet; + const WCHAR *target; }; static UINT CALLBACK simple_callbackW(PVOID Context, UINT Notification, @@ -418,8 +443,9 @@ todo_wine ok(!lstrcmpW(ctx->cabinet, cabinet_file), "[%d] Expected cabinet %s, got %s\n", index, wine_dbgstr_w(ctx->cabinet), wine_dbgstr_w(cabinet_file)); - index++; - return FILEOP_SKIP; + + lstrcpyW(info->FullTargetName, ctx->target); + return FILEOP_DOIT; } else { @@ -427,6 +453,24 @@ todo_wine return FILEOP_ABORT; } } + case SPFILENOTIFY_FILEEXTRACTED: + { + FILEPATHS_W *info = (FILEPATHS_W *)Param1; + +todo_wine + ok(!lstrcmpW(ctx->cabinet, info->Source), + "[%d] Expected cabinet %s, got %s\n", + index, wine_dbgstr_w(ctx->cabinet), wine_dbgstr_w(info->Source)); + ok(!lstrcmpW(ctx->target, info->Target), + "[%d] Expected target %s, got %s\n", + index, wine_dbgstr_w(ctx->target), wine_dbgstr_w(info->Target)); + ok(info->Win32Error == 0, + "[%d] Expected Win32Error 0, got %u\n", + index, info->Win32Error); + + index++; + return NO_ERROR; + } default: return NO_ERROR; } @@ -436,6 +480,7 @@ static void test_simple_enumerationW(void) { BOOL ret; WCHAR source[MAX_PATH], temp[MAX_PATH]; + WCHAR target[MAX_PATH]; struct contextW ctx; ret = SetupIterateCabinetW(NULL, 0, NULL, NULL); @@ -447,16 +492,19 @@ static void test_simple_enumerationW(void) GetTempPathW(ARRAY_SIZE(temp), temp); GetTempFileNameW(temp, docW, 0, source); + GetTempFileNameW(temp, docW, 0, target); create_source_fileW(source, comp_cab_zip_multi, sizeof(comp_cab_zip_multi)); ctx.count = 0; ctx.cabinet = source; + ctx.target = target; ret = SetupIterateCabinetW(source, 0, simple_callbackW, &ctx); ok(ret == 1, "Expected SetupIterateCabinetW to return 1, got %d\n", ret); ok(ctx.count == ARRAY_SIZE(expected_files), "Unexpectedly enumerated %d files\n", ctx.count); DeleteFileW(source); + DeleteFileW(target); } START_TEST(setupcab) -- 2.27.0