mscms: Add tests for AssociateColorProfileWithDevice and DisassociateColorProfileFromDevice.

This commit is contained in:
Hans Leidekker 2008-02-22 14:24:59 +01:00 committed by Alexandre Julliard
parent 88ba6a6658
commit dbdf9278e8

View File

@ -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 );