Alexandre Julliard : kernel32/tests: Added some tests for FindResource.
Alexandre Julliard
julliard at winehq.org
Sat Mar 22 08:18:37 CDT 2008
Module: wine
Branch: master
Commit: 9879f78c13052b05fa56ef13ce545669ff96f878
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9879f78c13052b05fa56ef13ce545669ff96f878
Author: Alexandre Julliard <julliard at winehq.org>
Date: Sat Mar 22 13:09:44 2008 +0100
kernel32/tests: Added some tests for FindResource.
---
dlls/kernel32/tests/Makefile.in | 2 ++
dlls/kernel32/tests/resource.c | 37 +++++++++++++++++++++++++++++++++++++
dlls/kernel32/tests/resource.rc | 26 ++++++++++++++++++++++++++
3 files changed, 65 insertions(+), 0 deletions(-)
diff --git a/dlls/kernel32/tests/Makefile.in b/dlls/kernel32/tests/Makefile.in
index d87e47d..e48ecaf 100644
--- a/dlls/kernel32/tests/Makefile.in
+++ b/dlls/kernel32/tests/Makefile.in
@@ -39,6 +39,8 @@ CTESTS = \
virtual.c \
volume.c
+RC_SRCS = resource.rc
+
@MAKE_TEST_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend
diff --git a/dlls/kernel32/tests/resource.c b/dlls/kernel32/tests/resource.c
index 3e152e6..79d17f1 100644
--- a/dlls/kernel32/tests/resource.c
+++ b/dlls/kernel32/tests/resource.c
@@ -263,6 +263,42 @@ end:
CloseHandle( file );
}
+static void test_find_resource(void)
+{
+ HRSRC rsrc;
+
+ rsrc = FindResourceW( GetModuleHandle(0), (LPCWSTR)MAKEINTRESOURCE(1), (LPCWSTR)RT_MENU );
+ ok( rsrc != 0, "resource not found\n" );
+ rsrc = FindResourceExW( GetModuleHandle(0), (LPCWSTR)RT_MENU, (LPCWSTR)MAKEINTRESOURCE(1),
+ MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL ));
+ ok( rsrc != 0, "resource not found\n" );
+ rsrc = FindResourceExW( GetModuleHandle(0), (LPCWSTR)RT_MENU, (LPCWSTR)MAKEINTRESOURCE(1),
+ MAKELANGID( LANG_GERMAN, SUBLANG_DEFAULT ));
+ ok( rsrc != 0, "resource not found\n" );
+
+ SetLastError( 0xdeadbeef );
+ rsrc = FindResourceW( GetModuleHandle(0), (LPCWSTR)MAKEINTRESOURCE(1), (LPCWSTR)RT_DIALOG );
+ ok( !rsrc, "resource found\n" );
+ ok( GetLastError() == ERROR_RESOURCE_TYPE_NOT_FOUND, "wrong error %u\n", GetLastError() );
+
+ SetLastError( 0xdeadbeef );
+ rsrc = FindResourceW( GetModuleHandle(0), (LPCWSTR)MAKEINTRESOURCE(2), (LPCWSTR)RT_MENU );
+ ok( !rsrc, "resource found\n" );
+ ok( GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND, "wrong error %u\n", GetLastError() );
+
+ SetLastError( 0xdeadbeef );
+ rsrc = FindResourceExW( GetModuleHandle(0), (LPCWSTR)RT_MENU, (LPCWSTR)MAKEINTRESOURCE(1),
+ MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ) );
+ ok( !rsrc, "resource found\n" );
+ ok( GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND, "wrong error %u\n", GetLastError() );
+
+ SetLastError( 0xdeadbeef );
+ rsrc = FindResourceExW( GetModuleHandle(0), (LPCWSTR)RT_MENU, (LPCWSTR)MAKEINTRESOURCE(1),
+ MAKELANGID( LANG_FRENCH, SUBLANG_DEFAULT ) );
+ ok( !rsrc, "resource found\n" );
+ ok( GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND, "wrong error %u\n", GetLastError() );
+}
+
START_TEST(resource)
{
DeleteFile( filename );
@@ -283,4 +319,5 @@ START_TEST(resource)
update_resources_version();
check_exe( check_not_empty );
DeleteFile( filename );
+ test_find_resource();
}
diff --git a/dlls/kernel32/tests/resource.rc b/dlls/kernel32/tests/resource.rc
new file mode 100644
index 0000000..f40a878
--- /dev/null
+++ b/dlls/kernel32/tests/resource.rc
@@ -0,0 +1,26 @@
+/*
+ * Resources for kernel test suite.
+ *
+ * Copyright 2008 Alexandre Julliard
+ *
+ * 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 "windef.h"
+
+1 MENU LANGUAGE LANG_GERMAN, SUBLANG_DEFAULT
+{
+ MENUITEM "foo", 1
+}
More information about the wine-cvs
mailing list