Hans Leidekker : gdi32: Add tests for GetICMProfile and SetICMMode.

Alexandre Julliard julliard at winehq.org
Tue Jan 22 06:01:48 CST 2008


Module: wine
Branch: master
Commit: 8d35fd8d230498811178edc1cfa518f619dde11e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8d35fd8d230498811178edc1cfa518f619dde11e

Author: Hans Leidekker <hans at it.vu.nl>
Date:   Mon Jan 21 16:33:55 2008 +0100

gdi32: Add tests for GetICMProfile and SetICMMode.

---

 dlls/gdi32/tests/Makefile.in |    1 +
 dlls/gdi32/tests/icm.c       |  148 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 149 insertions(+), 0 deletions(-)

diff --git a/dlls/gdi32/tests/Makefile.in b/dlls/gdi32/tests/Makefile.in
index 31cc771..866615c 100644
--- a/dlls/gdi32/tests/Makefile.in
+++ b/dlls/gdi32/tests/Makefile.in
@@ -13,6 +13,7 @@ CTESTS = \
 	font.c \
 	gdiobj.c \
 	generated.c \
+	icm.c \
 	mapping.c \
 	metafile.c \
 	palette.c \
diff --git a/dlls/gdi32/tests/icm.c b/dlls/gdi32/tests/icm.c
new file mode 100644
index 0000000..bbd5574
--- /dev/null
+++ b/dlls/gdi32/tests/icm.c
@@ -0,0 +1,148 @@
+/*
+ * Tests for ICM functions
+ *
+ * Copyright (C) 2005, 2008 Hans Leidekker
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "wingdi.h"
+
+#include "wine/test.h"
+
+static const WCHAR displayW[] = {'D','I','S','P','L','A','Y',0};
+
+static void test_GetICMProfileA( HDC dc )
+{
+    BOOL ret;
+    DWORD size, error;
+    char filename[MAX_PATH];
+
+    ret = GetICMProfileA( NULL, NULL, NULL );
+    ok( !ret, "GetICMProfileA succeeded\n" );
+
+    ret = GetICMProfileA( dc, NULL, NULL );
+    ok( !ret, "GetICMProfileA succeeded\n" );
+
+    size = MAX_PATH;
+    ret = GetICMProfileA( dc, &size, NULL );
+    ok( !ret, "GetICMProfileA succeeded\n" );
+
+    ret = GetICMProfileA( dc, NULL, filename );
+    ok( !ret, "GetICMProfileA succeeded\n" );
+
+    size = MAX_PATH;
+    ret = GetICMProfileA( NULL, &size, filename );
+    ok( !ret, "GetICMProfileA succeeded\n" );
+
+    size = 0;
+    SetLastError(0xdeadbeef);
+    ret = GetICMProfileA( dc, &size, filename );
+    error = GetLastError();
+    ok( !ret, "GetICMProfileA succeeded\n" );
+    ok( size, "expected size > 0\n" );
+    ok( error == ERROR_INSUFFICIENT_BUFFER, "got %d, expected ERROR_INSUFFICIENT_BUFFER\n", error );
+
+    size = MAX_PATH;
+    ret = GetICMProfileA( dc, &size, filename );
+    ok( ret, "GetICMProfileA failed %d\n", GetLastError() );
+
+    trace( "%s\n", filename );
+}
+
+static void test_GetICMProfileW( HDC dc )
+{
+    BOOL ret;
+    DWORD size, error;
+    WCHAR filename[MAX_PATH];
+
+    ret = GetICMProfileW( NULL, NULL, NULL );
+    ok( !ret, "GetICMProfileW succeeded\n" );
+
+    ret = GetICMProfileW( dc, NULL, NULL );
+    ok( !ret, "GetICMProfileW succeeded\n" );
+
+    size = MAX_PATH;
+    ret = GetICMProfileW( dc, &size, NULL );
+    ok( ret, "GetICMProfileW failed %d\n", GetLastError() );
+
+    ret = GetICMProfileW( dc, NULL, filename );
+    ok( !ret, "GetICMProfileW succeeded\n" );
+
+    size = MAX_PATH;
+    ret = GetICMProfileW( NULL, &size, filename );
+    ok( !ret, "GetICMProfileW succeeded\n" );
+
+    size = 0;
+    SetLastError(0xdeadbeef);
+    ret = GetICMProfileW( dc, &size, filename );
+    error = GetLastError();
+    ok( !ret, "GetICMProfileW succeeded\n" );
+    ok( size, "expected size > 0\n" );
+    ok( error == ERROR_INSUFFICIENT_BUFFER, "got %d, expected ERROR_INSUFFICIENT_BUFFER\n", error );
+
+    size = MAX_PATH;
+    ret = GetICMProfileW( dc, &size, filename );
+    ok( ret, "GetICMProfileW failed %d\n", GetLastError() );
+}
+
+static void test_SetICMMode( HDC dc )
+{
+    INT ret, knob, save;
+
+    ret = SetICMMode( NULL, 0 );
+    ok( !ret, "SetICMMode succeeded (%d)\n", GetLastError() );
+
+    ret = SetICMMode( dc, -1 );
+    ok( !ret, "SetICMMode succeeded (%d)\n", GetLastError() );
+
+    save = SetICMMode( dc, ICM_QUERY );
+    ok( save == ICM_ON || save == ICM_OFF, "SetICMMode failed (%d)\n", GetLastError() );
+
+    if (save == ICM_ON) knob = ICM_OFF; else knob = ICM_ON;
+
+    ret = SetICMMode( dc, knob );
+    todo_wine ok( ret, "SetICMMode failed (%d)\n", GetLastError() );
+
+    ret = SetICMMode( dc, ICM_QUERY );
+    todo_wine ok( ret == knob, "SetICMMode failed (%d)\n", GetLastError() );
+
+    ret = SetICMMode( dc, save );
+    ok( ret, "SetICMMode failed (%d)\n", GetLastError() );
+
+    dc = CreateDCW( displayW, NULL, NULL, NULL );
+    ok( dc != NULL, "CreateDCW failed (%d)\n", GetLastError() );
+
+    ret = SetICMMode( dc, ICM_QUERY );
+    ok( ret == ICM_OFF, "SetICMMode failed (%d)\n", GetLastError() );
+
+    DeleteDC( dc );
+}
+
+START_TEST(icm)
+{
+    HDC dc = GetDC( NULL );
+
+    test_GetICMProfileA( dc );
+    test_GetICMProfileW( dc );
+    test_SetICMMode( dc );
+
+    ReleaseDC( NULL, dc );
+}




More information about the wine-cvs mailing list