From dbdf9278e8f826dacbf59f767f9dad6706f52e3e Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Fri, 22 Feb 2008 14:24:59 +0100 Subject: [PATCH] mscms: Add tests for AssociateColorProfileWithDevice and DisassociateColorProfileFromDevice. --- dlls/mscms/tests/profile.c | 71 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/dlls/mscms/tests/profile.c b/dlls/mscms/tests/profile.c index 5e5dbabc35..d7e1f6abf6 100644 --- a/dlls/mscms/tests/profile.c +++ b/dlls/mscms/tests/profile.c @@ -32,7 +32,9 @@ HMODULE hmscms; +static BOOL (WINAPI *pAssociateColorProfileWithDeviceA)(PCSTR,PCSTR,PCSTR); static BOOL (WINAPI *pCloseColorProfile)(HPROFILE); +static BOOL (WINAPI *pDisassociateColorProfileFromDeviceA)(PCSTR,PCSTR,PCSTR); static BOOL (WINAPI *pGetColorDirectoryA)(PCHAR,PCHAR,PDWORD); static BOOL (WINAPI *pGetColorDirectoryW)(PWCHAR,PWCHAR,PDWORD); static BOOL (WINAPI *pGetColorProfileElement)(HPROFILE,TAGTYPE,DWORD,PDWORD,PVOID,PBOOL); @@ -61,7 +63,9 @@ static BOOL (WINAPI *pUninstallColorProfileW)(PCWSTR,PCWSTR,BOOL); static BOOL init_function_ptrs( void ) { + GETFUNCPTR( AssociateColorProfileWithDeviceA ) GETFUNCPTR( CloseColorProfile ) + GETFUNCPTR( DisassociateColorProfileFromDeviceA ) GETFUNCPTR( GetColorDirectoryA ) GETFUNCPTR( GetColorDirectoryW ) GETFUNCPTR( GetColorProfileElement ) @@ -1353,6 +1357,71 @@ static void test_UninstallColorProfileW(void) } } +static void test_AssociateColorProfileWithDeviceA(void) +{ + BOOL ret; + char profile[MAX_PATH], basename[MAX_PATH]; + DWORD error, size = sizeof(profile); + + if (testprofile) + { + SetLastError(0xdeadbeef); + ret = pAssociateColorProfileWithDeviceA( "machine", testprofile, NULL ); + error = GetLastError(); + ok( !ret, "AssociateColorProfileWithDevice() succeeded\n" ); + ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error ); + + SetLastError(0xdeadbeef); + ret = pAssociateColorProfileWithDeviceA( "machine", NULL, "DISPLAY" ); + error = GetLastError(); + ok( !ret, "AssociateColorProfileWithDevice() succeeded\n" ); + ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error ); + + SetLastError(0xdeadbeef); + ret = pAssociateColorProfileWithDeviceA( "machine", testprofile, "DISPLAY" ); + error = GetLastError(); + ok( !ret, "AssociateColorProfileWithDevice() succeeded\n" ); + ok( error == ERROR_NOT_SUPPORTED, "expected ERROR_NOT_SUPPORTED, got %u\n", error ); + + ret = pInstallColorProfileA( NULL, testprofile ); + ok( ret, "InstallColorProfileA() failed (%u)\n", GetLastError() ); + + ret = pGetColorDirectoryA( NULL, profile, &size ); + ok( ret, "GetColorDirectoryA() failed (%d)\n", GetLastError() ); + + MSCMS_basenameA( testprofile, basename ); + lstrcatA( profile, "\\" ); + lstrcatA( profile, basename ); + + ret = pAssociateColorProfileWithDeviceA( NULL, profile, "DISPLAY" ); + ok( ret, "AssociateColorProfileWithDevice() failed (%u)\n", GetLastError() ); + + SetLastError(0xdeadbeef); + ret = pDisassociateColorProfileFromDeviceA( "machine", profile, NULL ); + error = GetLastError(); + ok( !ret, "DisassociateColorProfileFromDeviceA() succeeded\n" ); + ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error ); + + SetLastError(0xdeadbeef); + ret = pDisassociateColorProfileFromDeviceA( "machine", NULL, "DISPLAY" ); + error = GetLastError(); + ok( !ret, "DisassociateColorProfileFromDeviceA() succeeded\n" ); + ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error ); + + SetLastError(0xdeadbeef); + ret = pDisassociateColorProfileFromDeviceA( "machine", profile, "DISPLAY" ); + error = GetLastError(); + ok( !ret, "DisassociateColorProfileFromDeviceA() succeeded\n" ); + ok( error == ERROR_NOT_SUPPORTED, "expected ERROR_NOT_SUPPORTED, got %u\n", error ); + + ret = pDisassociateColorProfileFromDeviceA( NULL, profile, "DISPLAY" ); + ok( ret, "DisassociateColorProfileFromDeviceA() failed (%u)\n", GetLastError() ); + + ret = pUninstallColorProfileA( NULL, profile, TRUE ); + ok( ret, "UninstallColorProfileW() failed (%d)\n", GetLastError() ); + } +} + START_TEST(profile) { UINT len; @@ -1457,6 +1526,8 @@ START_TEST(profile) test_UninstallColorProfileA(); test_UninstallColorProfileW(); + test_AssociateColorProfileWithDeviceA(); + /* Clean up */ if (testprofile) DeleteFileA( testprofile );