Test and implement SetColorProfileElement.

Document more functions.
This commit is contained in:
Hans Leidekker 2004-12-13 13:23:17 +00:00 committed by Alexandre Julliard
parent 76d8779c6f
commit 3e60f767ef
6 changed files with 240 additions and 40 deletions

View File

@ -95,4 +95,10 @@ void MSCMS_get_tag_data( icProfile *iccprofile, icTag *tag, DWORD offset, void *
{ {
memcpy( buffer, (char *)iccprofile + tag->offset + offset, tag->size - offset ); memcpy( buffer, (char *)iccprofile + tag->offset + offset, tag->size - offset );
} }
void MSCMS_set_tag_data( icProfile *iccprofile, icTag *tag, DWORD offset, void *buffer )
{
memcpy( (char *)iccprofile + tag->offset + offset, buffer, tag->size - offset );
}
#endif /* HAVE_LCMS_H */ #endif /* HAVE_LCMS_H */

View File

@ -46,7 +46,7 @@
@ stub RegisterCMMA @ stub RegisterCMMA
@ stub RegisterCMMW @ stub RegisterCMMW
@ stub SelectCMM @ stub SelectCMM
@ stub SetColorProfileElement @ stdcall SetColorProfileElement(ptr long long ptr ptr)
@ stub SetColorProfileElementReference @ stub SetColorProfileElementReference
@ stub SetColorProfileElementSize @ stub SetColorProfileElementSize
@ stdcall SetColorProfileHeader(ptr ptr) @ stdcall SetColorProfileHeader(ptr ptr)

View File

@ -81,6 +81,7 @@ extern void MSCMS_destroy_hprofile_handle( HPROFILE profile );
extern DWORD MSCMS_get_tag_count( icProfile *iccprofile ); extern DWORD MSCMS_get_tag_count( icProfile *iccprofile );
extern void MSCMS_get_tag_by_index( icProfile *iccprofile, DWORD index, icTag *tag ); extern void MSCMS_get_tag_by_index( icProfile *iccprofile, DWORD index, icTag *tag );
extern void MSCMS_get_tag_data( icProfile *iccprofile, icTag *tag, DWORD offset, void *buffer ); extern void MSCMS_get_tag_data( icProfile *iccprofile, icTag *tag, DWORD offset, void *buffer );
extern void MSCMS_set_tag_data( icProfile *iccprofile, icTag *tag, DWORD offset, void *buffer );
extern void MSCMS_get_profile_header( icProfile *iccprofile, PROFILEHEADER *header ); extern void MSCMS_get_profile_header( icProfile *iccprofile, PROFILEHEADER *header );
extern void MSCMS_set_profile_header( icProfile *iccprofile, PROFILEHEADER *header ); extern void MSCMS_set_profile_header( icProfile *iccprofile, PROFILEHEADER *header );

View File

@ -103,7 +103,7 @@ BOOL WINAPI GetColorDirectoryA( PCSTR machine, PSTR buffer, PDWORD size )
* PARAMS * PARAMS
* machine [I] Name of the machine for which to get the color directory. * machine [I] Name of the machine for which to get the color directory.
* Must be NULL, which indicates the local machine. * Must be NULL, which indicates the local machine.
* buffer [I] Buffer to recieve the path name in. * buffer [I] Buffer to receive the path name.
* size [I/O] Size of the buffer in bytes. On return the variable holds * size [I/O] Size of the buffer in bytes. On return the variable holds
* the number of bytes actually needed. * the number of bytes actually needed.
*/ */
@ -133,6 +133,25 @@ BOOL WINAPI GetColorDirectoryW( PCWSTR machine, PWSTR buffer, PDWORD size )
return FALSE; return FALSE;
} }
/******************************************************************************
* GetColorProfileElement [MSCMS.@]
*
* Retrieve data for a specified tag type.
*
* PARAMS
* profile [I] Handle to a color profile.
* type [I] ICC tag type.
* offset [I] Offset in bytes to start copying from.
* size [I/O] Size of the buffer in bytes. On return the variable holds
* the number of bytes actually needed.
* buffer [O] Buffer to receive the tag data.
* ref [O] Pointer to a BOOL that specifies whether more than one tag
* references the data.
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI GetColorProfileElement( HPROFILE profile, TAGTYPE type, DWORD offset, PDWORD size, BOOL WINAPI GetColorProfileElement( HPROFILE profile, TAGTYPE type, DWORD offset, PDWORD size,
PVOID buffer, PBOOL ref ) PVOID buffer, PBOOL ref )
{ {
@ -173,12 +192,12 @@ BOOL WINAPI GetColorProfileElement( HPROFILE profile, TAGTYPE type, DWORD offset
/****************************************************************************** /******************************************************************************
* GetColorProfileElementTag [MSCMS.@] * GetColorProfileElementTag [MSCMS.@]
* *
* Get a tag from a color profile by index. * Get the tag type from a color profile by index.
* *
* PARAMS * PARAMS
* profile [I] Handle to a color profile. * profile [I] Handle to a color profile.
* index [I] Index into the tag table of the color profile. * index [I] Index into the tag table of the color profile.
* tag [O] Pointer to a TAGTYPE variable. * type [O] Pointer to a variable that holds the ICC tag type on return.
* *
* RETURNS * RETURNS
* Success: TRUE * Success: TRUE
@ -212,6 +231,24 @@ BOOL WINAPI GetColorProfileElementTag( HPROFILE profile, DWORD index, PTAGTYPE t
return ret; return ret;
} }
/******************************************************************************
* GetColorProfileFromHandle [MSCMS.@]
*
* Retrieve an ICC color profile by handle.
*
* PARAMS
* profile [I] Handle to a color profile.
* buffer [O] Buffer to receive the ICC profile.
* size [I/O] Size of the buffer in bytes. On return the variable holds the
* number of bytes actually needed.
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*
* NOTES
* The profile returned will be in big-endian format.
*/
BOOL WINAPI GetColorProfileFromHandle( HPROFILE profile, PBYTE buffer, PDWORD size ) BOOL WINAPI GetColorProfileFromHandle( HPROFILE profile, PBYTE buffer, PDWORD size )
{ {
BOOL ret = FALSE; BOOL ret = FALSE;
@ -238,6 +275,22 @@ BOOL WINAPI GetColorProfileFromHandle( HPROFILE profile, PBYTE buffer, PDWORD si
return ret; return ret;
} }
/******************************************************************************
* GetColorProfileHeader [MSCMS.@]
*
* Retrieve a color profile header by handle.
*
* PARAMS
* profile [I] Handle to a color profile.
* header [O] Buffer to receive the ICC profile header.
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*
* NOTES
* The profile header returned will be adjusted for endianess.
*/
BOOL WINAPI GetColorProfileHeader( HPROFILE profile, PPROFILEHEADER header ) BOOL WINAPI GetColorProfileHeader( HPROFILE profile, PPROFILEHEADER header )
{ {
BOOL ret = FALSE; BOOL ret = FALSE;
@ -420,28 +473,28 @@ BOOL WINAPI InstallColorProfileW( PCWSTR machine, PCWSTR profile )
/****************************************************************************** /******************************************************************************
* IsColorProfileTagPresent [MSCMS.@] * IsColorProfileTagPresent [MSCMS.@]
* *
* Determine if a given ICC tag is present in a color profile. * Determine if a given ICC tag type is present in a color profile.
* *
* PARAMS * PARAMS
* profile [I] Color profile handle. * profile [I] Color profile handle.
* tag [I] ICC tag. * tag [I] ICC tag type.
* present [O] Pointer to a BOOL variable. Set to TRUE if tag is present, * present [O] Pointer to a BOOL variable. Set to TRUE if tag type is present,
* FALSE otherwise. * FALSE otherwise.
* *
* RETURNS * RETURNS
* Success: TRUE * Success: TRUE
* Failure: FALSE * Failure: FALSE
*/ */
BOOL WINAPI IsColorProfileTagPresent( HPROFILE profile, TAGTYPE tag, PBOOL present ) BOOL WINAPI IsColorProfileTagPresent( HPROFILE profile, TAGTYPE type, PBOOL present )
{ {
BOOL ret = FALSE; BOOL ret = FALSE;
#ifdef HAVE_LCMS_H #ifdef HAVE_LCMS_H
cmsHPROFILE cmsprofile = MSCMS_hprofile2cmsprofile( profile ); cmsHPROFILE cmsprofile = MSCMS_hprofile2cmsprofile( profile );
TRACE( "( %p, 0x%08lx, %p )\n", profile, tag, present ); TRACE( "( %p, 0x%08lx, %p )\n", profile, type, present );
if (!cmsprofile || !present) return FALSE; if (!cmsprofile || !present) return FALSE;
ret = cmsIsTag( cmsprofile, tag ); ret = cmsIsTag( cmsprofile, type );
#endif /* HAVE_LCMS_H */ #endif /* HAVE_LCMS_H */
return *present = ret; return *present = ret;
@ -476,6 +529,54 @@ BOOL WINAPI IsColorProfileValid( HPROFILE profile, PBOOL valid )
return ret; return ret;
} }
/******************************************************************************
* SetColorProfileElement [MSCMS.@]
*
* Set data for a specified tag type.
*
* PARAMS
* profile [I] Handle to a color profile.
* type [I] ICC tag type.
* offset [I] Offset in bytes to start copying to.
* size [I/O] Size of the buffer in bytes. On return the variable holds the
* number of bytes actually needed.
* buffer [O] Buffer holding the tag data.
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI SetColorProfileElement( HPROFILE profile, TAGTYPE type, DWORD offset, PDWORD size,
PVOID buffer )
{
BOOL ret = FALSE;
#ifdef HAVE_LCMS_H
icProfile *iccprofile = MSCMS_hprofile2iccprofile( profile );
DWORD i, count;
icTag tag;
TRACE( "( %p, 0x%08lx, %ld, %p, %p )\n", profile, type, offset, size, buffer );
if (!iccprofile || !size || !buffer) return FALSE;
count = MSCMS_get_tag_count( iccprofile );
for (i = 0; i < count; i++)
{
MSCMS_get_tag_by_index( iccprofile, i, &tag );
if (tag.sig == type)
{
if (offset > tag.size) return FALSE;
MSCMS_set_tag_data( iccprofile, &tag, offset, buffer );
return TRUE;
}
}
#endif /* HAVE_LCMS_H */
return ret;
}
BOOL WINAPI SetColorProfileHeader( HPROFILE profile, PPROFILEHEADER header ) BOOL WINAPI SetColorProfileHeader( HPROFILE profile, PPROFILEHEADER header )
{ {
BOOL ret = FALSE; BOOL ret = FALSE;

View File

@ -57,7 +57,7 @@ static const WCHAR profile2W[] =
'\\','c','o','l','o','r','\\','s','r','g','b',' ','c','o','l','o','r',' ', '\\','c','o','l','o','r','\\','s','r','g','b',' ','c','o','l','o','r',' ',
's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 }; 's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 };
static unsigned char rgbheader[] = static const unsigned char rgbheader[] =
{ 0x48, 0x0c, 0x00, 0x00, 0x6f, 0x6e, 0x69, 0x4c, 0x00, 0x00, 0x10, 0x02, { 0x48, 0x0c, 0x00, 0x00, 0x6f, 0x6e, 0x69, 0x4c, 0x00, 0x00, 0x10, 0x02,
0x72, 0x74, 0x6e, 0x6d, 0x20, 0x42, 0x47, 0x52, 0x20, 0x5a, 0x59, 0x58, 0x72, 0x74, 0x6e, 0x6d, 0x20, 0x42, 0x47, 0x52, 0x20, 0x5a, 0x59, 0x58,
0x02, 0x00, 0xce, 0x07, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x31, 0x00, 0x02, 0x00, 0xce, 0x07, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x31, 0x00,
@ -173,7 +173,7 @@ static void test_GetColorProfileElement()
DWORD size; DWORD size;
TAGTYPE tag = 0x63707274; /* 'cprt' */ TAGTYPE tag = 0x63707274; /* 'cprt' */
static char buffer[51]; static char buffer[51];
char expect[] = static const char expect[] =
{ 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00, 0x43, 0x6f, 0x70, { 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00, 0x43, 0x6f, 0x70,
0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20,
0x31, 0x39, 0x39, 0x38, 0x20, 0x48, 0x65, 0x77, 0x6c, 0x65, 0x74, 0x31, 0x39, 0x39, 0x38, 0x20, 0x48, 0x65, 0x77, 0x6c, 0x65, 0x74,
@ -262,7 +262,7 @@ static void test_GetColorProfileFromHandle()
HPROFILE handle; HPROFILE handle;
DWORD size; DWORD size;
BOOL ret; BOOL ret;
static unsigned char expect[] = static const unsigned char expect[] =
{ 0x00, 0x00, 0x0c, 0x48, 0x4c, 0x69, 0x6e, 0x6f, 0x02, 0x10, 0x00, { 0x00, 0x00, 0x0c, 0x48, 0x4c, 0x69, 0x6e, 0x6f, 0x02, 0x10, 0x00,
0x00, 0x6d, 0x6e, 0x74, 0x72, 0x52, 0x47, 0x42, 0x20, 0x58, 0x59, 0x00, 0x6d, 0x6e, 0x74, 0x72, 0x52, 0x47, 0x42, 0x20, 0x58, 0x59,
0x5a, 0x20, 0x07, 0xce, 0x00, 0x02, 0x00, 0x09, 0x00, 0x06, 0x00, 0x5a, 0x20, 0x07, 0xce, 0x00, 0x02, 0x00, 0x09, 0x00, 0x06, 0x00,
@ -281,24 +281,23 @@ static void test_GetColorProfileFromHandle()
handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING ); handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() ); ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
/* Parameter checks */
size = 0;
ret = GetColorProfileFromHandle( handle, NULL, &size );
ok( !ret && size > 0, "GetColorProfileFromHandle() failed (%ld)\n", GetLastError() );
buffer = HeapAlloc( GetProcessHeap(), 0, size ); buffer = HeapAlloc( GetProcessHeap(), 0, size );
if (buffer) if (buffer)
{ {
/* Parameter checks */
ret = GetColorProfileFromHandle( NULL, buffer, &size ); ret = GetColorProfileFromHandle( NULL, buffer, &size );
ok( !ret, "GetColorProfileFromHandle() succeeded (%ld)\n", GetLastError() ); ok( !ret, "GetColorProfileFromHandle() succeeded (%ld)\n", GetLastError() );
ret = GetColorProfileFromHandle( handle, buffer, NULL ); ret = GetColorProfileFromHandle( handle, buffer, NULL );
ok( !ret, "GetColorProfileFromHandle() succeeded (%ld)\n", GetLastError() ); ok( !ret, "GetColorProfileFromHandle() succeeded (%ld)\n", GetLastError() );
size = 0;
ret = GetColorProfileFromHandle( handle, NULL, &size );
ok( !ret && size > 0, "GetColorProfileFromHandle() succeeded (%ld)\n",
GetLastError() );
/* Functional checks */ /* Functional checks */
ret = GetColorProfileFromHandle( handle, buffer, &size ); ret = GetColorProfileFromHandle( handle, buffer, &size );
@ -331,6 +330,9 @@ static void test_GetColorProfileHeader()
/* Parameter checks */ /* Parameter checks */
ret = GetColorProfileHeader( NULL, NULL );
ok( !ret, "GetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
ret = GetColorProfileHeader( NULL, &header ); ret = GetColorProfileHeader( NULL, &header );
ok( !ret, "GetColorProfileHeader() succeeded (%ld)\n", GetLastError() ); ok( !ret, "GetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
@ -388,14 +390,15 @@ static void test_GetStandardColorSpaceProfileA()
{ {
BOOL ret; BOOL ret;
DWORD size; DWORD size;
CHAR profile[MAX_PATH]; CHAR oldprofile[MAX_PATH];
CHAR newprofile[MAX_PATH];
/* Parameter checks */ /* Parameter checks */
ret = GetStandardColorSpaceProfileA( NULL, 0, profile, NULL ); ret = GetStandardColorSpaceProfileA( NULL, 0, newprofile, NULL );
ok( !ret, "GetStandardColorSpaceProfileA() succeeded (%ld)\n", GetLastError() ); ok( !ret, "GetStandardColorSpaceProfileA() succeeded (%ld)\n", GetLastError() );
ret = GetStandardColorSpaceProfileA( machine, 0, profile, &size ); ret = GetStandardColorSpaceProfileA( machine, 0, newprofile, &size );
ok( !ret, "GetStandardColorSpaceProfileA() succeeded (%ld)\n", GetLastError() ); ok( !ret, "GetStandardColorSpaceProfileA() succeeded (%ld)\n", GetLastError() );
size = 0; size = 0;
@ -403,24 +406,32 @@ static void test_GetStandardColorSpaceProfileA()
ret = GetStandardColorSpaceProfileA( NULL, 0, NULL, &size ); ret = GetStandardColorSpaceProfileA( NULL, 0, NULL, &size );
ok( !ret, "GetStandardColorSpaceProfileA() succeeded (%ld)\n", GetLastError() ); ok( !ret, "GetStandardColorSpaceProfileA() succeeded (%ld)\n", GetLastError() );
size = sizeof(profile); size = sizeof(newprofile);
ret = GetStandardColorSpaceProfileA( NULL, 0, profile, &size ); ret = GetStandardColorSpaceProfileA( NULL, 0, newprofile, &size );
ok( !ret, "GetStandardColorSpaceProfileA() succeeded (%ld)\n", GetLastError() ); ok( !ret, "GetStandardColorSpaceProfileA() succeeded (%ld)\n", GetLastError() );
/* Functional checks */ /* Functional checks */
if (standardprofile) if (standardprofile)
{ {
size = sizeof(oldprofile);
ret = GetStandardColorSpaceProfileA( NULL, SPACE_RGB, oldprofile, &size );
ok( ret, "GetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() );
ret = SetStandardColorSpaceProfileA( NULL, SPACE_RGB, standardprofile ); ret = SetStandardColorSpaceProfileA( NULL, SPACE_RGB, standardprofile );
ok( ret, "SetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() ); ok( ret, "SetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() );
size = sizeof(profile); size = sizeof(newprofile);
ret = GetStandardColorSpaceProfileA( NULL, SPACE_RGB, profile, &size ); ret = GetStandardColorSpaceProfileA( NULL, SPACE_RGB, newprofile, &size );
ok( ret, "GetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() ); ok( ret, "GetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() );
ok( !lstrcmpiA( (LPSTR)&profile, standardprofile ), "Unexpected profile\n" ); ok( !lstrcmpiA( (LPSTR)&newprofile, standardprofile ), "Unexpected profile\n" );
ret = SetStandardColorSpaceProfileA( NULL, SPACE_RGB, oldprofile );
ok( ret, "SetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() );
} }
} }
@ -428,14 +439,15 @@ static void test_GetStandardColorSpaceProfileW()
{ {
BOOL ret; BOOL ret;
DWORD size; DWORD size;
WCHAR profile[MAX_PATH]; WCHAR oldprofile[MAX_PATH];
WCHAR newprofile[MAX_PATH];
/* Parameter checks */ /* Parameter checks */
ret = GetStandardColorSpaceProfileW( NULL, 0, profile, NULL ); ret = GetStandardColorSpaceProfileW( NULL, 0, newprofile, NULL );
ok( !ret, "GetStandardColorSpaceProfileW() succeeded (%ld)\n", GetLastError() ); ok( !ret, "GetStandardColorSpaceProfileW() succeeded (%ld)\n", GetLastError() );
ret = GetStandardColorSpaceProfileW( machineW, 0, profile, &size ); ret = GetStandardColorSpaceProfileW( machineW, 0, newprofile, &size );
ok( !ret, "GetStandardColorSpaceProfileW() succeeded (%ld)\n", GetLastError() ); ok( !ret, "GetStandardColorSpaceProfileW() succeeded (%ld)\n", GetLastError() );
size = 0; size = 0;
@ -443,24 +455,32 @@ static void test_GetStandardColorSpaceProfileW()
ret = GetStandardColorSpaceProfileW( NULL, 0, NULL, &size ); ret = GetStandardColorSpaceProfileW( NULL, 0, NULL, &size );
ok( !ret, "GetStandardColorSpaceProfileW() succeeded (%ld)\n", GetLastError() ); ok( !ret, "GetStandardColorSpaceProfileW() succeeded (%ld)\n", GetLastError() );
size = sizeof(profile); size = sizeof(newprofile);
ret = GetStandardColorSpaceProfileW( NULL, 0, profile, &size ); ret = GetStandardColorSpaceProfileW( NULL, 0, newprofile, &size );
ok( !ret, "GetStandardColorSpaceProfileW() succeeded (%ld)\n", GetLastError() ); ok( !ret, "GetStandardColorSpaceProfileW() succeeded (%ld)\n", GetLastError() );
/* Functional checks */ /* Functional checks */
if (standardprofileW) if (standardprofileW)
{ {
size = sizeof(oldprofile);
ret = GetStandardColorSpaceProfileW( NULL, SPACE_RGB, oldprofile, &size );
ok( ret, "GetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() );
ret = SetStandardColorSpaceProfileW( NULL, SPACE_RGB, standardprofileW ); ret = SetStandardColorSpaceProfileW( NULL, SPACE_RGB, standardprofileW );
ok( ret, "SetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() ); ok( ret, "SetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() );
size = sizeof(profile); size = sizeof(newprofile);
ret = GetStandardColorSpaceProfileW( NULL, SPACE_RGB, profile, &size ); ret = GetStandardColorSpaceProfileW( NULL, SPACE_RGB, newprofile, &size );
ok( ret, "GetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() ); ok( ret, "GetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() );
ok( !lstrcmpiW( (LPWSTR)&profile, standardprofileW ), "Unexpected profile\n" ); ok( !lstrcmpiW( (LPWSTR)&newprofile, standardprofileW ), "Unexpected profile\n" );
ret = SetStandardColorSpaceProfileW( NULL, SPACE_RGB, oldprofile );
ok( ret, "SetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() );
} }
} }
@ -702,6 +722,67 @@ static void test_OpenColorProfileW()
} }
} }
static void test_SetColorProfileElement()
{
if (testprofile)
{
PROFILE profile;
HPROFILE handle;
DWORD size;
BOOL ret, ref;
TAGTYPE tag = 0x63707274; /* 'cprt' */
static char data[] = "(c) The Wine Project";
static char buffer[51];
profile.dwType = PROFILE_FILENAME;
profile.pProfileData = testprofile;
profile.cbDataSize = strlen(testprofile);
handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
todo_wine
{
ret = SetColorProfileElement( handle, tag, 0, &size, data );
ok( !ret, "SetColorProfileElement() succeeded (%ld)\n", GetLastError() );
}
CloseColorProfile( handle );
handle = OpenColorProfileA( &profile, PROFILE_READWRITE, 0, OPEN_EXISTING );
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
/* Parameter checks */
ret = SetColorProfileElement( NULL, 0, 0, NULL, NULL );
ok( !ret, "SetColorProfileElement() succeeded (%ld)\n", GetLastError() );
ret = SetColorProfileElement( handle, 0, 0, NULL, NULL );
ok( !ret, "SetColorProfileElement() succeeded (%ld)\n", GetLastError() );
ret = SetColorProfileElement( handle, tag, 0, NULL, NULL );
ok( !ret, "SetColorProfileElement() succeeded (%ld)\n", GetLastError() );
ret = SetColorProfileElement( handle, tag, 0, &size, NULL );
ok( !ret, "SetColorProfileElement() succeeded (%ld)\n", GetLastError() );
/* Functional checks */
ret = SetColorProfileElement( handle, tag, 0, &size, data );
ok( ret, "SetColorProfileElement() failed (%ld)\n", GetLastError() );
size = sizeof(buffer);
ret = GetColorProfileElement( handle, tag, 0, &size, buffer, &ref );
ok( ret && size > 0, "GetColorProfileElement() failed (%ld)\n", GetLastError() );
ok( !memcmp( data, buffer, sizeof(data) ), "Unexpected tag data\n" );
CloseColorProfile( handle );
}
}
static void test_SetColorProfileHeader() static void test_SetColorProfileHeader()
{ {
if (testprofile) if (testprofile)
@ -739,20 +820,29 @@ static void test_SetColorProfileHeader()
/* Parameter checks */ /* Parameter checks */
todo_wine
{
handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING ); handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() ); ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
todo_wine
{
ret = SetColorProfileHeader( handle, &header ); ret = SetColorProfileHeader( handle, &header );
ok( !ret, "SetColorProfileHeader() succeeded (%ld)\n", GetLastError() ); ok( !ret, "SetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
}
CloseColorProfile( handle ); CloseColorProfile( handle );
}
handle = OpenColorProfileA( &profile, PROFILE_READWRITE, 0, OPEN_EXISTING ); handle = OpenColorProfileA( &profile, PROFILE_READWRITE, 0, OPEN_EXISTING );
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() ); ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
ret = SetColorProfileHeader( NULL, NULL );
ok( !ret, "SetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
ret = SetColorProfileHeader( handle, NULL );
ok( !ret, "SetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
ret = SetColorProfileHeader( NULL, &header );
ok( !ret, "SetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
/* Functional checks */ /* Functional checks */
ret = SetColorProfileHeader( handle, &header ); ret = SetColorProfileHeader( handle, &header );
@ -916,6 +1006,7 @@ START_TEST(profile)
test_OpenColorProfileA(); test_OpenColorProfileA();
test_OpenColorProfileW(); test_OpenColorProfileW();
test_SetColorProfileElement();
test_SetColorProfileHeader(); test_SetColorProfileHeader();
test_UninstallColorProfileA(); test_UninstallColorProfileA();

View File

@ -174,6 +174,7 @@ BOOL WINAPI IsColorProfileValid(HPROFILE,PBOOL);
HPROFILE WINAPI OpenColorProfileA(PPROFILE,DWORD,DWORD,DWORD); HPROFILE WINAPI OpenColorProfileA(PPROFILE,DWORD,DWORD,DWORD);
HPROFILE WINAPI OpenColorProfileW(PPROFILE,DWORD,DWORD,DWORD); HPROFILE WINAPI OpenColorProfileW(PPROFILE,DWORD,DWORD,DWORD);
#define OpenColorProfile WINELIB_NAME_AW(OpenColorProfile) #define OpenColorProfile WINELIB_NAME_AW(OpenColorProfile)
BOOL WINAPI SetColorProfileElement(HPROFILE,TAGTYPE,DWORD,PDWORD,PVOID);
BOOL WINAPI SetColorProfileHeader(HPROFILE,PPROFILEHEADER); BOOL WINAPI SetColorProfileHeader(HPROFILE,PPROFILEHEADER);
BOOL WINAPI SetStandardColorSpaceProfileA(PCSTR,DWORD,PSTR); BOOL WINAPI SetStandardColorSpaceProfileA(PCSTR,DWORD,PSTR);
BOOL WINAPI SetStandardColorSpaceProfileW(PCWSTR,DWORD,PWSTR); BOOL WINAPI SetStandardColorSpaceProfileW(PCWSTR,DWORD,PWSTR);