mscms/tests: Pass correct device name to AssociateColorProfileWithDevice().

This commit is contained in:
Ge van Geldorp 2009-01-04 16:23:47 +01:00 committed by Alexandre Julliard
parent e7e4894f2a
commit 1f62d85496
1 changed files with 72 additions and 44 deletions

View File

@ -31,6 +31,7 @@
#include "wine/test.h" #include "wine/test.h"
HMODULE hmscms; HMODULE hmscms;
HMODULE huser32;
static BOOL (WINAPI *pAssociateColorProfileWithDeviceA)(PCSTR,PCSTR,PCSTR); static BOOL (WINAPI *pAssociateColorProfileWithDeviceA)(PCSTR,PCSTR,PCSTR);
static BOOL (WINAPI *pCloseColorProfile)(HPROFILE); static BOOL (WINAPI *pCloseColorProfile)(HPROFILE);
@ -58,6 +59,8 @@ static BOOL (WINAPI *pSetStandardColorSpaceProfileW)(PCWSTR,DWORD,PWSTR);
static BOOL (WINAPI *pUninstallColorProfileA)(PCSTR,PCSTR,BOOL); static BOOL (WINAPI *pUninstallColorProfileA)(PCSTR,PCSTR,BOOL);
static BOOL (WINAPI *pUninstallColorProfileW)(PCWSTR,PCWSTR,BOOL); static BOOL (WINAPI *pUninstallColorProfileW)(PCWSTR,PCWSTR,BOOL);
static BOOL (WINAPI *pEnumDisplayDevicesA)(LPCSTR,DWORD,PDISPLAY_DEVICE,DWORD);
#define GETFUNCPTR(func) p##func = (void *)GetProcAddress( hmscms, #func ); \ #define GETFUNCPTR(func) p##func = (void *)GetProcAddress( hmscms, #func ); \
if (!p##func) return FALSE; if (!p##func) return FALSE;
@ -89,6 +92,8 @@ static BOOL init_function_ptrs( void )
GETFUNCPTR( UninstallColorProfileA ) GETFUNCPTR( UninstallColorProfileA )
GETFUNCPTR( UninstallColorProfileW ) GETFUNCPTR( UninstallColorProfileW )
pEnumDisplayDevicesA = (void *)GetProcAddress( huser32, "EnumDisplayDevicesA" );
return TRUE; return TRUE;
} }
@ -1367,63 +1372,77 @@ static void test_AssociateColorProfileWithDeviceA(void)
BOOL ret; BOOL ret;
char profile[MAX_PATH], basename[MAX_PATH]; char profile[MAX_PATH], basename[MAX_PATH];
DWORD error, size = sizeof(profile); DWORD error, size = sizeof(profile);
DISPLAY_DEVICE display;
BOOL res;
DISPLAY_DEVICE monitor;
if (testprofile) if (testprofile && pEnumDisplayDevicesA)
{ {
SetLastError(0xdeadbeef); display.cb = sizeof( DISPLAY_DEVICE );
ret = pAssociateColorProfileWithDeviceA( "machine", testprofile, NULL ); res = pEnumDisplayDevicesA( NULL, 0, &display, 0 );
error = GetLastError(); ok( res, "Can't get display info\n" );
ok( !ret, "AssociateColorProfileWithDevice() succeeded\n" );
ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error );
SetLastError(0xdeadbeef); monitor.cb = sizeof( DISPLAY_DEVICE );
ret = pAssociateColorProfileWithDeviceA( "machine", NULL, "DISPLAY" ); res = pEnumDisplayDevicesA( display.DeviceName, 0, &monitor, 0 );
error = GetLastError(); if (res)
ok( !ret, "AssociateColorProfileWithDevice() succeeded\n" ); {
ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error ); 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); SetLastError(0xdeadbeef);
ret = pAssociateColorProfileWithDeviceA( "machine", testprofile, "DISPLAY" ); ret = pAssociateColorProfileWithDeviceA( "machine", NULL, monitor.DeviceID );
error = GetLastError(); error = GetLastError();
ok( !ret, "AssociateColorProfileWithDevice() succeeded\n" ); ok( !ret, "AssociateColorProfileWithDevice() succeeded\n" );
ok( error == ERROR_NOT_SUPPORTED, "expected ERROR_NOT_SUPPORTED, got %u\n", error ); ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error );
ret = pInstallColorProfileA( NULL, testprofile ); SetLastError(0xdeadbeef);
ok( ret, "InstallColorProfileA() failed (%u)\n", GetLastError() ); ret = pAssociateColorProfileWithDeviceA( "machine", testprofile, monitor.DeviceID );
error = GetLastError();
ok( !ret, "AssociateColorProfileWithDevice() succeeded\n" );
ok( error == ERROR_NOT_SUPPORTED, "expected ERROR_NOT_SUPPORTED, got %u\n", error );
ret = pGetColorDirectoryA( NULL, profile, &size ); ret = pInstallColorProfileA( NULL, testprofile );
ok( ret, "GetColorDirectoryA() failed (%d)\n", GetLastError() ); ok( ret, "InstallColorProfileA() failed (%u)\n", GetLastError() );
MSCMS_basenameA( testprofile, basename ); ret = pGetColorDirectoryA( NULL, profile, &size );
lstrcatA( profile, "\\" ); ok( ret, "GetColorDirectoryA() failed (%d)\n", GetLastError() );
lstrcatA( profile, basename );
ret = pAssociateColorProfileWithDeviceA( NULL, profile, "DISPLAY" ); MSCMS_basenameA( testprofile, basename );
ok( ret, "AssociateColorProfileWithDevice() failed (%u)\n", GetLastError() ); lstrcatA( profile, "\\" );
lstrcatA( profile, basename );
SetLastError(0xdeadbeef); ret = pAssociateColorProfileWithDeviceA( NULL, profile, monitor.DeviceID );
ret = pDisassociateColorProfileFromDeviceA( "machine", profile, NULL ); ok( ret, "AssociateColorProfileWithDevice() failed (%u)\n", GetLastError() );
error = GetLastError();
ok( !ret, "DisassociateColorProfileFromDeviceA() succeeded\n" );
ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error );
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pDisassociateColorProfileFromDeviceA( "machine", NULL, "DISPLAY" ); ret = pDisassociateColorProfileFromDeviceA( "machine", profile, NULL );
error = GetLastError(); error = GetLastError();
ok( !ret, "DisassociateColorProfileFromDeviceA() succeeded\n" ); ok( !ret, "DisassociateColorProfileFromDeviceA() succeeded\n" );
ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error ); ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error );
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pDisassociateColorProfileFromDeviceA( "machine", profile, "DISPLAY" ); ret = pDisassociateColorProfileFromDeviceA( "machine", NULL, monitor.DeviceID );
error = GetLastError(); error = GetLastError();
ok( !ret, "DisassociateColorProfileFromDeviceA() succeeded\n" ); ok( !ret, "DisassociateColorProfileFromDeviceA() succeeded\n" );
ok( error == ERROR_NOT_SUPPORTED, "expected ERROR_NOT_SUPPORTED, got %u\n", error ); ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error );
ret = pDisassociateColorProfileFromDeviceA( NULL, profile, "DISPLAY" ); SetLastError(0xdeadbeef);
ok( ret, "DisassociateColorProfileFromDeviceA() failed (%u)\n", GetLastError() ); ret = pDisassociateColorProfileFromDeviceA( "machine", profile, monitor.DeviceID );
error = GetLastError();
ok( !ret, "DisassociateColorProfileFromDeviceA() succeeded\n" );
ok( error == ERROR_NOT_SUPPORTED, "expected ERROR_NOT_SUPPORTED, got %u\n", error );
ret = pUninstallColorProfileA( NULL, profile, TRUE ); ret = pDisassociateColorProfileFromDeviceA( NULL, profile, monitor.DeviceID );
ok( ret, "UninstallColorProfileA() failed (%d)\n", GetLastError() ); ok( ret, "DisassociateColorProfileFromDeviceA() failed (%u)\n", GetLastError() );
ret = pUninstallColorProfileA( NULL, profile, TRUE );
ok( ret, "UninstallColorProfileA() failed (%d)\n", GetLastError() );
}
else
skip("Unable to obtain monitor name\n");
} }
} }
@ -1441,8 +1460,16 @@ START_TEST(profile)
hmscms = LoadLibraryA( "mscms.dll" ); hmscms = LoadLibraryA( "mscms.dll" );
if (!hmscms) return; if (!hmscms) return;
huser32 = LoadLibraryA( "user32.dll" );
if (!huser32)
{
FreeLibrary( hmscms );
return;
}
if (!init_function_ptrs()) if (!init_function_ptrs())
{ {
FreeLibrary( huser32 );
FreeLibrary( hmscms ); FreeLibrary( hmscms );
return; return;
} }
@ -1537,5 +1564,6 @@ START_TEST(profile)
if (testprofile) if (testprofile)
DeleteFileA( testprofile ); DeleteFileA( testprofile );
FreeLibrary( huser32 );
FreeLibrary( hmscms ); FreeLibrary( hmscms );
} }