Signed-off-by: Zhao Yi zhaoyi@uniontech.com --- dlls/mscms/tests/profile.c | 118 +++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+)
diff --git a/dlls/mscms/tests/profile.c b/dlls/mscms/tests/profile.c index e0bfbd70e10..77165877275 100644 --- a/dlls/mscms/tests/profile.c +++ b/dlls/mscms/tests/profile.c @@ -62,6 +62,7 @@ static BOOL (WINAPI *pUninstallColorProfileA)(PCSTR,PCSTR,BOOL); static BOOL (WINAPI *pUninstallColorProfileW)(PCWSTR,PCWSTR,BOOL);
static BOOL (WINAPI *pEnumDisplayDevicesA)(LPCSTR,DWORD,PDISPLAY_DEVICEA,DWORD); +static BOOL (WINAPI *pTranslateBitmapBits)(HTRANSFORM,PVOID,BMFORMAT,DWORD,DWORD,DWORD,PVOID,BMFORMAT,DWORD,PBMCALLBACKFN,ULONG);
#define GETFUNCPTR(func) p##func = (void *)GetProcAddress( hmscms, #func ); \ if (!p##func) return FALSE; @@ -97,6 +98,7 @@ static BOOL init_function_ptrs( void ) GETFUNCPTR( UninstallColorProfileW )
pEnumDisplayDevicesA = (void *)GetProcAddress( huser32, "EnumDisplayDevicesA" ); + GETFUNCPTR( TranslateBitmapBits )
return TRUE; } @@ -123,6 +125,16 @@ L"\color\srgb color space profile.icm"; static const WCHAR profile2W[] = L"\spool\drivers\color\srgb color space profile.icm";
+static const char binfile1[] = +"\w32x86\3\SS0IIN03.BIN"; +static const char binfile1_ex[] = +"\spool\drivers\w32x86\3\SS0IIN03.BIN"; + +static const char binfile2[] = +"\w32x86\3\SS0IO15.BIN"; +static const char binfile2_ex[] = +"\spool\drivers\w32x86\3\SS0IO15.BIN"; + static BOOL have_color_profile;
static const unsigned char rgbheader[] = @@ -1359,6 +1371,110 @@ static void test_CreateMultiProfileTransform( char *standardprofile, char *testp } }
+static void test_TranslateBitmapBits(void) +{ + PROFILE profile; + HPROFILE handle[2]; + HTRANSFORM transform; + DWORD intents = INTENT_PERCEPTUAL; + + #define DESTBUFSIZE 4 + HANDLE binfile_handle; + UINT uret; + char binfilefile1[MAX_PATH], binfilefile1_ex[MAX_PATH], binfilefile2[MAX_PATH], binfilefile2_ex[MAX_PATH]; + char *standbinfile1 = NULL; + char *standbinfile2 = NULL; + BYTE srcbits[] = {0,0,0xff}; + BMFORMAT input = BM_BGRTRIPLETS; + DWORD width = 1; + DWORD height = 1; + DWORD inputstride = 3; + PVOID destbits = HeapAlloc( GetProcessHeap(), 0, DESTBUFSIZE); + BMFORMAT output = BM_KYMCQUADS; + DWORD outputstride = 4; + PBMCALLBACKFN callback = NULL; + ULONG data = 0; + BYTE expect_destbits[]={0xff, 0xb6, 0, 0}; + BOOL bret = FALSE; + + uret = GetSystemDirectoryA( binfilefile1, sizeof(binfilefile1) ); + ok( uret > 0, "GetSystemDirectoryA() returns %d, LastError = %lu\n", uret, GetLastError()); + ok(binfilefile1[0] && lstrlenA(binfilefile1) < MAX_PATH, + "Expected length between 0 and MAX_PATH, got %d\n", lstrlenA(binfilefile1)); + lstrcpyA(binfilefile1_ex, binfilefile1); + + uret = GetSystemDirectoryA( binfilefile2, sizeof(binfilefile2) ); + ok( uret > 0, "GetSystemDirectoryA() returns %d, LastError = %lu\n", uret, GetLastError()); + ok(binfilefile2[0] && lstrlenA(binfilefile2) < MAX_PATH, + "Expected length between 0 and MAX_PATH, got %d\n", lstrlenA(binfilefile2)); + lstrcpyA(binfilefile2_ex, binfilefile2); + + lstrcatA( binfilefile1, binfile1 ); + binfile_handle = CreateFileA( binfilefile1, 0 , 0, NULL, OPEN_EXISTING, 0, NULL ); + + if (handle != INVALID_HANDLE_VALUE) + { + standbinfile1 = binfilefile1; + CloseHandle( binfile_handle ); + } + + lstrcatA( binfilefile1_ex, binfile1_ex ); + binfile_handle = CreateFileA( binfilefile1_ex, 0 , 0, NULL, OPEN_EXISTING, 0, NULL ); + + if (handle != INVALID_HANDLE_VALUE) + { + standbinfile1 = binfilefile1_ex; + CloseHandle( binfile_handle ); + } + + lstrcatA( binfilefile2, binfile2 ); + binfile_handle = CreateFileA( binfilefile2, 0 , 0, NULL, OPEN_EXISTING, 0, NULL ); + + if (handle != INVALID_HANDLE_VALUE) + { + standbinfile2 = binfilefile2; + CloseHandle( binfile_handle ); + } + + lstrcatA( binfilefile2_ex, binfile2_ex ); + binfile_handle = CreateFileA( binfilefile2_ex, 0 , 0, NULL, OPEN_EXISTING, 0, NULL ); + + if (handle != INVALID_HANDLE_VALUE) + { + standbinfile2 = binfilefile2_ex; + CloseHandle( binfile_handle ); + } + + if (standbinfile1 && standbinfile2) + { + profile.dwType = PROFILE_FILENAME; + profile.pProfileData = standbinfile1; + profile.cbDataSize = strlen(standbinfile1); + + handle[0] = pOpenColorProfileA( &profile, PROFILE_READ, 1, OPEN_EXISTING ); + ok( handle[0] != NULL, "got %lu\n", GetLastError() ); + + profile.dwType = PROFILE_FILENAME; + profile.pProfileData = standbinfile2; + profile.cbDataSize = strlen(standbinfile2); + + handle[1] = pOpenColorProfileA( &profile, PROFILE_READ, 1, OPEN_EXISTING ); + ok( handle[1] != NULL, "got %lu\n", GetLastError() ); + + transform = pCreateMultiProfileTransform( handle, 2, &intents, 1, 3, 0 ); + ok( transform != NULL, "got %lu\n", GetLastError() ); + + ZeroMemory(destbits,DESTBUFSIZE); + bret = pTranslateBitmapBits(transform,srcbits,input,width,height,inputstride,destbits,output,outputstride,callback,data); + ok(bret && memcmp(expect_destbits, destbits, sizeof(expect_destbits)) == 0, "get err destbits data\n"); + HeapFree( GetProcessHeap(), 0, destbits ); + + pDeleteColorTransform( transform ); + pCloseColorProfile( handle[0] ); + pCloseColorProfile( handle[1] ); + } +} + START_TEST(profile) { UINT len; @@ -1470,6 +1586,8 @@ START_TEST(profile) test_AssociateColorProfileWithDeviceA( testprofile ); test_CreateMultiProfileTransform( standardprofile, testprofile );
+ test_TranslateBitmapBits( ); + if (testprofile) DeleteFileA( testprofile ); FreeLibrary( huser32 ); FreeLibrary( hmscms );
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=115635
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/mscms/tests/profile.c:62 Task: Patch failed to apply
=== debian11 (build log) ===
error: patch failed: dlls/mscms/tests/profile.c:62 Task: Patch failed to apply
=== debian11 (build log) ===
error: patch failed: dlls/mscms/tests/profile.c:62 Task: Patch failed to apply
On Fri, 2022-05-27 at 15:27 +0800, Zhao Yi wrote:
+static const char binfile1[] = +"\w32x86\3\SS0IIN03.BIN"; +static const char binfile1_ex[] = +"\spool\drivers\w32x86\3\SS0IIN03.BIN";
+static const char binfile2[] = +"\w32x86\3\SS0IO15.BIN"; +static const char binfile2_ex[] = +"\spool\drivers\w32x86\3\SS0IO15.BIN";
These profiles don't exist in a default Wine prefix and may not exist on Windows either. Could you achieve the same thing with the standard sRGB color profile?