~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/gdi32/tests/icm.c

Version: ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~ [ wine-1.0-rc5 ] ~ [ wine-1.0-rc4 ] ~ [ wine-1.0-rc3 ] ~ [ wine-1.0-rc2 ] ~ [ wine-1.0-rc1 ] ~ [ wine-0.9.61 ] ~ [ wine-0.9.60 ] ~ [ wine-0.9.59 ] ~ [ wine-0.9.58 ] ~ [ wine-0.9.57 ] ~ [ wine-0.9.56 ] ~ [ wine-0.9.55 ] ~ [ wine-0.9.54 ] ~ [ wine-0.9.53 ] ~ [ wine-0.9.52 ] ~ [ wine-0.9.51 ] ~ [ wine-0.9.50 ] ~ [ wine-0.9.49 ] ~ [ wine-0.9.48 ] ~ [ wine-0.9.47 ] ~ [ wine-0.9.46 ] ~ [ wine-0.9.45 ] ~ [ wine-0.9.44 ] ~ [ wine-0.9.43 ] ~ [ wine-0.9.42 ] ~ [ wine-0.9.41 ] ~ [ wine-0.9.40 ] ~ [ wine-0.9.39 ] ~ [ wine-0.9.38 ] ~ [ wine-0.9.37 ] ~ [ wine-0.9.36 ] ~ [ wine-0.9.35 ] ~ [ wine-0.9.34 ] ~ [ wine-0.9.33 ] ~ [ wine-0.9.32 ] ~ [ wine-0.9.31 ] ~ [ wine-0.9.30 ] ~ [ wine-0.9.29 ] ~ [ wine-0.9.28 ] ~ [ wine-0.9.27 ] ~ [ wine-0.9.26 ] ~ [ wine-0.9.25 ] ~ [ wine-0.9.24 ] ~ [ wine-0.9.23 ] ~ [ wine-0.9.22 ] ~ [ wine-0.9.21 ] ~ [ wine-0.9.20 ] ~ [ wine-0.9.19 ] ~ [ wine-0.9.18 ] ~ [ wine-0.9.17 ] ~ [ wine-0.9.16 ] ~ [ wine-0.9.15 ] ~ [ wine-0.9.14 ] ~ [ wine-0.9.13 ] ~ [ wine-0.9.12 ] ~ [ wine-0.9.11 ] ~ [ wine-0.9.10 ] ~ [ wine-0.9.9 ] ~ [ wine-0.9.8 ] ~ [ wine-0.9.7 ] ~ [ wine-0.9.6 ] ~ [ wine-0.9.5 ] ~ [ wine-0.9.4 ] ~ [ wine-0.9.3 ] ~ [ wine-0.9.2 ] ~ [ wine-0.9.1 ] ~ [ wine-0.9 ] ~ [ wine20050930 ] ~ [ wine20050830 ] ~ [ wine20050725 ] ~ [ wine20050628 ] ~ [ wine20050524 ] ~ [ wine20050419 ] ~ [ wine20050310 ] ~ [ wine20050211 ] ~ [ wine20050111 ] ~ [ wine20041201 ] ~ [ wine20041019 ] ~ [ wine20040914 ] ~ [ wine20040813 ] ~ [ wine20040716 ] ~ [ wine20040615 ] ~ [ wine20040505 ] ~ [ wine20040408 ] ~ [ wine20040309 ] ~ [ wine20040213 ] ~ [ wine20040121 ] ~ [ wine20031212 ] ~ [ wine20031118 ] ~ [ wine20031016 ] ~ [ wine20030911 ] ~ [ wine20030813 ] ~ [ wine20030709 ] ~ [ wine20030618 ] ~ [ wine20030508 ] ~ [ wine20030408 ] ~ [ wine20030318 ] ~ [ wine20030219 ] ~ [ wine20030115 ] ~ [ wine20021219 ] ~ [ wine20021125 ] ~ [ wine20021031 ] ~ [ wine20021007 ] ~ [ wine20020904 ] ~ [ wine20020804 ] ~ [ wine20020710 ] ~ [ wine20020605 ] ~ [ wine20020509 ] ~ [ wine20020411 ] ~ [ wine20020310 ] ~ [ wine20020228 ] ~ [ wine20011226 ] ~ [ wine20011108 ] ~ [ wine20011004 ] ~ [ wine20010824 ] ~ [ wine20010731 ] ~ [ wine20010629 ] ~ [ wine20010510 ] ~ [ wine20010418 ] ~ [ wine20010326 ] ~ [ wine20010305 ] ~ [ wine20010216 ] ~ [ wine20010112 ] ~ [ wine20001222 ] ~ [ wine20001202 ] ~ [ wine20001026 ] ~ [ wine20001002 ] ~ [ wine20000909 ] ~ [ wine20000821 ] ~ [ wine20000801 ] ~ [ wine20000716 ] ~ [ wine20000326 ] ~ [ wine20000227 ] ~ [ wine20000130 ] ~ [ wine20000109 ] ~

  1 /*
  2  * Tests for ICM functions
  3  *
  4  * Copyright (C) 2005, 2008 Hans Leidekker
  5  *
  6  * This library is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU Lesser General Public
  8  * License as published by the Free Software Foundation; either
  9  * version 2.1 of the License, or (at your option) any later version.
 10  *
 11  * This library is distributed in the hope that it will be useful,
 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  * Lesser General Public License for more details.
 15  *
 16  * You should have received a copy of the GNU Lesser General Public
 17  * License along with this library; if not, write to the Free Software
 18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 19  */
 20 
 21 #include <stdarg.h>
 22 
 23 #include "windef.h"
 24 #include "winbase.h"
 25 #include "winuser.h"
 26 #include "wingdi.h"
 27 
 28 #include "wine/test.h"
 29 
 30 static const WCHAR displayW[] = {'D','I','S','P','L','A','Y',0};
 31 
 32 static void test_GetICMProfileA( HDC dc )
 33 {
 34     BOOL ret;
 35     DWORD size, error;
 36     char filename[MAX_PATH];
 37 
 38     SetLastError( 0xdeadbeef );
 39     ret = GetICMProfileA( NULL, NULL, NULL );
 40     if ( !ret && ( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) )
 41     {
 42         skip( "GetICMProfileA is not implemented\n" );
 43         return;
 44     }
 45     ok( !ret, "GetICMProfileA succeeded\n" );
 46 
 47     ret = GetICMProfileA( dc, NULL, NULL );
 48     ok( !ret, "GetICMProfileA succeeded\n" );
 49 
 50     size = MAX_PATH;
 51     ret = GetICMProfileA( dc, &size, NULL );
 52     ok( !ret, "GetICMProfileA succeeded\n" );
 53 
 54     size = MAX_PATH;
 55     ret = GetICMProfileA( NULL, &size, filename );
 56     ok( !ret, "GetICMProfileA succeeded\n" );
 57 
 58     size = 0;
 59     filename[0] = 0;
 60     SetLastError(0xdeadbeef);
 61     ret = GetICMProfileA( dc, &size, filename );
 62     error = GetLastError();
 63     ok( !ret, "GetICMProfileA succeeded\n" );
 64     ok( size, "expected size > 0\n" );
 65     ok( filename[0] == 0, "Expected filename to be empty\n" );
 66     ok( error == ERROR_INSUFFICIENT_BUFFER ||
 67         error == ERROR_SUCCESS, /* Win95 */
 68         "got %d, expected ERROR_INSUFFICIENT_BUFFER or ERROR_SUCCESS(Win95)\n", error );
 69 
 70     /* Next test will crash on Win95 */
 71     if ( error == ERROR_INSUFFICIENT_BUFFER )
 72     {
 73         ret = GetICMProfileA( dc, NULL, filename );
 74         ok( !ret, "GetICMProfileA succeeded\n" );
 75     }
 76 
 77     size = MAX_PATH;
 78     ret = GetICMProfileA( dc, &size, filename );
 79     ok( ret, "GetICMProfileA failed %d\n", GetLastError() );
 80 
 81     trace( "%s\n", filename );
 82 }
 83 
 84 static void test_GetICMProfileW( HDC dc )
 85 {
 86     BOOL ret;
 87     DWORD size, error;
 88     WCHAR filename[MAX_PATH];
 89 
 90     SetLastError( 0xdeadbeef );
 91     ret = GetICMProfileW( NULL, NULL, NULL );
 92     if ( !ret && ( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) )
 93     {
 94         skip( "GetICMProfileW is not implemented\n" );
 95         return;
 96     }
 97     ok( !ret, "GetICMProfileW succeeded\n" );
 98 
 99     ret = GetICMProfileW( dc, NULL, NULL );
100     ok( !ret, "GetICMProfileW succeeded\n" );
101 
102     if (0)
103     {
104         /* Vista crashes */
105         size = MAX_PATH;
106         ret = GetICMProfileW( dc, &size, NULL );
107         ok( ret, "GetICMProfileW failed %d\n", GetLastError() );
108     }
109 
110     ret = GetICMProfileW( dc, NULL, filename );
111     ok( !ret, "GetICMProfileW succeeded\n" );
112 
113     size = MAX_PATH;
114     ret = GetICMProfileW( NULL, &size, filename );
115     ok( !ret, "GetICMProfileW succeeded\n" );
116 
117     size = 0;
118     SetLastError(0xdeadbeef);
119     ret = GetICMProfileW( dc, &size, filename );
120     error = GetLastError();
121     ok( !ret, "GetICMProfileW succeeded\n" );
122     ok( size, "expected size > 0\n" );
123     ok( error == ERROR_INSUFFICIENT_BUFFER, "got %d, expected ERROR_INSUFFICIENT_BUFFER\n", error );
124 
125     size = MAX_PATH;
126     ret = GetICMProfileW( dc, &size, filename );
127     ok( ret, "GetICMProfileW failed %d\n", GetLastError() );
128 }
129 
130 static void test_SetICMMode( HDC dc )
131 {
132     INT ret, knob, save;
133     BOOL impl;
134 
135     SetLastError( 0xdeadbeef );
136     impl = GetICMProfileA( NULL, NULL, NULL );
137     if ( !impl && ( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) )
138     {
139         skip( "On NT4 where SetICMMode is not implemented but this is not advertised\n" );
140         return;
141     }
142 
143     SetLastError( 0xdeadbeef );
144     ret = SetICMMode( NULL, 0 );
145     ok( !ret, "SetICMMode succeeded (%d)\n", GetLastError() );
146 
147     ret = SetICMMode( dc, -1 );
148     ok( !ret, "SetICMMode succeeded (%d)\n", GetLastError() );
149 
150     save = SetICMMode( dc, ICM_QUERY );
151     ok( save == ICM_ON || save == ICM_OFF, "SetICMMode failed (%d)\n", GetLastError() );
152 
153     if (save == ICM_ON) knob = ICM_OFF; else knob = ICM_ON;
154 
155     ret = SetICMMode( dc, knob );
156     todo_wine ok( ret, "SetICMMode failed (%d)\n", GetLastError() );
157 
158     ret = SetICMMode( dc, ICM_QUERY );
159     todo_wine ok( ret == knob, "SetICMMode failed (%d)\n", GetLastError() );
160 
161     ret = SetICMMode( dc, save );
162     ok( ret, "SetICMMode failed (%d)\n", GetLastError() );
163 
164     SetLastError( 0xdeadbeef );
165     dc = CreateDCW( displayW, NULL, NULL, NULL );
166     if ( !dc && ( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) )
167     {
168         skip( "CreateDCW is not implemented\n" );
169         return;
170     }
171     ok( dc != NULL, "CreateDCW failed (%d)\n", GetLastError() );
172 
173     ret = SetICMMode( dc, ICM_QUERY );
174     ok( ret == ICM_OFF, "SetICMMode failed (%d)\n", GetLastError() );
175 
176     DeleteDC( dc );
177 }
178 
179 START_TEST(icm)
180 {
181     HDC dc = GetDC( NULL );
182 
183     test_GetICMProfileA( dc );
184     test_GetICMProfileW( dc );
185     test_SetICMMode( dc );
186 
187     ReleaseDC( NULL, dc );
188 }
189 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.