<div><div>Signed-off-by: Zhao Yi <zhaoyi@uniontech.com></div><div>---</div><div> dlls/mscms/tests/profile.c | 118 +++++++++++++++++++++++++++++++++++++</div><div> 1 file changed, 118 insertions(+)</div><div><br></div><div>diff --git a/dlls/mscms/tests/profile.c b/dlls/mscms/tests/profile.c</div><div>index e0bfbd70e10..3d24f5aa62a 100644</div><div>--- a/dlls/mscms/tests/profile.c</div><div>+++ b/dlls/mscms/tests/profile.c</div><div>@@ -62,6 +62,7 @@ static BOOL     (WINAPI *pUninstallColorProfileA)(PCSTR,PCSTR,BOOL);</div><div> static BOOL     (WINAPI *pUninstallColorProfileW)(PCWSTR,PCWSTR,BOOL);</div><div> </div><div> static BOOL     (WINAPI *pEnumDisplayDevicesA)(LPCSTR,DWORD,PDISPLAY_DEVICEA,DWORD);</div><div>+static BOOL     (WINAPI *pTranslateBitmapBits)(HTRANSFORM,PVOID,BMFORMAT,DWORD,DWORD,DWORD,PVOID,BMFORMAT,DWORD,PBMCALLBACKFN,ULONG);</div><div> </div><div> #define GETFUNCPTR(func) p##func = (void *)GetProcAddress( hmscms, #func ); \</div><div>     if (!p##func) return FALSE;</div><div>@@ -95,6 +96,7 @@ static BOOL init_function_ptrs( void )</div><div>     GETFUNCPTR( SetStandardColorSpaceProfileW )</div><div>     GETFUNCPTR( UninstallColorProfileA )</div><div>     GETFUNCPTR( UninstallColorProfileW )</div><div>+    GETFUNCPTR( TranslateBitmapBits )</div><div> </div><div>     pEnumDisplayDevicesA = (void *)GetProcAddress( huser32, "EnumDisplayDevicesA" );</div><div> </div><div>@@ -123,6 +125,16 @@ L"\\color\\srgb color space profile.icm";</div><div> static const WCHAR profile2W[] =</div><div> L"\\spool\\drivers\\color\\srgb color space profile.icm";</div><div> </div><div>+static const char binfile1[] =</div><div>+"\\w32x86\\3\\SS0IIN03.BIN";</div><div>+static const char binfile1_ex[] =</div><div>+"\\spool\\drivers\\w32x86\\3\\SS0IIN03.BIN";</div><div>+</div><div>+static const char binfile2[] =</div><div>+"\\w32x86\\3\\SS0IO15.BIN";</div><div>+static const char binfile2_ex[] =</div><div>+"\\spool\\drivers\\w32x86\\3\\SS0IO15.BIN";</div><div>+</div><div> static BOOL have_color_profile;</div><div> </div><div> static const unsigned char rgbheader[] =</div><div>@@ -1359,6 +1371,111 @@ static void test_CreateMultiProfileTransform( char *standardprofile, char *testp</div><div>     }</div><div> }</div><div> </div><div>+static void test_TranslateBitmapBits()</div><div>+{</div><div>+    PROFILE profile;</div><div>+    HPROFILE handle[2];</div><div>+    HTRANSFORM transform;</div><div>+    DWORD intents = INTENT_PERCEPTUAL;</div><div>+</div><div>+    #define DESTBUFSIZE 4</div><div>+    HANDLE binfile_handle;</div><div>+    UINT uret;</div><div>+    char binfilefile1[MAX_PATH], binfilefile1_ex[MAX_PATH], binfilefile2[MAX_PATH], binfilefile2_ex[MAX_PATH];</div><div>+    WCHAR binfilefile1W[MAX_PATH];</div><div>+    char *standbinfile1 = NULL;</div><div>+    char *standbinfile2 = NULL;</div><div>+    BYTE srcbits[] = {0,0,0xff};</div><div>+    BMFORMAT input = BM_BGRTRIPLETS;</div><div>+    DWORD width = 1;</div><div>+    DWORD height = 1;</div><div>+    DWORD inputstride = 3;</div><div>+    PVOID destbits = HeapAlloc( GetProcessHeap(), 0, DESTBUFSIZE);</div><div>+    BMFORMAT output = BM_KYMCQUADS;</div><div>+    DWORD outputstride = 4;</div><div>+    PBMCALLBACKFN callback = NULL;</div><div>+    ULONG data = 0;</div><div>+    BYTE expect_destbits[]={0xff, 0xb6, 0, 0};</div><div>+    BOOL bret = FALSE;</div><div>+</div><div>+    uret = GetSystemDirectoryA( binfilefile1, sizeof(binfilefile1) );</div><div>+    ok( uret > 0, "GetSystemDirectoryA() returns %d, LastError = %lu\n", uret, GetLastError());</div><div>+    ok(binfilefile1[0] && lstrlenA(binfilefile1) < MAX_PATH,</div><div>+        "Expected length between 0 and MAX_PATH, got %d\n", lstrlenA(binfilefile1));</div><div>+    lstrcpyA(binfilefile1_ex, binfilefile1);</div><div>+</div><div>+    uret = GetSystemDirectoryA( binfilefile2, sizeof(binfilefile2) );</div><div>+    ok( uret > 0, "GetSystemDirectoryA() returns %d, LastError = %lu\n", uret, GetLastError());</div><div>+    ok(binfilefile2[0] && lstrlenA(binfilefile2) < MAX_PATH,</div><div>+        "Expected length between 0 and MAX_PATH, got %d\n", lstrlenA(binfilefile2));</div><div>+    lstrcpyA(binfilefile2_ex, binfilefile2);</div><div>+</div><div>+    lstrcatA( binfilefile1, binfile1 );</div><div>+    binfile_handle = CreateFileA( binfilefile1, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );</div><div>+</div><div>+    if (handle != INVALID_HANDLE_VALUE)</div><div>+    {</div><div>+        standbinfile1 = binfilefile1;</div><div>+        CloseHandle( binfile_handle );</div><div>+    }</div><div>+</div><div>+    lstrcatA( binfilefile1_ex, binfile1_ex );</div><div>+    binfile_handle = CreateFileA( binfilefile1_ex, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );</div><div>+</div><div>+    if (handle != INVALID_HANDLE_VALUE)</div><div>+    {</div><div>+        standbinfile1 = binfilefile1_ex;</div><div>+        CloseHandle( binfile_handle );</div><div>+    }</div><div>+</div><div>+    lstrcatA( binfilefile2, binfile2 );</div><div>+    binfile_handle = CreateFileA( binfilefile2, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );</div><div>+</div><div>+    if (handle != INVALID_HANDLE_VALUE)</div><div>+    {</div><div>+        standbinfile2 = binfilefile2;</div><div>+        CloseHandle( binfile_handle );</div><div>+    }</div><div>+</div><div>+    lstrcatA( binfilefile2_ex, binfile2_ex );</div><div>+    binfile_handle = CreateFileA( binfilefile2_ex, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );</div><div>+</div><div>+    if (handle != INVALID_HANDLE_VALUE)</div><div>+    {</div><div>+        standbinfile2 = binfilefile2_ex;</div><div>+        CloseHandle( binfile_handle );</div><div>+    }</div><div>+    </div><div>+    if (standbinfile1 && standbinfile2)</div><div>+    {</div><div>+        profile.dwType       = PROFILE_FILENAME;</div><div>+        profile.pProfileData = standbinfile1;</div><div>+        profile.cbDataSize   = strlen(standbinfile1);</div><div>+</div><div>+        handle[0] = pOpenColorProfileA( &profile, PROFILE_READ, 1, OPEN_EXISTING );</div><div>+        ok( handle[0] != NULL, "got %lu\n", GetLastError() );</div><div>+</div><div>+        profile.dwType       = PROFILE_FILENAME;</div><div>+        profile.pProfileData = standbinfile2;</div><div>+        profile.cbDataSize   = strlen(standbinfile2);</div><div>+</div><div>+        handle[1] = pOpenColorProfileA( &profile, PROFILE_READ, 1, OPEN_EXISTING );</div><div>+        ok( handle[1] != NULL, "got %lu\n", GetLastError() );</div><div>+</div><div>+        transform = pCreateMultiProfileTransform( handle, 2, &intents, 1, 3, 0 );</div><div>+        ok( transform != NULL, "got %lu\n", GetLastError() );</div><div>+</div><div>+        ZeroMemory(destbits,DESTBUFSIZE);</div><div>+        bret = pTranslateBitmapBits(transform,srcbits,input,width,height,inputstride,destbits,output,outputstride,callback,data);</div><div>+        ok(bret && memcmp(expect_destbits, destbits, sizeof(expect_destbits)) == 0, "get err destbits data\n");</div><div>+        HeapFree( GetProcessHeap(), 0, destbits );</div><div>+</div><div>+        pDeleteColorTransform( transform );</div><div>+        pCloseColorProfile( handle[0] );</div><div>+        pCloseColorProfile( handle[1] );</div><div>+    }</div><div>+}</div><div>+</div><div> START_TEST(profile)</div><div> {</div><div>     UINT len;</div><div>@@ -1469,6 +1586,7 @@ START_TEST(profile)</div><div> </div><div>     test_AssociateColorProfileWithDeviceA( testprofile );</div><div>     test_CreateMultiProfileTransform( standardprofile, testprofile );</div><div>+    test_TranslateBitmapBits( );</div><div> </div><div>     if (testprofile) DeleteFileA( testprofile );</div><div>     FreeLibrary( huser32 );</div><div>-- </div><div>2.20.1</div></div><div><tincludetail></tincludetail></div><!--<![endif]-->