Autosyncing with Wine HEAD
authorThe Wine Synchronizer <winesync@svn.reactos.org>
Fri, 24 Aug 2007 09:07:52 +0000 (09:07 +0000)
committerThe Wine Synchronizer <winesync@svn.reactos.org>
Fri, 24 Aug 2007 09:07:52 +0000 (09:07 +0000)
svn path=/trunk/; revision=28511

rostests/winetests/comdlg32/comdlg32.rbuild [new file with mode: 0644]
rostests/winetests/comdlg32/filedlg.c [new file with mode: 0644]
rostests/winetests/comdlg32/printdlg.c [new file with mode: 0644]
rostests/winetests/comdlg32/testlist.c [new file with mode: 0644]
rostests/winetests/directory.rbuild

diff --git a/rostests/winetests/comdlg32/comdlg32.rbuild b/rostests/winetests/comdlg32/comdlg32.rbuild
new file mode 100644 (file)
index 0000000..2b7ed26
--- /dev/null
@@ -0,0 +1,15 @@
+<module name="comdlg32_winetest" type="win32cui" installbase="bin" installname="comdlg32_winetest.exe" allowwarnings="true">\r
+       <include base="comdlg32_winetest">.</include>\r
+       <define name="__USE_W32API" />\r
+       <define name="_WIN32_IE">0x600</define>\r
+       <define name="_WIN32_WINNT">0x501</define>\r
+       <define name="WINVER">0x501</define>\r
+       <library>wine</library>\r
+       <library>comdlg32</library>\r
+       <library>user32</library>\r
+       <library>kernel32</library>\r
+       <library>ntdll</library>\r
+       <file>filedlg.c</file>\r
+       <file>printdlg.c</file>\r
+       <file>testlist.c</file>\r
+</module>\r
diff --git a/rostests/winetests/comdlg32/filedlg.c b/rostests/winetests/comdlg32/filedlg.c
new file mode 100644 (file)
index 0000000..698af1a
--- /dev/null
@@ -0,0 +1,116 @@
+/*\r
+ * Unit test suite for comdlg32 API functions: file dialogs\r
+ *\r
+ * Copyright 2007 Google (Lei Zhang)\r
+ *\r
+ * This library is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU Lesser General Public\r
+ * License as published by the Free Software Foundation; either\r
+ * version 2.1 of the License, or (at your option) any later version.\r
+ *\r
+ * This library is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+ * Lesser General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA\r
+ *\r
+ */\r
+\r
+#include <windows.h>\r
+#include <wine/test.h>\r
+\r
+\r
+/* ##### */\r
+\r
+static UINT CALLBACK OFNHookProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)\r
+{\r
+    LPNMHDR nmh;\r
+\r
+    if( msg == WM_NOTIFY)\r
+    {\r
+        nmh = (LPNMHDR) lParam;\r
+        if( nmh->code == CDN_INITDONE)\r
+        {\r
+            PostMessage( GetParent(hDlg), WM_COMMAND, IDCANCEL, FALSE);\r
+        }\r
+    }\r
+\r
+    return 0;\r
+}\r
+\r
+/* bug 6829 */\r
+static void test_DialogCancel(void)\r
+{\r
+    OPENFILENAMEA ofn;\r
+    BOOL result;\r
+    char szFileName[MAX_PATH] = "";\r
+\r
+    ZeroMemory(&ofn, sizeof(ofn));\r
+\r
+    ofn.lStructSize = sizeof(ofn);\r
+    ofn.hwndOwner = NULL;\r
+    ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0";\r
+    ofn.lpstrFile = szFileName;\r
+    ofn.nMaxFile = MAX_PATH;\r
+    ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ENABLEHOOK;\r
+    ofn.lpstrDefExt = "txt";\r
+    ofn.lpfnHook = (LPOFNHOOKPROC) OFNHookProc;\r
+\r
+    PrintDlgA(NULL);\r
+    ok(CDERR_INITIALIZATION == CommDlgExtendedError(), "expected %d, got %d\n",\r
+       CDERR_INITIALIZATION, CommDlgExtendedError());\r
+\r
+    result = GetOpenFileNameA(&ofn);\r
+    ok(0 == result, "expected %d, got %d\n", 0, result);\r
+    ok(0 == CommDlgExtendedError(), "expected %d, got %d\n", 0,\r
+       CommDlgExtendedError());\r
+\r
+    PrintDlgA(NULL);\r
+    ok(CDERR_INITIALIZATION == CommDlgExtendedError(), "expected %d, got %d\n",\r
+              CDERR_INITIALIZATION, CommDlgExtendedError());\r
+\r
+    SetLastError(0xdeadbeef);\r
+    result = GetOpenFileNameW((LPOPENFILENAMEW) &ofn);\r
+    if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)\r
+        skip("GetOpenFileNameW is not implemented\n");\r
+    else\r
+    {\r
+        ok(0 == result, "expected %d, got %d\n", 0, result);\r
+        ok(0 == CommDlgExtendedError(), "expected %d, got %d\n", 0,\r
+           CommDlgExtendedError());\r
+    }\r
+\r
+    PrintDlgA(NULL);\r
+    ok(CDERR_INITIALIZATION == CommDlgExtendedError(), "expected %d, got %d\n",\r
+              CDERR_INITIALIZATION, CommDlgExtendedError());\r
+\r
+    result = GetSaveFileNameA(&ofn);\r
+    ok(0 == result, "expected %d, got %d\n", 0, result);\r
+    ok(0 == CommDlgExtendedError(), "expected %d, got %d\n", 0,\r
+       CommDlgExtendedError());\r
+\r
+    PrintDlgA(NULL);\r
+    ok(CDERR_INITIALIZATION == CommDlgExtendedError(), "expected %d, got %d\n",\r
+              CDERR_INITIALIZATION, CommDlgExtendedError());\r
+\r
+    SetLastError(0xdeadbeef);\r
+    result = GetSaveFileNameW((LPOPENFILENAMEW) &ofn);\r
+    if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)\r
+        skip("GetSaveFileNameW is not implemented\n");\r
+    else\r
+    {\r
+        ok(0 == result, "expected %d, got %d\n", 0, result);\r
+        ok(0 == CommDlgExtendedError(), "expected %d, got %d\n", 0,\r
+           CommDlgExtendedError());\r
+    }\r
+}\r
+\r
+\r
+START_TEST(filedlg)\r
+{\r
+    test_DialogCancel();\r
+\r
+}\r
diff --git a/rostests/winetests/comdlg32/printdlg.c b/rostests/winetests/comdlg32/printdlg.c
new file mode 100644 (file)
index 0000000..5ace767
--- /dev/null
@@ -0,0 +1,153 @@
+/* \r
+ * Unit test suite for comdlg32 API functions: printer dialogs\r
+ *\r
+ * Copyright 2006 Detlef Riekenberg\r
+ *\r
+ * This library is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU Lesser General Public\r
+ * License as published by the Free Software Foundation; either\r
+ * version 2.1 of the License, or (at your option) any later version.\r
+ *\r
+ * This library is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+ * Lesser General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA\r
+ *\r
+ */\r
+\r
+#include <stdarg.h>\r
+\r
+#include "windef.h"\r
+#include "winbase.h"\r
+#include "winerror.h"\r
+#include "wingdi.h"\r
+#include "wingdi.h"\r
+#include "winuser.h"\r
+\r
+#include "cderr.h"\r
+#include "commdlg.h"\r
+\r
+#include "wine/test.h"\r
+\r
+\r
+/* ######## */\r
+\r
+static void test_PageSetupDlgA(void)\r
+{\r
+    LPPAGESETUPDLGA pDlg;\r
+    DWORD res;\r
+\r
+    pDlg = HeapAlloc(GetProcessHeap(), 0, (sizeof(PAGESETUPDLGA)) * 2);\r
+    if (!pDlg) return;\r
+\r
+    SetLastError(0xdeadbeef);\r
+    res = PageSetupDlgA(NULL);\r
+    ok( !res && (CommDlgExtendedError() == CDERR_INITIALIZATION),\r
+        "returned %u with %u and 0x%x (expected '0' and "\r
+        "CDERR_INITIALIZATION)\n", res, GetLastError(), CommDlgExtendedError());\r
+\r
+    ZeroMemory(pDlg, sizeof(PAGESETUPDLGA));\r
+    pDlg->lStructSize = sizeof(PAGESETUPDLGA) -1;\r
+    SetLastError(0xdeadbeef);\r
+    res = PageSetupDlgA(pDlg);\r
+    ok( !res && (CommDlgExtendedError() == CDERR_STRUCTSIZE),\r
+        "returned %u with %u and 0x%x (expected '0' and "\r
+        "CDERR_STRUCTSIZE)\n", res, GetLastError(), CommDlgExtendedError());\r
+\r
+    ZeroMemory(pDlg, sizeof(PAGESETUPDLGA));\r
+    pDlg->lStructSize = sizeof(PAGESETUPDLGA) +1;\r
+    pDlg->Flags = PSD_RETURNDEFAULT;\r
+    SetLastError(0xdeadbeef);\r
+    res = PageSetupDlgA(pDlg);\r
+    ok( !res && (CommDlgExtendedError() == CDERR_STRUCTSIZE),\r
+        "returned %u with %u and 0x%x (expected '0' and CDERR_STRUCTSIZE)\n",\r
+        res, GetLastError(), CommDlgExtendedError());\r
+\r
+\r
+    ZeroMemory(pDlg, sizeof(PAGESETUPDLGA));\r
+    pDlg->lStructSize = sizeof(PAGESETUPDLGA);\r
+    pDlg->Flags = PSD_RETURNDEFAULT;\r
+    SetLastError(0xdeadbeef);\r
+    res = PageSetupDlgA(pDlg);\r
+    trace("after pagesetupdlga res = %d, le %d, ext error 0x%x\n",\r
+       res, GetLastError(), CommDlgExtendedError());\r
+    ok( res || (CommDlgExtendedError() == PDERR_NODEFAULTPRN),\r
+        "returned %u with %u and 0x%x (expected '!= 0' or '0' and "\r
+        "PDERR_NODEFAULTPRN)\n", res, GetLastError(), CommDlgExtendedError());\r
+    if (!res && (CommDlgExtendedError() == PDERR_NODEFAULTPRN)) {\r
+       skip("No printer configured.\n");\r
+       HeapFree(GetProcessHeap(), 0, pDlg);\r
+       return;\r
+    }\r
+    ok( pDlg->hDevMode && pDlg->hDevNames,\r
+        "got %p and %p (expected '!= NULL' for both)\n",\r
+        pDlg->hDevMode, pDlg->hDevNames);\r
+\r
+    GlobalFree(pDlg->hDevMode);\r
+    GlobalFree(pDlg->hDevNames);\r
+\r
+    HeapFree(GetProcessHeap(), 0, pDlg);\r
+\r
+}\r
+\r
+/* ##### */\r
+\r
+static void test_PrintDlgA(void)\r
+{\r
+    DWORD       res;\r
+    LPPRINTDLGA pDlg;\r
+\r
+\r
+    pDlg = HeapAlloc(GetProcessHeap(), 0, (sizeof(PRINTDLGA)) * 2);\r
+    if (!pDlg) return;\r
+\r
+\r
+    /* will crash with unpatched wine */\r
+    SetLastError(0xdeadbeef);\r
+    res = PrintDlgA(NULL);\r
+    ok( !res && (CommDlgExtendedError() == CDERR_INITIALIZATION),\r
+        "returned %d with 0x%x and 0x%x (expected '0' and "\r
+        "CDERR_INITIALIZATION)\n", res, GetLastError(), CommDlgExtendedError());\r
+\r
+    ZeroMemory(pDlg, sizeof(PRINTDLGA));\r
+    pDlg->lStructSize = sizeof(PRINTDLGA) - 1;\r
+    SetLastError(0xdeadbeef);\r
+    res = PrintDlgA(pDlg);\r
+    ok( !res && (CommDlgExtendedError() == CDERR_STRUCTSIZE),\r
+        "returned %d with 0x%x and 0x%x (expected '0' and "\r
+        "CDERR_STRUCTSIZE)\n", res, GetLastError(), CommDlgExtendedError());\r
+\r
+    ZeroMemory(pDlg, sizeof(PRINTDLGA));\r
+    pDlg->lStructSize = sizeof(PRINTDLGA) + 1;\r
+    pDlg->Flags = PD_RETURNDEFAULT;\r
+    SetLastError(0xdeadbeef);\r
+    res = PrintDlgA(pDlg);\r
+    ok( !res && (CommDlgExtendedError() == CDERR_STRUCTSIZE),\r
+        "returned %u with %u and 0x%x (expected '0' and "\r
+        "CDERR_STRUCTSIZE)\n", res, GetLastError(), CommDlgExtendedError());\r
+\r
+\r
+    ZeroMemory(pDlg, sizeof(PRINTDLGA));\r
+    pDlg->lStructSize = sizeof(PRINTDLGA);\r
+    pDlg->Flags = PD_RETURNDEFAULT;\r
+    SetLastError(0xdeadbeef);\r
+    res = PrintDlgA(pDlg);\r
+    ok( res || (CommDlgExtendedError() == PDERR_NODEFAULTPRN),\r
+        "returned %d with 0x%x and 0x%x (expected '!= 0' or '0' and "\r
+        "PDERR_NODEFAULTPRN)\n", res, GetLastError(), CommDlgExtendedError());\r
+\r
+    HeapFree(GetProcessHeap(), 0, pDlg);\r
+\r
+}\r
+\r
+\r
+START_TEST(printdlg)\r
+{\r
+    test_PageSetupDlgA();\r
+    test_PrintDlgA();\r
+\r
+}\r
diff --git a/rostests/winetests/comdlg32/testlist.c b/rostests/winetests/comdlg32/testlist.c
new file mode 100644 (file)
index 0000000..abbda30
--- /dev/null
@@ -0,0 +1,17 @@
+/* Automatically generated file; DO NOT EDIT!! */\r
+\r
+#define WIN32_LEAN_AND_MEAN\r
+#include <windows.h>\r
+\r
+#define STANDALONE\r
+#include "wine/test.h"\r
+\r
+extern void func_filedlg(void);\r
+extern void func_printdlg(void);\r
+\r
+const struct test winetest_testlist[] =\r
+{\r
+    { "filedlg", func_filedlg },\r
+    { "printdlg", func_printdlg },\r
+    { 0, 0 }\r
+};\r
index b05b0f0..2f8e1c8 100644 (file)
@@ -8,17 +8,20 @@
 <directory name="comctl32">
        <xi:include href="comctl32/comctl32.rbuild" />
 </directory>
+<directory name="comdlg32">
+       <xi:include href="comdlg32/comdlg32.rbuild" />
+</directory>
 <directory name="gdi32">
        <xi:include href="gdi32/gdi32.rbuild" />
 </directory>
 <directory name="icmp">
-        <xi:include href="icmp/icmp.rbuild" />
+       <xi:include href="icmp/icmp.rbuild" />
 </directory>
 <directory name="kernel32">
        <xi:include href="kernel32/kernel32.rbuild" />
 </directory>
 <directory name="lz32">
-        <xi:include href="lz32/lz32.rbuild" />
+       <xi:include href="lz32/lz32.rbuild" />
 </directory>
 <directory name="msi">
        <xi:include href="msi/msi.rbuild" />